<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 20.12.2013, at 00:55, Nicolas Cellier &lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2013/12/13 Nicolas Cellier <span dir="ltr">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I feel like it would be better to change pixelValueAt: so as to always unhibernate, but I did not dare if ever someone had the idea of sending it in tight loops (one shouldn't, there is BitBlt for that purpose, but who knows...).<br>

<br>Maybe we could fail primitivePixelValueAt if receiver is Byte like, and unhibernate in fallback code.<br>We would let every other BitBlt primitives accept a ByteArray to allow BitBlt tricks.<br><br>Thoughts?<br></div>

<div class="gmail_extra"><br></div></blockquote><div><br></div><div>No one raised a comment so far.<br></div><div>Isn't it a good idea to fail the primitive?<br></div></div></div></div></blockquote><div><br></div><div>The primitive must fail, yes. That is simply a bug. Before that primitive existed, pixelValueAt: used BitBlt which did the unhibernate.&nbsp;</div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>If yes, then it's very simple to implement, just add:<br>
<br>&nbsp;&nbsp;&nbsp; (interpreterProxy isWords: bitmap)&nbsp;&nbsp;&nbsp; ifFalse:[interpreterProxy primitiveFail].<br></div></div></div></div></blockquote><div><br></div><div>IMHO the primitive should do the same check as BitBlt: verify that the size of the bits is exactly right given width, height, and depth.</div><div><br></div><div>- Bert -</div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>somewhere in the preamble of&nbsp; BitBltSimulation&gt;&gt;primitivePixelValueAtX: xVal y: yVal <br><br></div><div>I check the senders of pixelValueAt:, and some of them would loop over each pixel.<br>
So sending unhibernate at each pixel does not seem a good idea anyway.</div></div></div></div></blockquote><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Leaking unhibernate sends out of the loop neither is, because then 3rd party classes must be aware of an implementation detail of Form.<br>
</div><div><br></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote">2013/12/13  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</span><div>
<div class="h5"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Nicolas Cellier uploaded a new version of MorphicExtras to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/MorphicExtras-nice.137.mcz" target="_blank">http://source.squeak.org/trunk/MorphicExtras-nice.137.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: MorphicExtras-nice.137<br>
Author: nice<br>
Time: 13 December 2013, 10:07:57.316 pm<br>
UUID: 127ce68e-b210-42a3-b0b3-b40c69941d02<br>
Ancestors: MorphicExtras-nice.136<br>
<br>
Correct an awfull bug in PaintBoxMorph&gt;&gt;showColor<br>
One should NEVER send pixelValueAt: nor colorAt: to an hibernated Form (or ColorForm).<br>
<br>
=============== Diff against MorphicExtras-nice.136 ===============<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: PaintBoxMorph&gt;&gt;showColor (in category 'actions') -----<br>
&nbsp; showColor<br>
&nbsp; &nbsp; &nbsp; &nbsp; "Display the current color in all brushes, both on and off."<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; | offIndex onIndex center |<br>
&nbsp; &nbsp; &nbsp; &nbsp; currentColor ifNil: [^self].<br>
&nbsp; &nbsp; &nbsp; &nbsp; "colorPatch color: currentColor. &nbsp; &nbsp; &nbsp; &nbsp;May delete later"<br>
&nbsp; &nbsp; &nbsp; &nbsp; (brushes isNil or: [brushes first owner ~~ self])<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifTrue:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [brushes := OrderedCollection new.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #(#brush1: #brush2: #brush3: #brush4: #brush5: #brush6:)<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do: [:sel | brushes addLast: (self submorphNamed: sel)]].<br>
+ &nbsp; &nbsp; &nbsp; brushes last offImage unhibernate.<br>
+ &nbsp; &nbsp; &nbsp; brushes last onImage unhibernate.<br>
+ &nbsp; &nbsp; &nbsp; brushes last pressedImage unhibernate.<br>
+ &nbsp; &nbsp; &nbsp; center := brushes last offImage extent // 2.<br>
+ &nbsp; &nbsp; &nbsp; offIndex := brushes last offImage pixelValueAt: center.<br>
+ &nbsp; &nbsp; &nbsp; onIndex := brushes last onImage pixelValueAt: center.<br>
- &nbsp; &nbsp; &nbsp; center := (brushes sixth) offImage extent // 2.<br>
- &nbsp; &nbsp; &nbsp; offIndex := (brushes sixth) offImage pixelValueAt: center.<br>
- &nbsp; &nbsp; &nbsp; onIndex := (brushes sixth) onImage pixelValueAt: center.<br>
&nbsp; &nbsp; &nbsp; &nbsp; brushes do:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [:bb |<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb offImage colors at: offIndex + 1 put: currentColor.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb offImage clearColormapCache.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb onImage colors at: onIndex + 1 put: currentColor.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb onImage clearColormapCache.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb invalidRect: bb bounds].<br>
&nbsp; &nbsp; &nbsp; &nbsp; self invalidRect: (brushes first topLeft rect: brushes last bottomRight)!<br>
<br>
<br>
</blockquote></div></div></div><br></div>
</blockquote></div><br></div></div>
<br></blockquote></div><br></body></html>