[graphics/krita] libs/image/generator: Fill Layers: re-render the whole layer if the image bounds change

L. E. Segovia null at kde.org
Wed Aug 19 00:05:53 BST 2020


Git commit c3ce9a40d58d426188271b76a971c868153e28a9 by L. E. Segovia.
Committed on 18/08/2020 at 22:55.
Pushed by lsegovia into branch 'master'.

Fill Layers: re-render the whole layer if the image bounds change

Before this commit, if a Fill Layer was to be re-rendered as a
consequence of an image resize, it would improperly attempt to preserve
the existing rendered quadrant.

To fix this, the image bounds are saved after an update job is called.
If they change in the next update, the preparedRect is cleared and the
layer is completely re-rendered again.

CC: kimageshop at kde.org
(cherry picked from commit 3f3062e757177112645967a9955f5bcbb3eaba59)

M  +6    -0    libs/image/generator/kis_generator_layer.cpp

https://invent.kde.org/graphics/krita/commit/c3ce9a40d58d426188271b76a971c868153e28a9

diff --git a/libs/image/generator/kis_generator_layer.cpp b/libs/image/generator/kis_generator_layer.cpp
index fc34d9394e..2054165a1d 100644
--- a/libs/image/generator/kis_generator_layer.cpp
+++ b/libs/image/generator/kis_generator_layer.cpp
@@ -50,6 +50,7 @@ struct Q_DECL_HIDDEN KisGeneratorLayer::Private
 
     KisThreadSafeSignalCompressor updateSignalCompressor;
     QRect preparedRect;
+    QRect preparedImageBounds;
     KisFilterConfigurationSP preparedForFilter;
     QWeakPointer<bool> updateCookie;
     QMutex mutex;
@@ -125,6 +126,10 @@ void KisGeneratorLayer::requestUpdateJobsWithStroke(KisStrokeId strokeId, KisFil
         locker.relock();
     }
 
+    if (m_d->preparedImageBounds != image->bounds()) {
+        m_d->preparedRect = QRect();
+    }
+
     const QRegion processRegion(QRegion(updateRect) - m_d->preparedRect);
     if (processRegion.isEmpty())
         return;
@@ -146,6 +151,7 @@ void KisGeneratorLayer::requestUpdateJobsWithStroke(KisStrokeId strokeId, KisFil
 
     m_d->updateCookie = cookie;
     m_d->preparedRect = updateRect;
+    m_d->preparedImageBounds = image->bounds();
     m_d->preparedForFilter = filterConfig;
 }
 


More information about the kimageshop mailing list