[poppler] poppler/Gfx.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Jul 17 22:38:41 UTC 2021
poppler/Gfx.cc | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
New commits:
commit 9998ae596bd26cc7b61f176dda0fcee6e1dd346b
Author: Oliver Sander <oliver.sander at tu-dresden.de>
Date: Thu Jul 15 15:46:43 2021 +0200
Replace a local bubble sort implementation by std::sort
This makes the code a bit shorter.
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 32144b3d..c30c2f5c 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -2525,21 +2525,6 @@ void Gfx::doFunctionShFill1(GfxFunctionShading *shading, double x0, double y0, d
}
}
-static void bubbleSort(double array[])
-{
- for (int j = 0; j < 3; ++j) {
- int kk = j;
- for (int k = j + 1; k < 4; ++k) {
- if (array[k] < array[kk]) {
- kk = k;
- }
- }
- double tmp = array[j];
- array[j] = array[kk];
- array[kk] = tmp;
- }
-}
-
void Gfx::doAxialShFill(GfxAxialShading *shading)
{
double xMin, yMin, xMax, yMax;
@@ -2576,7 +2561,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading)
bboxIntersections[1] = ((xMin - x0) * dx + (yMax - y0) * dy) * mul;
bboxIntersections[2] = ((xMax - x0) * dx + (yMin - y0) * dy) * mul;
bboxIntersections[3] = ((xMax - x0) * dx + (yMax - y0) * dy) * mul;
- bubbleSort(bboxIntersections);
+ std::sort(std::begin(bboxIntersections), std::end(bboxIntersections));
tMin = bboxIntersections[0];
tMax = bboxIntersections[3];
if (tMin < 0 && !shading->getExtend0()) {
@@ -2677,7 +2662,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading)
s[1] = (yMax - ty) / dx;
s[2] = (xMin - tx) / -dy;
s[3] = (xMax - tx) / -dy;
- bubbleSort(s);
+ std::sort(std::begin(s), std::end(s));
sMin = s[1];
sMax = s[2];
}
@@ -2791,7 +2776,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading)
s[1] = (yMax - ty) / dx;
s[2] = (xMin - tx) / -dy;
s[3] = (xMax - tx) / -dy;
- bubbleSort(s);
+ std::sort(std::begin(s), std::end(s));
sMin = s[1];
sMax = s[2];
}
More information about the poppler
mailing list