From a3e36aaf5fcd7489f802913e93c200f3cde8492d Mon Sep 17 00:00:00 2001 From: "Armin Le Grand (allotropia)" Date: Tue, 20 Sep 2022 13:22:04 +0200 Subject: 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 --- drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drawinglayer') 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()), -- cgit