diff options
author | drochner <drochner@pkgsrc.org> | 2009-11-20 15:59:59 +0000 |
---|---|---|
committer | drochner <drochner@pkgsrc.org> | 2009-11-20 15:59:59 +0000 |
commit | 8a92b7790d42347590929ca2c0f43564f5935c45 (patch) | |
tree | d197c7ed3ace881e5ad218a66adb300fb975809a /print | |
parent | dc13d69a5ddf7619795c3ba64b000f6ac9f941c6 (diff) | |
download | pkgsrc-8a92b7790d42347590929ca2c0f43564f5935c45.tar.gz |
do the fix for possible division by zero more elegant, and add
a reference to the upstream bug report
Diffstat (limited to 'print')
-rw-r--r-- | print/poppler/distinfo | 4 | ||||
-rw-r--r-- | print/poppler/patches/patch-ap | 71 |
2 files changed, 43 insertions, 32 deletions
diff --git a/print/poppler/distinfo b/print/poppler/distinfo index e40a52fd146..990b4d2b738 100644 --- a/print/poppler/distinfo +++ b/print/poppler/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.50 2009/11/20 11:20:11 drochner Exp $ +$NetBSD: distinfo,v 1.51 2009/11/20 15:59:59 drochner Exp $ SHA1 (poppler-0.12.2.tar.gz) = 3138c456f7e6a429100109ac6cd5a948437b9f04 RMD160 (poppler-0.12.2.tar.gz) = d2c06fd23012e16505ae5e5eced7cbd4d03c0b2c @@ -8,4 +8,4 @@ SHA1 (patch-ab) = 441308aec73c66a34c00ee1fad30a38748c89a7d SHA1 (patch-ag) = 58d01b019daec19de80867ce0941e5160591bf62 SHA1 (patch-ai) = a51dba3fb0e7131873ef82ae5e256fb1d17cee53 SHA1 (patch-ao) = cf7e0f086522147a91f59b1b26ca510d1971ac74 -SHA1 (patch-ap) = f39b70d9420201281a6735114029514ef636f1bb +SHA1 (patch-ap) = fc985510d4ebabe097e55bc4cbb0477267e95a7d diff --git a/print/poppler/patches/patch-ap b/print/poppler/patches/patch-ap index d3a13a8f40b..05b3e5f7a59 100644 --- a/print/poppler/patches/patch-ap +++ b/print/poppler/patches/patch-ap @@ -1,32 +1,43 @@ -$NetBSD: patch-ap,v 1.1 2009/11/19 17:58:41 drochner Exp $ +$NetBSD: patch-ap,v 1.2 2009/11/20 15:59:59 drochner Exp $ ---- poppler/Gfx.cc.orig 2009-09-09 23:25:11.000000000 +0200 +https://bugs.freedesktop.org/show_bug.cgi?id=25189 + +--- poppler/Gfx.cc.orig 2009-10-23 21:44:04.000000000 +0200 +++ poppler/Gfx.cc -@@ -2462,7 +2462,10 @@ void Gfx::doAxialShFill(GfxAxialShading - if (out->useFillColorStop()) { - // make sure we add stop color when t = tMin - state->setFillColor(&color0); -- out->updateFillColorStop(state, (tt - tMin)/(tMax - tMin)); -+ if (tMax == tMin) -+ out->updateFillColorStop(state, tMin); -+ else -+ out->updateFillColorStop(state, (tt - tMin)/(tMax - tMin)); - } - - // compute the coordinates of the point on the t axis at t = tMin; -@@ -2602,9 +2605,12 @@ void Gfx::doAxialShFill(GfxAxialShading - - // set the color - state->setFillColor(&color0); -- if (out->useFillColorStop()) -- out->updateFillColorStop(state, (ta[j] - tMin)/(tMax - tMin)); -- else -+ if (out->useFillColorStop()) { -+ if (tMax == tMin) -+ out->updateFillColorStop(state, tMin); -+ else -+ out->updateFillColorStop(state, (ta[j] - tMin)/(tMax - tMin)); -+ } else - out->updateFillColor(state); - - if (needExtend) { +@@ -2367,7 +2367,7 @@ static void bubbleSort(double array[]) + void Gfx::doAxialShFill(GfxAxialShading *shading) { + double xMin, yMin, xMax, yMax; + double x0, y0, x1, y1; +- double dx, dy, mul; ++ double dx, dy, len2; + GBool dxZero, dyZero; + double bboxIntersections[4]; + double tMin, tMax, tx, ty; +@@ -2389,16 +2389,18 @@ void Gfx::doAxialShFill(GfxAxialShading + shading->getCoords(&x0, &y0, &x1, &y1); + dx = x1 - x0; + dy = y1 - y0; +- dxZero = fabs(dx) < 0.01; +- dyZero = fabs(dy) < 0.01; +- if (dxZero && dyZero) { +- tMin = tMax = 0; ++ dxZero = (dx == 0.0); ++ dyZero = (dy == 0.0); ++ len2 = dx * dx + dy * dy; ++ if (len2 == 0.0) { ++ /* invalid? */ ++ tMin = 0; ++ tMax = 1; + } else { +- mul = 1 / (dx * dx + dy * dy); +- bboxIntersections[0] = ((xMin - x0) * dx + (yMin - y0) * dy) * mul; +- 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; ++ bboxIntersections[0] = ((xMin - x0) * dx + (yMin - y0) * dy) / len2; ++ bboxIntersections[1] = ((xMin - x0) * dx + (yMax - y0) * dy) / len2; ++ bboxIntersections[2] = ((xMax - x0) * dx + (yMin - y0) * dy) / len2; ++ bboxIntersections[3] = ((xMax - x0) * dx + (yMax - y0) * dy) / len2; + bubbleSort(bboxIntersections); + tMin = bboxIntersections[0]; + tMax = bboxIntersections[3]; |