Commit 155f7392 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove the entire bookkeeping of the dirty rect for the temp layer

When indirect painting, we don't care which part of the temp paint device
is actually painted on; when the time comes to merge it, KisPaintDevice
can tell us.

Idea by Dmitry, inspired by me :-)
parent 06c89792
......@@ -37,8 +37,6 @@ struct KisIndirectPaintingSupport::Private {
quint8 compositeOpacity;
QBitArray channelFlags;
QReadWriteLock lock;
QMutex dirtyRegionMutex;
QRect dirtyRegion;
};
......@@ -55,7 +53,6 @@ KisIndirectPaintingSupport::~KisIndirectPaintingSupport()
void KisIndirectPaintingSupport::setTemporaryTarget(KisPaintDeviceSP t)
{
d->dirtyRegion = QRect();
d->temporaryTarget = t;
}
......@@ -114,17 +111,6 @@ bool KisIndirectPaintingSupport::hasTemporaryTarget() const
return d->temporaryTarget;
}
void KisIndirectPaintingSupport::setDirty(const QRect &rect)
{
lockTemporaryTarget();
if (hasTemporaryTarget()) {
QMutexLocker locker(&d->dirtyRegionMutex);
d->dirtyRegion |= rect;
}
unlockTemporaryTarget();
}
void KisIndirectPaintingSupport::mergeToLayer(KisLayerSP layer, KisUndoAdapter *undoAdapter, const QString &transactionText)
{
mergeToLayerImpl(layer, undoAdapter, transactionText);
......@@ -157,9 +143,8 @@ void KisIndirectPaintingSupport::mergeToLayerImpl(KisLayerSP layer,
if(undoAdapter) {
gc.beginTransaction(transactionText);
}
{
QMutexLocker locker(&d->dirtyRegionMutex);
gc.bitBlt(d->dirtyRegion.topLeft(), d->temporaryTarget, d->dirtyRegion);
foreach (const QRect &rc, d->temporaryTarget->region().rects()) {
gc.bitBlt(rc.topLeft(), d->temporaryTarget, rc);
}
d->temporaryTarget = 0;
......
......@@ -50,8 +50,6 @@ public:
void setTemporaryOpacity(quint8 o);
void setTemporaryChannelFlags(const QBitArray& channelFlags);
void setDirty(const QRect &rect);
/**
* Writes the temporary target into the paint device of the layer.
* This action will lock the temporary target itself.
......
......@@ -135,7 +135,6 @@ void KisPaintLayer::copyOriginalToProjection(const KisPaintDeviceSP original,
void KisPaintLayer::setDirty(const QRect & rect)
{
KisIndirectPaintingSupport::setDirty(rect);
KisLayer::setDirty(rect);
}
......
......@@ -233,7 +233,6 @@ void KisSelectionBasedLayer::setY(qint32 y)
void KisSelectionBasedLayer::setDirty(const QRect & rect)
{
KisIndirectPaintingSupport::setDirty(rect);
KisLayer::setDirty(rect);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment