<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-28 2:16 GMT+02:00 Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">On Sun, 27 Jul 2014, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Graphics-nice.298.mcz" target="_blank">http://source.squeak.org/<u></u>trunk/Graphics-nice.298.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Graphics-nice.298<br>
Author: nice<br>
Time: 27 July 2014, 4:20:11.638 pm<br>
UUID: 170cf894-37d9-4c00-adc3-<u></u>8531594246dc<br>
Ancestors: Graphics-nice.297<br>
<br>
Rather than commenting uggliness, remove it.<br>
<br>
Compatibility notes:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
>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.<br>
</blockquote>
Resetting a Stream was only ever required for constructs like (ReadWriteStream with: 'someData') reset.<br>
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.<br>
If really ReadWriteStream is what fits (why?) then you'll now have to perform the reset by yourself.<br>
</blockquote>
<br></div>
The stream will still receive #reset many times from #understandsImageFormat, #understandsImageFormat: and the instance side #on: methods.<br>
So I think this change may break #readNativeResourceFrom:.<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
Levente</font></span><div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div>Thanks Levente, this requires more patching and testing.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
=============== Diff against Graphics-nice.297 ===============<br>
<br>
Item was changed:<br>
----- Method: Form>>readNativeResourceFrom: (in category 'resources') -----<br>
readNativeResourceFrom: byteStream<br>
| img aStream |<br>
+ aStream := byteStream.<br>
- (byteStream isKindOf: FileStream) ifTrue:[<br>
- "Ugly, but ImageReadWriter will send #reset which is implemented as #reopen and we may not be able to do so."<br>
- aStream := RWBinaryOrTextStream with: byteStream contents.<br>
- ] ifFalse:[<br>
- aStream := byteStream.<br>
- ].<br>
img := [ImageReadWriter formFromStream: aStream] on: Error do:[:ex| nil].<br>
img ifNil:[^nil].<br>
(img isColorForm and:[self isColorForm]) ifTrue:[<br>
| cc |<br>
cc := img colors.<br>
img colors: nil.<br>
img displayOn: self.<br>
img colors: cc.<br>
] ifFalse:[<br>
img displayOn: self.<br>
].<br>
img := nil.!<br>
<br>
Item was changed:<br>
----- Method: ImageReadWriter class>>formFromStream: (in category 'image reading/writing') -----<br>
formFromStream: aBinaryStream<br>
"Answer a ColorForm stored on the given stream. closes the stream"<br>
| reader readerClass form |<br>
<br>
readerClass := self withAllSubclasses<br>
detect: [:subclass | subclass understandsImageFormat: aBinaryStream]<br>
ifNone: [<br>
aBinaryStream close.<br>
^self error: 'image format not recognized'].<br>
+ reader := readerClass new on: aBinaryStream.<br>
- reader := readerClass new on: aBinaryStream reset.<br>
Cursor read showWhile: [<br>
form := reader nextImage.<br>
reader close].<br>
^ form<br>
!<br>
<br>
<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>