basegfx/source/tools/gradienttools.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
New commits: commit a6cc4d851f1a061af71e03af4c886638d6a5f3b3 Author: Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de> AuthorDate: Wed Apr 5 10:25:51 2023 +0200 Commit: Armin Le Grand <armin.le.gr...@me.com> CommitDate: Thu Apr 6 10:40:49 2023 +0200 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.gr...@me.com> 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]