summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-02-01 18:07:51 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-02-08 21:55:45 +0100
commitcfe402fd7755cb14551db3af39a7da783ef77350 (patch)
treebe569218d482f06ad86b14a001d9ae56033144b0 /canvas
parentbb75291797f40b1c2b8777704ab6159d1cf5d156 (diff)
adjust gradient drawing in vclcanvas (tdf#144073)
For whatever strange reason the drawing does not use the given geometry, but something bigger. When I added direct drawing using VCL in a46cb5dc607d1d1af402ff3e8fce731e7427854d I naively assumed that the drawing area for the gradient would be the given area. Change-Id: Ia62cb0e5046e622679143eef56a3c6782781bf59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129298 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com> (cherry picked from commit adc2ac31fb2763077e48658756946a39d91c8e12) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129263 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index 33f4f5c5318c..fa8b97395cfe 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -154,6 +154,12 @@ namespace vclcanvas
// 2 colors and 2 stops (at 0 and 1) is a linear gradient:
if( rColors.size() == 2 && rValues.maStops.size() == 2 && rValues.maStops[0] == 0 && rValues.maStops[1] == 1)
{
+ // tdf#144073: Note that the code below adjusts the gradient area this way.
+ // No, I have no idea why.
+ aLeftTop -= 2.0*nDiagonalLength*aDirection;
+ aLeftBottom -= 2.0*nDiagonalLength*aDirection;
+ aRightTop += 2.0*nDiagonalLength*aDirection;
+ aRightBottom += 2.0*nDiagonalLength*aDirection;
Gradient vclGradient( GradientStyle::Linear, rColors[ 0 ], rColors[ 1 ] );
::tools::Polygon aTempPoly( static_cast<sal_uInt16>(5) );
aTempPoly[0] = ::Point( ::basegfx::fround( aLeftTop.getX() ),
@@ -173,6 +179,12 @@ namespace vclcanvas
&& rValues.maStops.size() == 3 && rValues.maStops[0] == 0
&& rValues.maStops[1] == 0.5 && rValues.maStops[2] == 1)
{
+ // tdf#144073: Note that the code below adjusts the gradient area this way.
+ // No, I have no idea why.
+ aLeftTop -= 2.0*nDiagonalLength*aDirection;
+ aLeftBottom -= 2.0*nDiagonalLength*aDirection;
+ aRightTop += 2.0*nDiagonalLength*aDirection;
+ aRightBottom += 2.0*nDiagonalLength*aDirection;
Gradient vclGradient( GradientStyle::Axial, rColors[ 1 ], rColors[ 0 ] );
::tools::Polygon aTempPoly( static_cast<sal_uInt16>(5) );
aTempPoly[0] = ::Point( ::basegfx::fround( aLeftTop.getX() ),