Infinite canvas issues

Boudewijn Rempt boud at valdyas.org
Tue Jun 30 20:19:32 CEST 2009


On Tuesday 30 June 2009, LukasT.dev at gmail.com wrote:
> Hi,
>
> I implemented infinite canvas and now I need to fix related issues.
>
> The one I don't know much about is about "painting preview". Is it correct
> name for it? When you paint, you see what you paint and just small update
> rectangle is updated. You can watch my problem on video[1]. I tested the
> updating using kwin and its "Show paint" effect but the whole canvas is
> updated in Krita. 

That one is not accurate since it also shows the effects of Qt's internal 
repaints, and if you use effects, there are a lot of them. It's better to 
uncomment the line 

//#define DEBUG_REPAINT

in kis_qpainter_canvas.cpp, that will show accurately what we can control 
about repainting.

> Could you direct me to the code? It is in paintEvent of
> the QPainterCanvas? ev->rect? I tried that but without luck (I moved that
> rect but I did not see what i painted until i scrolled with wheel to
> generate event and have updated widget)
>

The relevant code is in KisQPainterCanvas::paintEvent, and if you look closely 
you can see the likely cause of the problem. From your video, the checkers are 
drawn at a different place from the lines. In the 
KisQPainterCanvas::paintEvent code, you can see that we always draw the 
checkers first and then the line (this is not totally optimal, but that is not 
the question now). 

Now, you can see that checkers are drawn using a translation that uses m_d-
>documentOffset, while the actual cached, prescaled projection is drawn 
directly. And I think that that's the problem: your document offset isn't 
correct here.

-- 
Boudewijn Rempt | http://www.valdyas.org


More information about the kimageshop mailing list