pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/print/poppler do the fix for possible division by zero...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5fa75158edac
branches:  trunk
changeset: 567534:5fa75158edac
user:      drochner <drochner%pkgsrc.org@localhost>
date:      Fri Nov 20 15:59:59 2009 +0000

description:
do the fix for possible division by zero more elegant, and add
a reference to the upstream bug report

diffstat:

 print/poppler/distinfo         |   4 +-
 print/poppler/patches/patch-ap |  71 ++++++++++++++++++++++++-----------------
 2 files changed, 43 insertions(+), 32 deletions(-)

diffs (92 lines):

diff -r 20f649abe748 -r 5fa75158edac print/poppler/distinfo
--- a/print/poppler/distinfo    Fri Nov 20 13:15:00 2009 +0000
+++ b/print/poppler/distinfo    Fri Nov 20 15:59:59 2009 +0000
@@ -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-ag) = 58d01b019daec19de80867ce0941e5160591bf62
 SHA1 (patch-ai) = a51dba3fb0e7131873ef82ae5e256fb1d17cee53
 SHA1 (patch-ao) = cf7e0f086522147a91f59b1b26ca510d1971ac74
-SHA1 (patch-ap) = f39b70d9420201281a6735114029514ef636f1bb
+SHA1 (patch-ap) = fc985510d4ebabe097e55bc4cbb0477267e95a7d
diff -r 20f649abe748 -r 5fa75158edac print/poppler/patches/patch-ap
--- a/print/poppler/patches/patch-ap    Fri Nov 20 13:15:00 2009 +0000
+++ b/print/poppler/patches/patch-ap    Fri Nov 20 15:59:59 2009 +0000
@@ -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];



Home | Main Index | Thread Index | Old Index