Nicolas Cellier uploaded a new version of Graphics to project The Trunk: http://source.squeak.org/trunk/Graphics-nice.299.mcz
==================== Summary ====================
Name: Graphics-nice.299 Author: nice Time: 28 July 2014, 12:17:36.812 pm UUID: 571c7dc6-b3c2-45cd-8a70-372784b82f72 Ancestors: Graphics-nice.298
Continue cleaning of RWBinaryOrTextStream reset uggliness: - don't reset the stream in ImageReadWriter initialization (>>on:) - reset the stream after sending #understandsImageFormat: - make sure the stream is still binary after the reset in JPEGReadWriter class>>understandsImageFormat: - NOTE: from what I understand, RWBinaryOrTextStream and it's Multi alternative are those loosing the binary property, not FileStream... These swiss knife streams are really a next of undue complexity. This workaround should go away when we finally get rid of them.
=============== Diff against Graphics-nice.298 ===============
Item was changed: ----- Method: ImageReadWriter class>>formFromStream: (in category 'image reading/writing') ----- formFromStream: aBinaryStream "Answer a ColorForm stored on the given stream. closes the stream" | reader readerClass form |
readerClass := self withAllSubclasses detect: [:subclass | subclass understandsImageFormat: aBinaryStream] ifNone: [ aBinaryStream close. ^self error: 'image format not recognized']. + aBinaryStream reset. reader := readerClass new on: aBinaryStream. Cursor read showWhile: [ form := reader nextImage. reader close]. ^ form !
Item was changed: ----- Method: ImageReadWriter>>on: (in category 'private') ----- on: aStream + stream := aStream. + stream binary.! - (stream := aStream) reset. - stream binary. - "Note that 'reset' makes a file be text. Must do this after."!
Item was changed: ----- Method: JPEGReadWriter class>>understandsImageFormat: (in category 'image reading/writing') ----- understandsImageFormat: aStream (JPEGReadWriter2 understandsImageFormat: aStream) ifTrue:[^false]. + aStream reset; binary. - aStream reset. aStream next = 16rFF ifFalse: [^ false]. aStream next = 16rD8 ifFalse: [^ false]. ^true!
packages@lists.squeakfoundation.org