[poppler] poppler/Gfx.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sun May 10 14:43:21 PDT 2009


 poppler/Gfx.cc |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 829ed964374676ddfa4a9048c940dc20a309ca47
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Sun May 10 23:39:11 2009 +0200

    Fix axial shading fix to ensure the painting passes by the four edges of the bbox
    
    When j and teoricalj are the same, just change the value of ta[] not the next[] ones

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index b63d424..897b24b 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -27,6 +27,7 @@
 // Copyright (C) 2008 Pino Toscano <pino at kde.org>
 // Copyright (C) 2008 Michael Vrable <mvrable at cs.ucsd.edu>
 // Copyright (C) 2008 Hib Eris <hib at hiberis.nl>
+// Copyright (C) 2009 M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -2447,9 +2448,13 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) {
          if (!doneBBox1 && ta[i] < bboxIntersections[1] && ta[j] > bboxIntersections[1]) {
            int teoricalj = (bboxIntersections[1] - tMin) * axialMaxSplits / (tMax - tMin);
            if (teoricalj <= i) teoricalj = i + 1;
-           if (j == teoricalj) j = teoricalj + 1;
-           next[i] = teoricalj;
-           next[teoricalj] = j;
+           if (teoricalj < j) {
+             next[i] = teoricalj;
+             next[teoricalj] = j;
+           }
+           else {
+             teoricalj = j;
+           }
            ta[teoricalj] = bboxIntersections[1];
            j = teoricalj;
            doneBBox1 = true;
@@ -2457,14 +2462,18 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) {
          if (!doneBBox2 && ta[i] < bboxIntersections[2] && ta[j] > bboxIntersections[2]) {
            int teoricalj = (bboxIntersections[2] - tMin) * axialMaxSplits / (tMax - tMin);
            if (teoricalj <= i) teoricalj = i + 1;
-           if (j == teoricalj) j = teoricalj + 1;
-           next[i] = teoricalj;
-           next[teoricalj] = j;
+           if (teoricalj < j) {
+             next[i] = teoricalj;
+             next[teoricalj] = j;
+           }
+           else {
+             teoricalj = j;
+           }
            ta[teoricalj] = bboxIntersections[2];
            j = teoricalj;
            doneBBox2 = true;
          }
-        break;
+         break;
       }
       k = (i + j) / 2;
       ta[k] = 0.5 * (ta[i] + ta[j]);


More information about the poppler mailing list