Animation paintop, bad performance

Cyrille Berger Skott cberger at cberger.net
Sun Oct 10 10:25:27 CEST 2010


Hey,

Intead of

     if (!m_isFirst){
         erasedRc = rc = m_previousDab;
        KisRectConstIteratorPixel srcIt = m_currentLayerDevice-
>createRectConstIterator(rc.left(), rc.top(), rc.width(), rc.height());
        KisRectIteratorPixel dstIt = m_currentLayerDevice-
>createRectIterator(rc.left(), rc.top(), rc.width(), rc.height());
 
        qint32 pixelSize = m_currentLayerDevice->pixelSize();
         for (;!srcIt.isDone(); ++srcIt, ++dstIt) {
             memcpy(dstIt.rawData(),srcIt.oldRawData(), pixelSize );
         }
     }
 
use the COMPOSITE_COPY composite op.

Reason #1 Avoid duplicating existing functionnality :) Especially since there 
might be optimization
Reason #2 In your case, there will be a limited amount of memcpy, and memory 
usuage, as tiles will be shared between src and dst

And in any case, avoid using deprecated iterators in new code.

-- 
Cyrille Berger Skott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kimageshop/attachments/20101010/5cbcac26/attachment.htm 


More information about the kimageshop mailing list