[calligra/krita-animation-kf5-kazakov] krita: Fix Layer Styles to support updates in LoD mode

Dmitry Kazakov dimula73 at gmail.com
Thu Sep 17 07:49:42 UTC 2015


Git commit 0f15566e6f6f1d081ae6fd93a3a03cde8d95b97c by Dmitry Kazakov.
Committed on 17/09/2015 at 07:22.
Pushed by dkazakov into branch 'krita-animation-kf5-kazakov'.

Fix Layer Styles to support updates in LoD mode

Node you can paint under a Layer Styled layer amazingly fast!

CC:kimageshop at kde.org

M  +2    -2    krita/image/layerstyles/kis_layer_style_filter.h
M  +6    -0    krita/image/layerstyles/kis_layer_style_filter_environment.cpp
M  +1    -0    krita/image/layerstyles/kis_layer_style_filter_environment.h
M  +2    -2    krita/image/layerstyles/kis_layer_style_filter_projection_plane.cpp
M  +18   -7    krita/image/layerstyles/kis_ls_bevel_emboss_filter.cpp
M  +2    -2    krita/image/layerstyles/kis_ls_bevel_emboss_filter.h
M  +10   -5    krita/image/layerstyles/kis_ls_drop_shadow_filter.cpp
M  +2    -2    krita/image/layerstyles/kis_ls_drop_shadow_filter.h
M  +4    -2    krita/image/layerstyles/kis_ls_overlay_filter.cpp
M  +2    -2    krita/image/layerstyles/kis_ls_overlay_filter.h
M  +9    -6    krita/image/layerstyles/kis_ls_satin_filter.cpp
M  +2    -2    krita/image/layerstyles/kis_ls_satin_filter.h
M  +10   -4    krita/image/layerstyles/kis_ls_stroke_filter.cpp
M  +2    -2    krita/image/layerstyles/kis_ls_stroke_filter.h
M  +27   -0    krita/image/layerstyles/kis_ls_utils.h
M  +5    -2    krita/image/tests/kis_layer_styles_test.cpp
M  +15   -0    krita/libpsd/psd.h

http://commits.kde.org/calligra/0f15566e6f6f1d081ae6fd93a3a03cde8d95b97c

diff --git a/krita/image/layerstyles/kis_layer_style_filter.h b/krita/image/layerstyles/kis_layer_style_filter.h
index 194b0b1..6f093c5 100644
--- a/krita/image/layerstyles/kis_layer_style_filter.h
+++ b/krita/image/layerstyles/kis_layer_style_filter.h
@@ -50,7 +50,7 @@ public:
      * Some filters need pixels outside the current processing rect to compute the new
      * value (for instance, convolution filters)
      */
-    virtual QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const = 0;
+    virtual QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const = 0;
 
     /**
      * Similar to \ref neededRect: some filters will alter a lot of pixels that are
@@ -58,7 +58,7 @@ public:
      * in a device, the actual rectangle that will feel the influence of this change
      * might be bigger. Use this function to determine that rect.
      */
-    virtual QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const = 0;
+    virtual QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const = 0;
 
 private:
     struct Private;
diff --git a/krita/image/layerstyles/kis_layer_style_filter_environment.cpp b/krita/image/layerstyles/kis_layer_style_filter_environment.cpp
index 01d8be6..2fb6702 100644
--- a/krita/image/layerstyles/kis_layer_style_filter_environment.cpp
+++ b/krita/image/layerstyles/kis_layer_style_filter_environment.cpp
@@ -98,6 +98,12 @@ QRect KisLayerStyleFilterEnvironment::defaultBounds() const
         m_d->sourceLayer->original()->defaultBounds()->bounds() : QRect();
 }
 
