diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2022-09-20 13:22:04 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-09-21 09:47:57 +0200 |
commit | a3e36aaf5fcd7489f802913e93c200f3cde8492d (patch) | |
tree | 9fdd67bbdbc5010e14274fde201e6fe8a304449e /drawinglayer | |
parent | 90861cc6f815b3f34edb88d47afed0d1099e72e7 (diff) |
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.Grand@me.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
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()), |