[Pkg] The Trunk: Graphics-dtl.377.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Jun 18 19:25:03 UTC 2017
David T. Lewis uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-dtl.377.mcz
==================== Summary ====================
Name: Graphics-dtl.377
Author: dtl
Time: 18 June 2017, 3:24:52.934136 pm
UUID: 1a95683d-f794-468e-94ac-03fc69a78dd0
Ancestors: Graphics-eem.376
Fix PNGReadWriterTest>>testNewFromSampleBytes by normalizing large integers prior to calling primitive 61.
=============== Diff against Graphics-eem.376 ===============
Item was changed:
----- Method: PNGReadWriter>>copyPixelsRGB: (in category 'pixel copies') -----
copyPixelsRGB: y
"Handle non-interlaced RGB color mode (colorType = 2)"
| i pixel tempForm tempBits |
(transparentPixelValue isNil and: [ bitsPerChannel = 8 ]) ifTrue: [ "Do the same trick as in #copyPixelsRGBA:"
| targetIndex |
tempBits := ByteArray new: thisScanline size * 4 // 3 withAll: 16rFF.
tempForm := Form extent: width at 1 depth: 32 bits: tempBits.
targetIndex := 1.
1 to: thisScanline size by: 3 do: [ :index |
tempBits
at: targetIndex put: (thisScanline at: index);
at: targetIndex + 1 put: (thisScanline at: index + 1);
at: targetIndex + 2 put: (thisScanline at: index + 2).
targetIndex := targetIndex + 4 ].
cachedDecoderMap
ifNil:[cachedDecoderMap := self rgbaDecoderMapForDepth: depth].
(BitBlt toForm: form)
sourceForm: tempForm;
destOrigin: 0 at y;
combinationRule: Form over;
colorMap: cachedDecoderMap;
copyBits.
^self ].
tempForm := Form extent: width at 1 depth: 32.
tempBits := tempForm bits.
pixel := LargePositiveInteger new: 4.
pixel at: 4 put: 16rFF.
bitsPerChannel = 8
ifTrue:
[i := 1.
1 to: width do:
[ :x |
pixel
at: 3 put: (thisScanline at: i);
at: 2 put: (thisScanline at: i+1);
at: 1 put: (thisScanline at: i+2).
+ tempBits at: x put: pixel normalize.
- tempBits at: x put: pixel.
i := i + 3].
transparentPixelValue
ifNotNil:
[1 to: width do: [ :x |
(tempBits at: x) = transparentPixelValue
ifTrue: [tempBits at: x put: 0]]]]
ifFalse:
[i := 1.
1 to: width do:
[ :x |
(transparentPixelValue == nil or: [(1 to: 6) anySatisfy: [:k | (transparentPixelValue digitAt: k) ~= (thisScanline at: i + 6 - k)]])
ifTrue:
[pixel
at: 3 put: (thisScanline at: i);
at: 2 put: (thisScanline at: i+2);
at: 1 put: (thisScanline at: i+4).
+ tempBits at: x put: pixel normalize]
- tempBits at: x put: pixel]
ifFalse:
[tempBits at: x put: 0].
i := i + 6]].
tempForm displayOn: form at: 0 at y rule: Form over.
!
Item was changed:
----- Method: PNGReadWriter>>copyPixelsRGB:at:by: (in category 'pixel copies') -----
copyPixelsRGB: y at: startX by: incX
"Handle interlaced RGB color mode (colorType = 2)"
| i pixel tempForm tempBits xx loopsToDo |
tempForm := Form extent: width at 1 depth: 32.
tempBits := tempForm bits.
pixel := LargePositiveInteger new: 4.
pixel at: 4 put: 16rFF.
loopsToDo := width - startX + incX - 1 // incX.
bitsPerChannel = 8
ifTrue:
[i := (startX // incX * 3) + 1.
xx := startX+1.
1 to: loopsToDo do:
[ :j |
pixel
at: 3 put: (thisScanline at: i);
at: 2 put: (thisScanline at: i+1);
at: 1 put: (thisScanline at: i+2).
+ tempBits at: xx put: pixel normalize.
- tempBits at: xx put: pixel.
i := i + 3.
xx := xx + incX].
transparentPixelValue
ifNotNil: [startX to: width-1 by: incX do: [ :x |
(tempBits at: x+1) = transparentPixelValue
ifTrue: [ tempBits at: x+1 put: 0]]]]
ifFalse:
[i := (startX // incX * 6) + 1.
xx := startX+1.
1 to: loopsToDo do:
[ :j |
(transparentPixelValue == nil or: [(1 to: 6) anySatisfy: [:k | (transparentPixelValue digitAt: k) ~= (thisScanline at: i + 6 - k)]])
ifTrue:
[pixel
at: 3 put: (thisScanline at: i);
at: 2 put: (thisScanline at: i+2);
at: 1 put: (thisScanline at: i+4).
+ tempBits at: xx put: pixel normalize.]
- tempBits at: xx put: pixel.]
ifFalse:
[tempBits at: xx put: 0].
i := i + 6.
xx := xx + incX]].
tempForm displayOn: form at: 0 at y rule: Form over.
!
Item was changed:
----- Method: PNGReadWriter>>copyPixelsRGBA: (in category 'pixel copies') -----
copyPixelsRGBA: y
"Handle non-interlaced RGBA color modes (colorType = 6)"
| i pixel tempForm tempBits ff |
bitsPerChannel = 8 ifTrue: [
ff := Form extent: width at 1 depth: 32 bits: thisScanline.
cachedDecoderMap
ifNil:[cachedDecoderMap := self rgbaDecoderMapForDepth: depth].
(BitBlt toForm: form)
sourceForm: ff;
destOrigin: 0 at y;
combinationRule: Form over;
colorMap: cachedDecoderMap;
copyBits.
^self.
].
tempForm := Form extent: width at 1 depth: 32.
tempBits := tempForm bits.
pixel := LargePositiveInteger new: 4.
i := -7.
0 to: width-1 do: [ :x |
i := i + 8.
pixel at: 4 put: (thisScanline at: i+6);
at: 3 put: (thisScanline at: i);
at: 2 put: (thisScanline at: i+2);
at: 1 put: (thisScanline at: i+4).
+ tempBits at: x+1 put: pixel normalize.
- tempBits at: x+1 put: pixel.
].
tempForm displayOn: form at: 0 at y rule: Form over.
!
Item was changed:
----- Method: PNGReadWriter>>copyPixelsRGBA:at:by: (in category 'pixel copies') -----
copyPixelsRGBA: y at: startX by: incX
"Handle interlaced RGBA color modes (colorType = 6)"
| i pixel tempForm tempBits |
tempForm := Form extent: width at 1 depth: 32.
tempBits := tempForm bits.
pixel := LargePositiveInteger new: 4.
bitsPerChannel = 8 ifTrue: [
i := (startX // incX << 2) + 1.
startX to: width-1 by: incX do: [ :x |
pixel at: 4 put: (thisScanline at: i+3);
at: 3 put: (thisScanline at: i);
at: 2 put: (thisScanline at: i+1);
at: 1 put: (thisScanline at: i+2).
+ tempBits at: x+1 put: pixel normalize.
- tempBits at: x+1 put: pixel.
i := i + 4.
]
] ifFalse: [
i := (startX // incX << 3) +1.
startX to: width-1 by: incX do: [ :x |
pixel at: 4 put: (thisScanline at: i+6);
at: 3 put: (thisScanline at: i);
at: 2 put: (thisScanline at: i+2);
at: 1 put: (thisScanline at: i+4).
+ tempBits at: x+1 put: pixel normalize.
- tempBits at: x+1 put: pixel.
i := i + 8.
].
].
tempForm displayOn: form at: 0 at y rule: Form paintAlpha.
!
More information about the Packages
mailing list