+int KisLayerStyleFilterEnvironment::currentLevelOfDetail() const
+{
+    return m_d->sourceLayer ?
+        m_d->sourceLayer->original()->defaultBounds()->currentLevelOfDetail() : 0;
+}
+
 QPainterPath KisLayerStyleFilterEnvironment::layerOutlineCache() const
 {
     // TODO: make it really cachable!
diff --git a/krita/image/layerstyles/kis_layer_style_filter_environment.h b/krita/image/layerstyles/kis_layer_style_filter_environment.h
index a190a9f..940f1ec 100644
--- a/krita/image/layerstyles/kis_layer_style_filter_environment.h
+++ b/krita/image/layerstyles/kis_layer_style_filter_environment.h
@@ -39,6 +39,7 @@ public:
 
     QRect layerBounds() const;
     QRect defaultBounds() const;
+    int currentLevelOfDetail() const;
 
     QPainterPath layerOutlineCache() const;
 
diff --git a/krita/image/layerstyles/kis_layer_style_filter_projection_plane.cpp b/krita/image/layerstyles/kis_layer_style_filter_projection_plane.cpp
index ee9a3da..64a1f86 100644
--- a/krita/image/layerstyles/kis_layer_style_filter_projection_plane.cpp
+++ b/krita/image/layerstyles/kis_layer_style_filter_projection_plane.cpp
@@ -89,7 +89,7 @@ QRect KisLayerStyleFilterProjectionPlane::needRect(const QRect &rect, KisLayer::
     }
 
     KIS_ASSERT_RECOVER_NOOP(pos == KisLayer::N_ABOVE_FILTHY);
-    return m_d->filter->neededRect(rect, m_d->style);
+    return m_d->filter->neededRect(rect, m_d->style, m_d->environment.data());
 }
 
 QRect KisLayerStyleFilterProjectionPlane::changeRect(const QRect &rect, KisLayer::PositionToFilthy pos) const
@@ -100,7 +100,7 @@ QRect KisLayerStyleFilterProjectionPlane::changeRect(const QRect &rect, KisLayer
     }
 
     KIS_ASSERT_RECOVER_NOOP(pos == KisLayer::N_ABOVE_FILTHY);
-    return m_d->filter->changedRect(rect, m_d->style);
+    return m_d->filter->changedRect(rect, m_d->style, m_d->environment.data());
 }
 
 QRect KisLayerStyleFilterProjectionPlane::accessRect(const QRect &rect, KisLayer::PositionToFilthy pos) const
diff --git a/krita/image/layerstyles/kis_ls_bevel_emboss_filter.cpp b/krita/image/layerstyles/kis_ls_bevel_emboss_filter.cpp
index d05dede..e097ddb 100644
--- a/krita/image/layerstyles/kis_ls_bevel_emboss_filter.cpp
+++ b/krita/image/layerstyles/kis_ls_bevel_emboss_filter.cpp
@@ -462,17 +462,28 @@ void KisLsBevelEmbossFilter::processDirectly(KisPaintDeviceSP src,
     const psd_layer_effects_bevel_emboss *config = style->bevelAndEmboss();
     if (!config->effectEnabled()) return;
 
-    applyBevelEmboss(src, dst, applyRect, config, env);
+    KisLsUtils::LodWrapper<psd_layer_effects_bevel_emboss> w(env->currentLevelOfDetail(), config);
+    applyBevelEmboss(src, dst, applyRect, w.config, env);
 }
 
