[calligra] krita/image: Revert "Let dirty rect to be a QRegion instead of a QRect"
Dmitry Kazakov
dimula73 at gmail.com
Wed Jun 8 20:43:34 CEST 2011
I think it would be quite good idea to make a rule to add the author of
reverted patch to CC at least. I might have been unavailable on irc, but I
still have to know about such reverts. I knew about it quite accidentally.
The commit might slow down painting with very small brushes, but it
optimizes big brushes. The revert makes just the opposite. So i would try to
make some benchmarking before doing anything with this code.
On Wed, Jun 1, 2011 at 7:41 PM, Boudewijn Rempt <boud at valdyas.org> wrote:
> Git commit 1a847037f48ce47d221c5abb351fd2d918d66dee by Boudewijn Rempt.
> Committed on 30/05/2011 at 16:08.
> Pushed by rempt into branch 'master'.
>
> Revert "Let dirty rect to be a QRegion instead of a QRect"
>
> This reverts commit a56c0ab64ca1290b034e863439319d38daddefab.
>
> This commit caused a visible performance degradation according to
> research done by Cyrille..
>
> M +25 -5 krita/image/kis_painter.cc
>
> http://commits.kde.org/calligra/1a847037f48ce47d221c5abb351fd2d918d66dee
>
> diff --git a/krita/image/kis_painter.cc b/krita/image/kis_painter.cc
> index 652f66e..3328aff 100644
> --- a/krita/image/kis_painter.cc
> +++ b/krita/image/kis_painter.cc
> @@ -79,6 +79,7 @@ struct KisPainter::Private {
> KoUpdater* progressUpdater;
>
> QRegion dirtyRegion;
> + QRect dirtyRect;
> KisPaintOp* paintOp;
> QRect bounds;
> KoColor paintColor;
> @@ -97,6 +98,7 @@ struct KisPainter::Private {
> KoColorProfile* profile;
> const KoCompositeOp* compositeOp;
> QBitArray channelFlags;
> + bool useBoundingDirtyRect;
> const KoAbstractGradient* gradient;
> KisPaintOpPresetSP paintOpPreset;
> QImage polygonMaskImage;
> @@ -153,6 +155,9 @@ void KisPainter::init()
> d->maskImageHeight = 255;
> d->mirrorHorizontaly = false;
> d->mirrorVerticaly = false;
> +
> + KConfigGroup cfg = KGlobal::config()->group("");
> + d->useBoundingDirtyRect = cfg.readEntry("aggregate_dirty_regions",
> true);
> }
>
> KisPainter::~KisPainter()
> @@ -243,9 +248,16 @@ KisTransaction* KisPainter::takeTransaction()
>
> QRegion KisPainter::takeDirtyRegion()
> {
> - QRegion r = d->dirtyRegion;
> - d->dirtyRegion = QRegion();
> - return r;
> + if (d->useBoundingDirtyRect) {
> + QRegion r(d->dirtyRect);
> + d->dirtyRegion = QRegion();
> + d->dirtyRect = QRect();
> + return r;
> + } else {
> + QRegion r = d->dirtyRegion;
> + d->dirtyRegion = QRegion();
> + return r;
> + }
> }
>
>
> @@ -257,11 +269,19 @@ QRegion KisPainter::addDirtyRect(const QRect & rc)
> return d->dirtyRegion;
> }
>
> - d->dirtyRegion += r;
> - return d->dirtyRegion;
> + if (d->useBoundingDirtyRect) {
> + d->dirtyRect = d->dirtyRect.united(r);
> + return QRegion(d->dirtyRect);
> + } else {
> + d->dirtyRegion += QRegion(r);
> + return d->dirtyRegion;
> + }
> }
>
>
> +
> +
> +
> void KisPainter::bitBltWithFixedSelection(qint32 dstX, qint32 dstY,
> const KisPaintDeviceSP srcDev,
> const KisFixedPaintDeviceSP
> selection,
>
>
--
Dmitry Kazakov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kimageshop/attachments/20110608/3f6bc05b/attachment.htm
More information about the kimageshop
mailing list