<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">On Saturday 22 August 2009, Dmitry Kazakov wrote:<br>
&gt; Hi all!<br>
&gt;<br>
&gt; I'm revising our merging strategy  at the moment. We have big problems<br>
&gt; with  it. I  want it  to take  into account  need rects  of adjustment<br>
&gt; layers.<br>
&gt;<br>
&gt; At  the   moment  i  have   problems  with  KisFilter::changedRect(rc)<br>
&gt; rect. Could someone  describe me what it is? Is  there any usecase for<br>
&gt; that?<br>
Lets take the example of a translation filter, with a 1px distance.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>When you filter (x,y), you need pixel (x-1,y-1) to compute the value of (x,y).<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Now lets assume, the pixel (x,y) was changed while drawing, the question is to know which pixel of the output needs to be changed, in this case (x+1,y+1)<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>So for that filter KisFilter::changedRect(rc) return rc.translated(1,1); While KisFilter::neededRect(rc) return rc.translated(-1,-1);<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>&gt; Actually,  i understand  that this  is  a rect  that adjustment  layer<br>
&gt; changed after applying on @rc  rect. But(!) how should update strategy<br>
&gt; treat this rect?  There are two possibilities:<br>
&gt;<br>
&gt; 1) Update  strategy should update  this _expanded_ rect on  all higher<br>
&gt; layers<br>
&gt;<br>
&gt; 2) Update strategy should NOT  pay any attention to this expanded rect<br>
&gt; and all higher layers should update requested rect only.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Lets take an example, here is the layer stack:<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>3) toplayerwithdrawing<br>
2) filter layer, with a translation of ( x = 20px, y= 10px)<br>
1) bottomlayerwithdrawing<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Lets assume we are drawing on "layer 1", we dit a change on rect r1=(x=12,y=15,w,h).<br>
This means, that for "layer 2", the rectangle that was changed is in reality "r2=(x=32,y=25,w,h)". And that you need to recompose that rectangle r2 with the content of "layer 3", while currently we always recompose r1.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>I am not really sure where the problem needs to be solved, but I would look at setDirty, and when it goes up in the layer stack, it should probably called a function of KisNode (that doesn't exist) but that would return the changedRect in case of a filter, and the normal rect in other cased.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>-- <br>
Cyrille Berger</p></body></html>