Krita's rendering model

Boudewijn Rempt boud at valdyas.org
Thu Sep 15 14:11:36 CEST 2005


I'm working on the bird's eyeview widget for KOffice and I think that I've 
found a place where our rendering system is not really handy. What happens 
now is:

Tool changes Image -> 
Image emits a signal -> 
signal is caught by all views -> 
each view asks the document that owns the image to render the changed rect of 
the image -> 
image loops over all visibile layers, composites them, creates a QImage, 
converts the composited layer to a QImage and paints
the QImage onto a QPainter object owned by the view. 

So if there are two views, or three views, we composite two or three times.

I see two possible optimiations that will also make it easier for thumbnails 
to keep current:

1. 

Tool changes Image ->
Image composites dirty rect ->
Image creates QImage from the dirty rect ->
Image emits a signal with the QImage as a parameter and the dirty rect
Clients connected to this signal take the QImage and paint it onto their 
canvas

Problem: the KisDoc::paintContent takes a QPainter. We must have a way to make 
sure KisDoc can do that without calling the render method of QImage. So, 
perhaps better:

2.

Tool changes image ->
Image composites dirty rect ->
Image creates QImage from the composited projection ->
Image blits QImage onto a cached QImage that represents the entire composited 
Image emits a signal with the dirty rect as parameter
Clients (like KisView) connected to the signal call KisDoc::paintContent
KisDoc blits the rect from the cached QImage onto the painter

Problem: this cached QImage can become pretty big, of course, and that would 
take an unpleasant amount of memory.

Advantage: only one composite operation for every dirtying of a layer, an easy 
and quick toQImage method for KisImage, and we're still easily compatible 
with the rest of KOffice.


-- 
Boudewijn Rempt 
http://www.valdyas.org/fading/index.cgi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kimageshop/attachments/20050915/714def2e/attachment.pgp


More information about the kimageshop mailing list