[squeak-dev] The Trunk: Graphics-nice.298.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Jul 27 14:21:10 UTC 2014
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.298.mcz
==================== Summary ====================
Name: Graphics-nice.298
Author: nice
Time: 27 July 2014, 4:20:11.638 pm
UUID: 170cf894-37d9-4c00-adc3-8531594246dc
Ancestors: Graphics-nice.297
Rather than commenting uggliness, remove it.
Compatibility notes:
>From now on, DON'T expect (ImageReadWriter formFromStream: yourStream) to reset yourStream. It's not its business, besides it does not work for every kind of Stream.
Resetting a Stream was only ever required for constructs like (ReadWriteStream with: 'someData') reset.
But you DON'T have to use a ReadWriteStream if it's just for reading. Rather use a ReadStream, this way, no reset is required.
If really ReadWriteStream is what fits (why?) then you'll now have to perform the reset by yourself.
=============== Diff against Graphics-nice.297 ===============
Item was changed:
----- Method: Form>>readNativeResourceFrom: (in category 'resources') -----
readNativeResourceFrom: byteStream
| img aStream |
+ aStream := byteStream.
- (byteStream isKindOf: FileStream) ifTrue:[
- "Ugly, but ImageReadWriter will send #reset which is implemented as #reopen and we may not be able to do so."
- aStream := RWBinaryOrTextStream with: byteStream contents.
- ] ifFalse:[
- aStream := byteStream.
- ].
img := [ImageReadWriter formFromStream: aStream] on: Error do:[:ex| nil].
img ifNil:[^nil].
(img isColorForm and:[self isColorForm]) ifTrue:[
| cc |
cc := img colors.
img colors: nil.
img displayOn: self.
img colors: cc.
] ifFalse:[
img displayOn: self.
].
img := nil.!
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'].
+ reader := readerClass new on: aBinaryStream.
- reader := readerClass new on: aBinaryStream reset.
Cursor read showWhile: [
form := reader nextImage.
reader close].
^ form
!
More information about the Squeak-dev
mailing list
|