summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-06-06 13:28:09 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-06-07 08:42:30 +0200
commitaa5d7477e8e1e4bcd0e56496e745c3dc3b05c369 (patch)
tree49d00abe946d397622a18a6705cf1825a96c12a7 /drawinglayer
parent90088d43a20cff2623c2f01949955099f9b92845 (diff)
tdf#117949 Use small overlap for SVG gradient representation
Change-Id: Idd55df31aa87cc40dbb15001479cdc79e918ac19 Reviewed-on: https://gerrit.libreoffice.org/55376 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/primitive2d/svggradientprimitive2d.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 0197b4199fb2..12eef36c16ac 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -915,14 +915,21 @@ namespace drawinglayer
// use color distance and discrete lengths to calculate step count
const sal_uInt32 nSteps(calculateStepsForSvgGradient(getColorA(), getColorB(), fDelta, fDiscreteUnit));
+ // tdf#117949 Use a small amount of discrete overlap at the edges. Usually this
+ // should be exactly 0.0 and 1.0, but there were cases when this gets clipped
+ // against the mask polygon which got numerically problematic.
+ // This change is unnecessary in that respect, but avoids that numerical havoc
+ // by at the same time doing no real harm AFAIK
+ // TTTT: Remove again when clipping is fixed (!)
+
// prepare polygon in needed width at start position (with discrete overlap)
const basegfx::B2DPolygon aPolygon(
basegfx::utils::createPolygonFromRect(
basegfx::B2DRange(
getOffsetA() - fDiscreteUnit,
- 0.0,
+ -0.0001, // TTTT -> should be 0.0, see comment above
getOffsetA() + (fDelta / nSteps) + fDiscreteUnit,
- 1.0)));
+ 1.0001))); // TTTT -> should be 1.0, see comment above
// prepare loop (inside to outside, [0.0 .. 1.0[)
double fUnitScale(0.0);