The Trunk: Graphics-bf.339.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-bf.339.mcz

commits-2
Bert Freudenberg uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-bf.339.mcz

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

Name: Graphics-bf.339
Author: bf
Time: 25 May 2016, 3:31:08.816172 pm
UUID: 8ff86a2f-2422-4873-b7b2-63870f187c28
Ancestors: Graphics-bf.338

PNG: stop processing after IEND chunk

=============== Diff against Graphics-bf.338 ===============

Item was changed:
  ----- Method: PNGReadWriter>>processNextChunk (in category 'chunks') -----
  processNextChunk
 
  | length chunkType crc chunkCrc |
 
  length := self nextLong.
 
  chunkType := (self next: 4) asString.
  (chunk isNil or: [ chunk size ~= length ])
  ifTrue: [ chunk := self next: length ]
  ifFalse: [ stream next: length into: chunk startingAt: 1 ].
  chunkCrc := self nextLong bitXor: 16rFFFFFFFF.
  crc := self updateCrc: 16rFFFFFFFF from: 1 to: 4 in: chunkType.
  crc := self updateCrc: crc from: 1 to: length in: chunk.
  crc = chunkCrc ifFalse:[
  self error: 'PNGReadWriter crc error in chunk ', chunkType.
  ].
 
+ chunkType = 'IEND' ifTrue: [stream setToEnd. ^self "*should* be the last chunk"].
- chunkType = 'IEND' ifTrue: [^self "*should* be the last chunk"].
  chunkType = 'sBIT' ifTrue: [^self processSBITChunk "could indicate unusual sample depth in original"].
  chunkType = 'gAMA' ifTrue: [^self "indicates gamma correction value"].
  chunkType = 'bKGD' ifTrue: [^self processBackgroundChunk].
  chunkType = 'pHYs' ifTrue: [^self processPhysicalPixelChunk].
  chunkType = 'tRNS' ifTrue: [^self processTransparencyChunk].
 
  chunkType = 'IHDR' ifTrue: [^self processIHDRChunk].
  chunkType = 'PLTE' ifTrue: [^self processPLTEChunk].
  chunkType = 'IDAT' ifTrue: [
  "---since the compressed data can span multiple
  chunks, stitch them all together first. later,
  if memory is an issue, we need to figure out how
  to do this on the fly---"
  idatChunkStream
  ifNil: [ idatChunkStream := WriteStream with: chunk copy ]
  ifNotNil: [ idatChunkStream nextPutAll: chunk ].
  ^self
  ].
  unknownChunks add: chunkType.
  !