patch for moving the calculation of image colours to a background thread

Boudewijn Rempt boud at
Sat Sep 18 08:37:25 CEST 2010

On Saturday 18 September 2010, Dmitry Kazakov wrote:

> 3) Actually, i don't think it is absolutely important to update colors after
> every single stroke, is it? We can update them after, say, 2 seconds of
> inactivity. Every stroke made by user can reset the timer, so we will never
> irritate him with this. So, how will it look like:
> - you connect recalculation of colors to QTimer::timeout() (timeout is set
> to 2 sec)
> - connect (with auto connection) KisImage::sigImageUpdated(rc) to
> QTimer::start()
> then you have two options:
> a) on every timeout, you call KisImage::lock(); KisImage::convertToQImage();
> KisImage::unlock() and do your work in UI thread
> b) more complicated, but more efficient way: you store a QRegion of dirty
> rects and call convertToQImage() for them only.
> As for me, i like 3,b) option :)

yes, I concur. Though for a first implementation a) should be fine -- and much easier to implement. The problem, btw, is similar for the histogram docker which had to be disabled due to threading problems. For 2.4, we need to figure out a better way to update the rest of the system with projection updates. There are at least 3 consumers for that data

* histogram docker
* curent image colors 
* overview docker (also currently disabled)

Boudewijn Rempt |
Ceterum censeo lapsum particulorum probae delendum esse

More information about the kimageshop mailing list