[squeak-dev] Squeak 4.6: Graphics-mt.316.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Oct 20 09:40:32 UTC 2015

Marcel Taeumel uploaded a new version of Graphics to project Squeak 4.6:

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

Name: Graphics-mt.316
Author: mt
Time: 20 October 2015, 11:40:19.755 am
UUID: 41cf59e1-6149-7e4b-9d40-485a1f4798ef
Ancestors: Graphics-mt.313

Fixes loading of PNG files for recent (> #3397) v3 CogVMs.

There seems to be a bug in the VM that, at some point, manifests itself by replacing z, which is the current ZLib stream, with self, which is the PNGReadWriter. Any indirection with a BlockClosure will do. I chose to create an interval and then calling #do: on that interval. Another way would be to wrap the body/argument of #to:do: into another block like this:

0 to: height-1 do: [:y | [ ... ] value ].

This fix might affect performance a tiny little bit and might be removed as soon as the VM bug gets fixed. 

Note that there might be other places in the code affected by this bug.

=============== Diff against Graphics-mt.313 ===============

Item was changed:
  ----- Method: PNGReadWriter>>processNonInterlaced (in category 'chunks') -----
  	| z filter temp copyMethod debug |
  	debug := self debugging.
  	copyMethod := #(copyPixelsGray: nil copyPixelsRGB: copyPixelsIndexed:
  		  copyPixelsGrayAlpha: nil copyPixelsRGBA:) at: colorType+1.
  	debug ifTrue: [ Transcript cr; nextPutAll: 'NI chunk size='; print: idatChunkStream position ].
  	z := ZLibReadStream 
  		on: idatChunkStream originalContents
  		from: 1
  		to: idatChunkStream position.
  	prevScanline := ByteArray new: bytesPerScanline.
  	thisScanline := ByteArray new: bytesPerScanline.
+ 	(0 to: height-1) do: [ :y |
- 	0 to: height-1 do: [ :y |
  		filter := z next.
  		debug ifTrue:[filtersSeen add: filter].
  		thisScanline := z next: bytesPerScanline into: thisScanline startingAt: 1.
  		(debug and: [ thisScanline size < bytesPerScanline ]) ifTrue: [ Transcript nextPutAll: ('wanted {1} but only got {2}' format: { bytesPerScanline. thisScanline size }); cr ].
  		filter = 0 ifFalse:[self filterScanline: filter count: bytesPerScanline].
  		self perform: copyMethod with: y.
  		temp := prevScanline.
  		prevScanline := thisScanline.
  		thisScanline := temp.
  	z atEnd ifFalse:[self error:'Unexpected data'].
  	debug ifTrue: [Transcript  nextPutAll: ' compressed size='; print: z position  ].

More information about the Squeak-dev mailing list