Incremental painting in paint tools

Dmitry Kazakov dimula73 at
Thu Jun 25 12:14:15 CEST 2009

> Thanks for help!
> Now it's not so strange =)

Strange again..

It seems that KisFreehandTool writes into original layer _twice_ during
non-incremental painting.
First, here:

void KisToolFreehand::setDirty(const QRegion& region)
    if (region.numRects() < 1)

    if (!m_paintOnSelection) {
// SOME DATA BitBlt'ed into original layer here
    } else {
      /// skipped

And second time, when painting is finished, in KisToolFreehand::endPaint()

      QRegion r = m_incrementalDirtyRegion;
      QVector<QRect> dirtyRects = r.rects();
      QVector<QRect>::iterator it = dirtyRects.begin();
      QVector<QRect>::iterator end = dirtyRects.end();

      while (it != end) {

          painter.bitBlt(it->x(), it->y(), m_compositeOp, m_target,
                               it->x(), it->y(),
                               it->width(), it->height());

Could you explain me what this code does? And why we write into original
layer twice?

I get some strange stuff because of that, as first write access is done
without any mementoing at all. I mean no transaction opened during this
write! And this is quite strange for me...

Dmitry Kazakov
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the kimageshop mailing list