<!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:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">&gt; &gt; Could you direct me to the code? It is in paintEvent of<br>
&gt; &gt; the QPainterCanvas? ev-&gt;rect? I tried that but without luck (I moved that<br>
&gt; &gt; rect but I did not see what i painted until i scrolled with wheel to<br>
&gt; &gt; generate event and have updated widget)<br>
&gt;<br>
&gt; The relevant code is in KisQPainterCanvas::paintEvent, and if you look<br>
&gt; closely you can see the likely cause of the problem. From your video, the<br>
&gt; checkers are drawn at a different place from the lines. In the<br>
&gt; KisQPainterCanvas::paintEvent code, you can see that we always draw the<br>
&gt; checkers first and then the line (this is not totally optimal, but that is<br>
&gt; not the question now).<br>
&gt;<br>
&gt; Now, you can see that checkers are drawn using a translation that uses m_d-<br>
&gt;<br>
&gt; &gt;documentOffset, while the actual cached, prescaled projection is drawn<br>
&gt;<br>
&gt; directly. And I think that that's the problem: your document offset isn't<br>
&gt; correct here.<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>Hi,<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 was exploring the issues today I made a new video with debug_paint uncommented [2].<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 was asking on IRC about "paint preview" (named it direct paint or something). What is wrong now is that there is some rectangle that is constantly updated as you paint and it allows you to see what are you painting. This rectangle has to be translated by documentOffset (i think) and by new documentOrigin (m_d-&gt;origin) which I added when implementing infinite canvas according Karbon canvas. <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>In KisQPainterCanvas::paintEvent<br>
I tried to create new variable by move the m_d-&gt;documentOffset by origin and use it in places instead of m_d-&gt;documentOffset. <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 tried to use copy of the ev-&gt;rect() and translate that by origin. Both did not help.<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>There are methods <br>
KisCanvas2::updateCanvasProjection(const QRect &amp; rc)<br>
KisCanvas2::updateCanvas(const QRectF&amp; rc)<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>there is not documentation for them but you can read in implementation that they are called by tools so I expect that they update the part of the widget specified by rc. I tried to translate the rc by origin.Did not help too.<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>You can check my updated patch [2]. <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>Cyrille suggested to look at kis_layer_* but I think it is too far from canvas :) ? <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><span style=" font-size:medium; font-weight:600; color:#204a87;">LukasT: </span><span style=" font-size:medium;">CyrilleB: do you know where is direct paint handled in canvas? </span><br /><span style=" font-size:medium; font-weight:600; color:#204a87;">LukasT: </span><span style=" font-size:medium;">CyrilleB: could it be decoration and is it tool specific?</span><br /><span style=" font-size:medium; font-weight:600; color:#af7f00;">CyrilleB: </span><span style=" font-size:medium;">LukasT: it's done as a special layer in kis_layer_*</span><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 meant paint preview as direct paint is something different..)<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>[1] http://lukast.mediablog.sk/videos/krita2-canvas_debug.ogv<br>
[2] http://lukast.mediablog.sk/patches/qpainter_infinite_canvas.1.patch<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></body></html>