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