drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit a3e36aaf5fcd7489f802913e93c200f3cde8492d
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Tue Sep 20 13:22:04 2022 +0200
Commit:     Armin Le Grand <armin.le.gr...@me.com>
CommitDate: Wed Sep 21 09:47:57 2022 +0200

    tdf#151081 render rotated gradients correctly
    
    We have to use regular primitive decomposition
    when the gradient is transformed in any other
    way then just tanslate & scale. For more background,
    refer to the bugzilla task.
    
    Corrected some typos.
    
    Change-Id: Ic767c9fe6d14444915facc1247ba4ec1f79fd02e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140237
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index cf8d7dcd3ac0..2e00f11e8b10 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -978,6 +978,21 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
         return;
     }
 
+    // tdf#151081 need to use regular primitive decomposition when the gradient
+    // is transformed in any other way then just tanslate & scale
+    basegfx::B2DVector aScale, aTranslate;
+    double fRotate, fShearX;
+
+    maCurrentTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
+
+    // detect if transformation is rotated, sheared or mirrored in X and/or Y
+    if (!basegfx::fTools::equalZero(fRotate) || 
!basegfx::fTools::equalZero(fShearX)
+        || aScale.getX() < 0.0 || aScale.getY() < 0.0)
+    {
+        process(rPrimitive);
+        return;
+    }
+
     GradientStyle eGradientStyle = 
convertGradientStyle(rFillGradient.getStyle());
 
     Gradient aGradient(eGradientStyle, Color(rFillGradient.getStartColor()),

Reply via email to