Commit e52afad9 authored by Halla Rempt's avatar Halla Rempt

Revert "do not use QRegion, ever. We mean it."

This reverts commit 20f3a3201ca2c68819bb2cd7d7365485013d2685.
parent 24a9271a
......@@ -22,8 +22,6 @@
#include <QMutex>
#include <QMutexLocker>
#include <QReadWriteLock>
#include <QList>
#include <QRect>
#include <KoCompositeOp.h>
#include "kis_layer.h"
......@@ -41,7 +39,7 @@ struct KisIndirectPaintingSupport::Private {
QReadWriteLock lock;
QMutex dirtyRegionMutex;
QList<QRect> dirtyRegion;
QRegion dirtyRegion;
};
......@@ -58,7 +56,7 @@ KisIndirectPaintingSupport::~KisIndirectPaintingSupport()
void KisIndirectPaintingSupport::setTemporaryTarget(KisPaintDeviceSP t)
{
d->dirtyRegion.clear();
d->dirtyRegion = QRegion();
d->temporaryTarget = t;
}
......@@ -128,22 +126,11 @@ void KisIndirectPaintingSupport::setDirty(const QRect &rect)
void KisIndirectPaintingSupport::addIndirectlyDirtyRect(const QRect &rect)
{
QRect newRect = rect;
QList<QRect> rects;
QMutexLocker locker(&d->dirtyRegionMutex);
foreach(const QRect &rc, d->dirtyRegion) {
if (rc.intersects(newRect)) {
newRect = rc.intersected(newRect);
rects.append(newRect);
}
else {
rects.append(rc);
}
}
d->dirtyRegion = rects;
d->dirtyRegion += rect;
}
QList<QRect> KisIndirectPaintingSupport::indirectlyDirtyRegion()
QRegion KisIndirectPaintingSupport::indirectlyDirtyRegion()
{
QMutexLocker locker(&d->dirtyRegionMutex);
return d->dirtyRegion;
......@@ -182,8 +169,8 @@ void KisIndirectPaintingSupport::mergeToLayerImpl(KisLayerSP layer,
gc.beginTransaction(transactionText);
}
QList<QRect> dirtyRegion = indirectlyDirtyRegion();
foreach(const QRect& rc, dirtyRegion) {
QRegion dirtyRegion = indirectlyDirtyRegion();
foreach(const QRect& rc, dirtyRegion.rects()) {
gc.bitBlt(rc.topLeft(), d->temporaryTarget, rc);
}
d->temporaryTarget = 0;
......
......@@ -70,7 +70,7 @@ public:
/**
* Unlock the temporary target
*
*
* \see lockTemporaryTarget()
*/
void unlockTemporaryTarget() const;
......@@ -90,7 +90,7 @@ private:
* \see lockTemporaryTarget()
*/
void addIndirectlyDirtyRect(const QRect &rect);
QList<QRect> indirectlyDirtyRegion();
QRegion indirectlyDirtyRegion();
template<class UndoAdapter>
void mergeToLayerImpl(KisLayerSP layer,
......
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