[graphics/krita/krita/4.3] 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:04:39 BST 2020


Git commit 3f3062e757177112645967a9955f5bcbb3eaba59 by L. E. Segovia.
Committed on 18/08/2020 at 22:54.
Pushed by lsegovia into branch 'krita/4.3'.

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

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

https://invent.kde.org/graphics/krita/commit/3f3062e757177112645967a9955f5bcbb3eaba59

diff --git a/libs/image/generator/kis_generator_layer.cpp b/libs/image/generator/kis_generator_layer.cpp
index a79a0006a4..f2be79e69e 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