-QRect KisLsBevelEmbossFilter::neededRect(const QRect &rect, KisPSDLayerStyleSP style) const
+QRect KisLsBevelEmbossFilter::neededRect(const QRect &rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const
 {
-    BevelEmbossRectCalculator d(rect, style->bevelAndEmboss());
-    return d.totalNeedRect(rect, style->bevelAndEmboss());
+    const psd_layer_effects_bevel_emboss *config = style->bevelAndEmboss();
+    if (!config->effectEnabled()) return rect;
+
+    KisLsUtils::LodWrapper<psd_layer_effects_bevel_emboss> w(env->currentLevelOfDetail(), config);
+
+    BevelEmbossRectCalculator d(rect, w.config);
+    return d.totalNeedRect(rect, w.config);
 }
 
-QRect KisLsBevelEmbossFilter::changedRect(const QRect &rect, KisPSDLayerStyleSP style) const
+QRect KisLsBevelEmbossFilter::changedRect(const QRect &rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const
 {
-    BevelEmbossRectCalculator d(rect, style->bevelAndEmboss());
-    return d.totalChangeRect(rect, style->bevelAndEmboss());
+    const psd_layer_effects_bevel_emboss *config = style->bevelAndEmboss();
+    if (!config->effectEnabled()) return rect;
+
+    KisLsUtils::LodWrapper<psd_layer_effects_bevel_emboss> w(env->currentLevelOfDetail(), config);
+
+    BevelEmbossRectCalculator d(rect, w.config);
+    return d.totalChangeRect(rect, w.config);
 }
diff --git a/krita/image/layerstyles/kis_ls_bevel_emboss_filter.h b/krita/image/layerstyles/kis_ls_bevel_emboss_filter.h
index ffbf36e..e29403b 100644
--- a/krita/image/layerstyles/kis_ls_bevel_emboss_filter.h
+++ b/krita/image/layerstyles/kis_ls_bevel_emboss_filter.h
@@ -39,8 +39,8 @@ public:
                          KisPSDLayerStyleSP style,
                          KisLayerStyleFilterEnvironment *env) const;
 
-    QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const;
-    QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const;
+    QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
+    QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
 
 private:
     void applyBevelEmboss(KisPaintDeviceSP srcDevice,
diff --git a/krita/image/layerstyles/kis_ls_drop_shadow_filter.cpp b/krita/image/layerstyles/kis_ls_drop_shadow_filter.cpp
index 09d2bb9..772a57d 100644
--- a/krita/image/layerstyles/kis_ls_drop_shadow_filter.cpp
+++ b/krita/image/layerstyles/kis_ls_drop_shadow_filter.cpp
@@ -39,6 +39,8 @@
 #include "kis_psd_layer_style.h"
 
 #include "kis_ls_utils.h"
+#include "kis_layer_style_filter_environment.h"
+
 
 
 KisLsDropShadowFilter::KisLsDropShadowFilter(Mode mode)
@@ -254,24 +256,27 @@ void KisLsDropShadowFilter::processDirectly(KisPaintDeviceSP src,
     const psd_layer_effects_shadow_base *shadowStruct = getShadowStruct(style);
     if (!shadowStruct->effectEnabled()) return;
 
-    applyDropShadow(src, dst, applyRect, style->context(), shadowStruct, env);
+    KisLsUtils::LodWrapper<psd_layer_effects_shadow_base> w(env->currentLevelOfDetail(), shadowStruct);
+    applyDropShadow(src, dst, applyRect, style->context(), w.config, env);
 }
 
-QRect KisLsDropShadowFilter::neededRect(const QRect &rect, KisPSDLayerStyleSP style) const
+QRect KisLsDropShadowFilter::neededRect(const QRect &rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const
 {
     const psd_layer_effects_shadow_base *shadowStruct = getShadowStruct(style);
     if (!shadowStruct->effectEnabled()) return rect;
 
-    ShadowRectsData d(rect, style->context(), shadowStruct, ShadowRectsData::NEED_RECT);
+    KisLsUtils::LodWrapper<psd_layer_effects_shadow_base> w(env->currentLevelOfDetail(), shadowStruct);
+    ShadowRectsData d(rect, style->context(), w.config, ShadowRectsData::NEED_RECT);
     return rect | d.finalNeedRect();
 }
 
-QRect KisLsDropShadowFilter::changedRect(const QRect &rect, KisPSDLayerStyleSP style) const
+QRect KisLsDropShadowFilter::changedRect(const QRect &rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const
 {
     const psd_layer_effects_shadow_base *shadowStruct = getShadowStruct(style);
     if (!shadowStruct->effectEnabled()) return rect;
 
-    ShadowRectsData d(rect, style->context(), shadowStruct, ShadowRectsData::CHANGE_RECT);
+    KisLsUtils::LodWrapper<psd_layer_effects_shadow_base> w(env->currentLevelOfDetail(), shadowStruct);
+    ShadowRectsData d(rect, style->context(), w.config, ShadowRectsData::CHANGE_RECT);
     return style->context()->keep_original ?
         d.finalChangeRect() : rect | d.finalChangeRect();
 }
diff --git a/krita/image/layerstyles/kis_ls_drop_shadow_filter.h b/krita/image/layerstyles/kis_ls_drop_shadow_filter.h
index b51f2db..000f399 100644
--- a/krita/image/layerstyles/kis_ls_drop_shadow_filter.h
+++ b/krita/image/layerstyles/kis_ls_drop_shadow_filter.h
@@ -46,8 +46,8 @@ public:
                          KisPSDLayerStyleSP style,
                          KisLayerStyleFilterEnvironment *env) const;
 
-    QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const;
-    QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const;
+    QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
+    QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
 
 private:
     const psd_layer_effects_shadow_base* getShadowStruct(KisPSDLayerStyleSP style) const;
diff --git a/krita/image/layerstyles/kis_ls_overlay_filter.cpp b/krita/image/layerstyles/kis_ls_overlay_filter.cpp
index c72fe9e..fe34080 100644
--- a/krita/image/layerstyles/kis_ls_overlay_filter.cpp
+++ b/krita/image/layerstyles/kis_ls_overlay_filter.cpp
@@ -126,14 +126,16 @@ void KisLsOverlayFilter::processDirectly(KisPaintDeviceSP src,
     applyOverlay(src, dst, applyRect, config, env);
 }
 
-QRect KisLsOverlayFilter::neededRect(const QRect &rect, KisPSDLayerStyleSP style) const
+QRect KisLsOverlayFilter::neededRect(const QRect &rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const
 {
     Q_UNUSED(style);
+    Q_UNUSED(env);
     return rect;
 }
 
-QRect KisLsOverlayFilter::changedRect(const QRect &rect, KisPSDLayerStyleSP style) const
+QRect KisLsOverlayFilter::changedRect(const QRect &rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const
 {
     Q_UNUSED(style);
+    Q_UNUSED(env);
     return rect;
 }
diff --git a/krita/image/layerstyles/kis_ls_overlay_filter.h b/krita/image/layerstyles/kis_ls_overlay_filter.h
index 81eb52c..ed4f17f 100644
--- a/krita/image/layerstyles/kis_ls_overlay_filter.h
+++ b/krita/image/layerstyles/kis_ls_overlay_filter.h
@@ -46,8 +46,8 @@ public:
                          KisPSDLayerStyleSP style,
                          KisLayerStyleFilterEnvironment *env) const;
 
-    QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const;
-    QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const;
+    QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
+    QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
 
 private:
     const psd_layer_effects_overlay_base* getOverlayStruct(KisPSDLayerStyleSP style) const;
diff --git a/krita/image/layerstyles/kis_ls_satin_filter.cpp b/krita/image/layerstyles/kis_ls_satin_filter.cpp
index 7fc1139..8f67694 100644
--- a/krita/image/layerstyles/kis_ls_satin_filter.cpp
+++ b/krita/image/layerstyles/kis_ls_satin_filter.cpp
@@ -38,7 +38,7 @@
 #include "kis_psd_layer_style.h"
 
 #include "kis_ls_utils.h"
-
+#include "kis_layer_style_filter_environment.h"
 
 
 KisLsSatinFilter::KisLsSatinFilter()
@@ -204,24 +204,27 @@ void KisLsSatinFilter::processDirectly(KisPaintDeviceSP src,
     const psd_layer_effects_satin *config = style->satin();
     if (!config->effectEnabled()) return;
 
-    applySatin(src, dst, applyRect, style->context(), config, env);
+    KisLsUtils::LodWrapper<psd_layer_effects_satin> w(env->currentLevelOfDetail(), config);
+    applySatin(src, dst, applyRect, style->context(), w.config, env);
 }
 
-QRect KisLsSatinFilter::neededRect(const QRect &rect, KisPSDLayerStyleSP style) const
+QRect KisLsSatinFilter::neededRect(const QRect &rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const
 {
     const psd_layer_effects_satin *config = style->satin();
     if (!config->effectEnabled()) return rect;
 
-    SatinRectsData d(rect, style->context(), config, SatinRectsData::NEED_RECT);
+    KisLsUtils::LodWrapper<psd_layer_effects_satin> w(env->currentLevelOfDetail(), config);
+    SatinRectsData d(rect, style->context(), w.config, SatinRectsData::NEED_RECT);
     return rect | d.finalNeedRect();
 }
 
-QRect KisLsSatinFilter::changedRect(const QRect &rect, KisPSDLayerStyleSP style) const
+QRect KisLsSatinFilter::changedRect(const QRect &rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const
 {
     const psd_layer_effects_satin *config = style->satin();
     if (!config->effectEnabled()) return rect;
 
-    SatinRectsData d(rect, style->context(), config, SatinRectsData::CHANGE_RECT);
+    KisLsUtils::LodWrapper<psd_layer_effects_satin> w(env->currentLevelOfDetail(), config);
+    SatinRectsData d(rect, style->context(), w.config, SatinRectsData::CHANGE_RECT);
     return style->context()->keep_original ?
         d.finalChangeRect() : rect | d.finalChangeRect();
 }
diff --git a/krita/image/layerstyles/kis_ls_satin_filter.h b/krita/image/layerstyles/kis_ls_satin_filter.h
index a4ece61..f0d30c5 100644
--- a/krita/image/layerstyles/kis_ls_satin_filter.h
+++ b/krita/image/layerstyles/kis_ls_satin_filter.h
@@ -38,8 +38,8 @@ public:
                          KisPSDLayerStyleSP style,
                          KisLayerStyleFilterEnvironment *env) const;
 
-    QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const;
-    QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const;
+    QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
+    QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
 };
 
 #endif
diff --git a/krita/image/layerstyles/kis_ls_stroke_filter.cpp b/krita/image/layerstyles/kis_ls_stroke_filter.cpp
index 1cb9522..f89da0c 100644
--- a/krita/image/layerstyles/kis_ls_stroke_filter.cpp
+++ b/krita/image/layerstyles/kis_ls_stroke_filter.cpp
@@ -132,17 +132,23 @@ void KisLsStrokeFilter::processDirectly(KisPaintDeviceSP src,
     const psd_layer_effects_stroke *config = style->stroke();
     if (!config->effectEnabled()) return;
 
-    applyStroke(src, dst, applyRect, config, env);
+    KisLsUtils::LodWrapper<psd_layer_effects_stroke> w(env->currentLevelOfDetail(), config);
+    applyStroke(src, dst, applyRect, w.config, env);
 }
 
-QRect KisLsStrokeFilter::neededRect(const QRect &rect, KisPSDLayerStyleSP style) const
+QRect KisLsStrokeFilter::neededRect(const QRect &rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const
 {
     Q_UNUSED(style);
     return rect;
 }
 
-QRect KisLsStrokeFilter::changedRect(const QRect &rect, KisPSDLayerStyleSP style) const
+QRect KisLsStrokeFilter::changedRect(const QRect &rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const
 {
-    const int borderSize = style->stroke()->size() + 1;
+    const psd_layer_effects_stroke *config = style->stroke();
+    if (!config->effectEnabled()) return rect;
+
+    KisLsUtils::LodWrapper<psd_layer_effects_stroke> w(env->currentLevelOfDetail(), config);
+
+    const int borderSize = w.config->size() + 1;
     return kisGrowRect(rect, borderSize);
 }
diff --git a/krita/image/layerstyles/kis_ls_stroke_filter.h b/krita/image/layerstyles/kis_ls_stroke_filter.h
index d8d2228..6747512 100644
--- a/krita/image/layerstyles/kis_ls_stroke_filter.h
+++ b/krita/image/layerstyles/kis_ls_stroke_filter.h
@@ -39,8 +39,8 @@ public:
                          KisPSDLayerStyleSP style,
                          KisLayerStyleFilterEnvironment *env) const;
 
-    QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style) const;
-    QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style) const;
+    QRect neededRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
+    QRect changedRect(const QRect & rect, KisPSDLayerStyleSP style, KisLayerStyleFilterEnvironment *env) const;
 
 private:
     void applyStroke(KisPaintDeviceSP srcDevice,
diff --git a/krita/image/layerstyles/kis_ls_utils.h b/krita/image/layerstyles/kis_ls_utils.h
index 7d6632b..5ef3427 100644
--- a/krita/image/layerstyles/kis_ls_utils.h
+++ b/krita/image/layerstyles/kis_ls_utils.h
@@ -21,6 +21,8 @@
 
 #include "kis_types.h"
 
+#include "kis_lod_transform.h"
+
 
 struct psd_layer_effects_context;
 class psd_layer_effects_shadow_base;
@@ -90,6 +92,31 @@ namespace KisLsUtils
                              const psd_layer_effects_shadow_base *config,
                              const KisLayerStyleFilterEnvironment *env);
 
+    template<class ConfigStruct>
+    struct LodWrapper
+    {
+        LodWrapper(int lod,
+                   const ConfigStruct *srcStruct)
+
+            {
+                if (lod > 0) {
+                    storage.reset(new ConfigStruct(*srcStruct));
+
+                    const qreal lodScale = KisLodTransform::lodToScale(lod);
+                    storage->scaleLinearSizes(lodScale);
+
+                    config = storage.data();
+                } else {
+                    config = srcStruct;
+                }
+            }
+
+        const ConfigStruct *config;
+
+    private:
+        QScopedPointer<ConfigStruct> storage;
+    };
+
 }
 
 #endif /* __KIS_LS_UTILS_H */
diff --git a/krita/image/tests/kis_layer_styles_test.cpp b/krita/image/tests/kis_layer_styles_test.cpp
index 4328d74..469774b 100644
--- a/krita/image/tests/kis_layer_styles_test.cpp
+++ b/krita/image/tests/kis_layer_styles_test.cpp
@@ -229,8 +229,11 @@ void testDropShadowNeedChangeRects(int distance,
     c.writeProperties(style);
 
 
-    QCOMPARE(lsFilter.neededRect(applyRect, style), needRect);
-    QCOMPARE(lsFilter.changedRect(applyRect, style), changeRect);
+    TestUtil::MaskParent parent;
+    KisLayerStyleFilterEnvironment env(parent.layer.data());
+
+    QCOMPARE(lsFilter.neededRect(applyRect, style, &env), needRect);
+    QCOMPARE(lsFilter.changedRect(applyRect, style, &env), changeRect);
 }
 
 void KisLayerStylesTest::testLayerStylesRects()
diff --git a/krita/libpsd/psd.h b/krita/libpsd/psd.h
index c4c3fb1..34c96c9 100644
--- a/krita/libpsd/psd.h
+++ b/krita/libpsd/psd.h
@@ -434,6 +434,11 @@ public:
         m_gradient = value;
     }
 
+    virtual void scaleLinearSizes(qreal scale) {
+        m_distance *= scale;
+        m_size *= scale;
+    }
+
 private:
     // internal
     bool m_invertsSelection;
@@ -849,6 +854,11 @@ struct psd_layer_effects_bevel_emboss : public psd_layer_effects_shadow_base
         m_textureVerticalPhase = value;
     }
 
+    virtual void scaleLinearSizes(qreal scale) {
+        psd_layer_effects_shadow_base::scaleLinearSizes(scale);
+        m_soften *= scale;
+        m_textureScale *= scale;
+    }
 
 private:
     psd_bevel_style m_style;
@@ -984,6 +994,11 @@ public:
         return QPointF(m_horizontalPhase, m_verticalPhase);
     }
 
+    virtual void scaleLinearSizes(qreal scale) {
+        psd_layer_effects_shadow_base::scaleLinearSizes(scale);
+        m_scale *= scale;
+    }
+
 private:
 
     // Gradient+Pattern



More information about the kimageshop mailing list