KisPainter::paintPolygon used in paintops

LukasT.dev@gmail.com lukast.dev at gmail.com
Fri Mar 13 11:49:32 CET 2009


Hi,

I'm using paintPolygon in dynabrush and in spray. 
For paintops it has one disadvantage. It is really slow.
I made callgrind log [1] where I use it in modified spray [2].

To speed it up about of 4%, line 728 in kis_painter:
KisPaintDeviceSP polygon = new KisPaintDevice(d->device->colorSpace(), 
"polygon");
Why is string used? When I call paintPolygon in paintop, it is called e.g. 600 
times in a stroke. Creating QString is quit slow. Is that string really 
needed? What is its purpose? Could we use e.g. int for id, if it is id?

That method create a lot of objects like KisSelection,QImage, QPainter, QColor

What would be the solution for paintops? 
Made own class for paintPolygon? Or optimalize paintPolygon somehow in 
KisPainter (I don't have idea how to cache created objects in KisPainter :( )?

I use paintPolygon for painting shapes like filled aliased circle, 
polygon,etc..

Ideas?

[1] http://lukast.mediablog.sk/tmp/callgrind-filling-painter.zip
[2] http://lukast.mediablog.sk/tmp/play-spray.patch


More information about the kimageshop mailing list