[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kimageshop
Subject: Re: Incremental painting in paint tools
From: Dmitry Kazakov <dimula73 () gmail ! com>
Date: 2009-06-25 10:14:15
Message-ID: ae32c1ef0906250314r5d32cdtaf68598a8981d741 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
>
> 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)
return;
if (!m_paintOnSelection) {
// SOME DATA BitBlt'ed into original layer here
currentNode()->setDirty(region);
} else {
/// skipped
///...
}
}
And second time, when painting is finished, in KisToolFreehand::endPaint()
...
painter.beginTransaction(m_transactionText);
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,
m_opacity,
it->x(), it->y(),
it->width(), it->height());
++it;
}
...
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
[Attachment #5 (text/html)]
<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px \
solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Thanks for \
help!<br>Now it's not so strange =)<br></blockquote></div> <br>Strange \
again..<br><br>It seems that KisFreehandTool writes into original layer _twice_ \
during non-incremental painting.<br>First, here:<br><br><font face="courier \
new,monospace">void KisToolFreehand::setDirty(const QRegion& region)<br> {<br> \
if (region.numRects() < 1)<br> return;<br><br> if \
(!m_paintOnSelection) {<br>// SOME DATA BitBlt'ed into original layer here<br> \
currentNode()->setDirty(region);<br> } else {<br> /// skipped<br> \
///...<br> }<br>}<br><br><span style="font-family: \
arial,helvetica,sans-serif;">And second time, when painting is finished, in \
KisToolFreehand::endPaint()<br>...<br> <span \
style="font-family: courier \
new,monospace;">painter.beginTransaction(m_transactionText);</span><br \
style="font-family: courier new,monospace;"> <br style="font-family: courier \
new,monospace;"><span style="font-family: courier new,monospace;"> QRegion \
r = m_incrementalDirtyRegion;</span><br style="font-family: courier \
new,monospace;"><span style="font-family: courier new,monospace;"> \
QVector<QRect> dirtyRects = r.rects();</span><br style="font-family: courier \
new,monospace;"> <span style="font-family: courier new,monospace;"> \
QVector<QRect>::iterator it = dirtyRects.begin();</span><br style="font-family: \
courier new,monospace;"><span style="font-family: courier new,monospace;"> \
QVector<QRect>::iterator end = dirtyRects.end();</span><br style="font-family: \
courier new,monospace;"> <br style="font-family: courier new,monospace;"><span \
style="font-family: courier new,monospace;"> while (it != end) {</span><br \
style="font-family: courier new,monospace;"><br style="font-family: courier \
new,monospace;"> <span style="font-family: courier new,monospace;"> \
painter.bitBlt(it->x(), it->y(), m_compositeOp, m_target,</span><br \
style="font-family: courier new,monospace;"><span style="font-family: courier \
new,monospace;"> \
m_opacity,</span><br style="font-family: courier new,monospace;"> <span \
style="font-family: courier new,monospace;"> \
it->x(), it->y(),</span><br style="font-family: courier new,monospace;"><span \
style="font-family: courier new,monospace;"> \
it->width(), it->height());</span><br style="font-family: courier \
new,monospace;"> <span style="font-family: courier new,monospace;"> \
++it;</span><br style="font-family: courier new,monospace;"><span style="font-family: \
courier new,monospace;"> }</span></span><br><font \
face="arial,helvetica,sans-serif">...<br> <br>Could you explain me what this code \
does? And why we write into original layer twice? <br><br>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...<br> \
</font><br></font><br clear="all"><br>-- <br>Dmitry Kazakov<br>
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic