summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2023-04-05 10:25:51 +0200
committerArmin Le Grand <Armin.Le.Grand@me.com>2023-04-06 10:40:49 +0200
commita6cc4d851f1a061af71e03af4c886638d6a5f3b3 (patch)
treef1bb4862054db9a558378360ada9a1a7b29f8aff /basegfx
parent5ef4d326a06f9fc0aff36bd5cdcba1b7af8e03db (diff)
MCGR: Moved color compare in common computation part
The colors of a ColorStopRange can be equal in case of hit *and* miss, so in both cases. I moved it to the common computation part. Prev version worked and did no harm, but unnecessary color interpolations for equal colors. Change-Id: I19031f1021ee5955b48da5c0d8e3a03cb9512ebf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150046 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/tools/gradienttools.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx
index 61e3f9b459bc..ca315f33f973 100644
--- a/basegfx/source/tools/gradienttools.cxx
+++ b/basegfx/source/tools/gradienttools.cxx
@@ -686,12 +686,6 @@ namespace basegfx
if (rColorStops.end() == lowerBound)
return rColorStops.back().getStopColor();
- // when there are just two color steps this cannot happen, but when using
- // a range of colors this *may* be used inside the range to represent
- // single-colored regions inside a ColorRange. Use that color & done
- if (lowerBound->getStopColor() == upperBound->getStopColor())
- return rLastColorStopRange.maColorStart;
-
// we have lower and upper bound, get colors and offsets
rLastColorStopRange.maColorStart = lowerBound->getStopColor();
rLastColorStopRange.maColorEnd = upperBound->getStopColor();
@@ -699,6 +693,11 @@ namespace basegfx
rLastColorStopRange.mfOffsetEnd = upperBound->getStopOffset();
}
+ // when there are just two color steps this cannot happen, but when using
+ // a range of colors this *may* be used inside the range to represent
+ // single-colored regions inside a ColorRange. Use that color & done
+ if (rLastColorStopRange.maColorStart == rLastColorStopRange.maColorEnd)
+ return rLastColorStopRange.maColorStart;
// calculate number of steps and adapted proportional
// range for scaler in [0.0 .. 1.0]