The Trunk: Graphics-eem.449.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Graphics-eem.449.mcz

commits-2
Eliot Miranda uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-eem.449.mcz

==================== Summary ====================

Name: Graphics-eem.449
Author: eem
Time: 17 June 2021, 10:46:52.453492 am
UUID: b792d8b6-a478-4227-9a11-c89a70cb3622
Ancestors: Graphics-mt.448

Simplify initializing Forms and allow 64-bit arrays to be used as bitmaps.

=============== Diff against Graphics-mt.448 ===============

Item was changed:
  ----- Method: Form>>bitsSize (in category 'accessing') -----
  bitsSize
+ | pixelsPerWord |
+ depth ifNil: [depth := 1].
+ pixelsPerWord := 32 // self depth.
+ ^width + pixelsPerWord - 1 // pixelsPerWord * height!
- | pixPerWord |
- depth == nil ifTrue: [depth := 1].
- pixPerWord := 32 // self depth.
- ^ width + pixPerWord - 1 // pixPerWord * height!

Item was changed:
  ----- Method: Form>>setExtent:depth:bits: (in category 'private') -----
  setExtent: extent depth: bitsPerPixel bits: bitmap
  "Create a virtual bit map with the given extent and bitsPerPixel."
+ | bitsClass |
+ (width := extent x asInteger) < 0 ifTrue: [width := 0].
+ (height := extent y asInteger) < 0 ifTrue: [height := 0].
-
- width := extent x asInteger.
- width < 0 ifTrue: [width := 0].
- height := extent y asInteger.
- height < 0 ifTrue: [height := 0].
  depth := bitsPerPixel.
- depth := bitsPerPixel.
  (bits isNil
+ or: [(bitsClass := bits class) isBits
+ and: [self bitsSize * 4 "bytes per pixel" = (bitmap size * bitsClass elementSize)]]) ifFalse:
+ [^self error: 'Bad dimensions and/or bitmap kind'].
- or:[(bitmap class isWords and: [self bitsSize = bitmap size])
- or: [bitmap class isBytes and: [self bitsSize * 4 = bitmap size]]])
- ifFalse:[^self error:'Bad dimensions'].
  bits := bitmap!