<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 14 March 2017 at 20:47, Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Mar 12, 2017 at 4:53 AM, Esteban Lorenzano <span dir="ltr"><<a href="mailto:estebanlm@gmail.com" target="_blank">estebanlm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><div style="word-wrap:break-word">Hi, <div><br></div><div>this is lockSurfaceFn: </div><div><br></div><div><div>createLockSurfaceFn</div><div><span class="m_6347612284858692805gmail-m_6776915999791033109Apple-tab-span" style="white-space:pre-wrap">      </span>^ FFICallback </div><div><span class="m_6347612284858692805gmail-m_6776915999791033109Apple-tab-span" style="white-space:pre-wrap">         </span>signature: #(void * (void *handle, int *pitch, int x, int y, int w, int h))</div><div><span class="m_6347612284858692805gmail-m_6776915999791033109Apple-tab-span" style="white-space:pre-wrap">             </span>block: [ :handle :pitch :x :y :w :h |</div><div><span class="m_6347612284858692805gmail-m_6776915999791033109Apple-tab-span" style="white-space:pre-wrap">                   </span>pitch signedLongAt: 1 put: (self get_stride: handle).</div><div><span class="m_6347612284858692805gmail-m_6776915999791033109Apple-tab-span" style="white-space:pre-wrap">                   </span>self get_data: handle ]</div></div><div><br></div><div>and</div><div><br></div><div><div>createUnlockSurfaceFn</div><div><span class="m_6347612284858692805gmail-m_6776915999791033109Apple-tab-span" style="white-space:pre-wrap">  </span>^ FFICallback </div><div><span class="m_6347612284858692805gmail-m_6776915999791033109Apple-tab-span" style="white-space:pre-wrap">         </span>signature: #(int (void *handle, int x, int y, int w, int h))</div><div><span class="m_6347612284858692805gmail-m_6776915999791033109Apple-tab-span" style="white-space:pre-wrap">            </span>block: [ :handle :x :y :w :h | 0 "Do nothing” ]</div></div><div><br></div><div>cheers!</div><div>Esteban</div></div></blockquote><div><br></div><div><br></div><div style="text-align:left">Just as an aside: I think in <span style="text-align:justify"><font color="#000000">lockSurface you might want to do a cairo_surface_flush before accessing the data. Otherwise Cairo might still be accessing the bits while they get moved around by the GC - not a good idea. And unlockSurface should use </font></span><font color="#000000">cairo_surface_mark_dirty_<wbr>rectangle.</font></div></div></div></div></blockquote><div><br></div><div>IMO this should be done at another level, i.e. in AthensSurface>>#asForm,<br></div><div>it makes sure to do flush before answering an instance of Form, that using cairo surface as its bits. </div><div>In other scenario(s), if user keeps drawing on surface, even after he used #asForm , then it should be his own responsibility to do a #flush at proper point. </div><div>I am not a fan of implicit behavior, because it is a source of confusion and extra code runs that can be avoided, when user knows how to do things right.</div><div>The rationale behind it, is that flushing rendering pipeline can take unknown amount of time, depending on scene complexity, current state of context etc, etc, </div><div>and if one wants , say a stable framerate, he should be able to manually control all the flush points, else he won't be able to do it.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div style="text-align:left"><font color="#000000"><br></font></div><div style="text-align:left"><font color="#000000">See RomePlugin>></font><span style="color:rgb(0,0,0);text-align:justify">showSurface:x:y:w:<wbr>h: and </span><span style="color:rgb(0,0,0);text-align:justify">unlockSurface:x:y:w:h: (</span><font color="#000000"><a href="http://www.squeaksource.com/Rome.html" target="_blank">http://www.squeaksource.com/<wbr>Rome.html</a>)</font></div><div style="text-align:left"><span style="color:rgb(0,0,0);text-align:justify"><br></span></div><div style="text-align:left"><font color="#000000">- Bert -</font></div></div></div></div>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Best regards,<br>Igor Stasenko.</div>
</div></div>