[Pkg-javascript-commits] [pdf.js] 143/157: fix handling of flags 1-3 in coons shading

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 06:46:53 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit c85fa00d6288d594bde1258fd186ec3c16efa3ac
Author: Tilman Hausherr <tilman at snafu.de>
Date:   Mon Aug 3 17:34:30 2015 +0200

    fix handling of flags 1-3 in coons shading
    
    Short story: somebody got lost in two different indices. pi is an index in the stream and is explained on page 198 of the 32000-spec (however 1-based there), and ps is an index to something in PDF.js. I used the code from flag 0 (which works) to understand which is which. It is also important to understand that for flags 1,2 and 3, the stream is always assigned to the same coordinates and colors. What changes is which "old" coordinates and colors are assigned to what is "missing" in t [...]
---
 src/core/pattern.js                       |  39 ++++++++++++++++--------------
 test/pdfs/.gitignore                      |   1 +
 test/pdfs/coons-allflags-withfunction.pdf | Bin 0 -> 3285 bytes
 test/test_manifest.json                   |   6 +++++
 4 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/src/core/pattern.js b/src/core/pattern.js
index 0321e1b..c6721af 100644
--- a/src/core/pattern.js
+++ b/src/core/pattern.js
@@ -508,29 +508,32 @@ Shadings.Mesh = (function MeshClosure() {
           break;
         case 1:
           tmp1 = ps[12]; tmp2 = ps[13]; tmp3 = ps[14]; tmp4 = ps[15];
-          ps[12] = pi + 5; ps[13] = pi + 4;  ps[14] = pi + 3;  ps[15] = pi + 2;
-          ps[ 8] = pi + 6; /* values for 5, 6, 9, 10 are    */ ps[11] = pi + 1;
-          ps[ 4] = pi + 7; /* calculated below              */ ps[ 7] = pi;
-          ps[ 0] = tmp1;   ps[ 1] = tmp2;    ps[ 2] = tmp3;    ps[ 3] = tmp4;
+          ps[12] = tmp4; ps[13] = pi + 0;  ps[14] = pi + 1;  ps[15] = pi + 2;
+          ps[ 8] = tmp3; /* values for 5, 6, 9, 10 are    */ ps[11] = pi + 3;
+          ps[ 4] = tmp2; /* calculated below              */ ps[ 7] = pi + 4;
+          ps[ 0] = tmp1; ps[ 1] = pi + 7;   ps[ 2] = pi + 6; ps[ 3] = pi + 5;
           tmp1 = cs[2]; tmp2 = cs[3];
-          cs[2] = ci + 1; cs[3] = ci;
-          cs[0] = tmp1;   cs[1] = tmp2;
+          cs[2] = tmp2;   cs[3] = ci;
+          cs[0] = tmp1;   cs[1] = ci + 1;
           break;
         case 2:
-          ps[12] = ps[15]; ps[13] = pi + 7; ps[14] = pi + 6;   ps[15] = pi + 5;
-          ps[ 8] = ps[11]; /* values for 5, 6, 9, 10 are    */ ps[11] = pi + 4;
-          ps[ 4] = ps[7];  /* calculated below              */ ps[ 7] = pi + 3;
-          ps[ 0] = ps[3];  ps[ 1] = pi;     ps[ 2] = pi + 1;   ps[ 3] = pi + 2;
-          cs[2] = cs[3]; cs[3] = ci + 1;
-          cs[0] = cs[1]; cs[1] = ci;
+          tmp1 = ps[15];
+          tmp2 = ps[11];
+          ps[12] = ps[3];  ps[13] = pi + 0; ps[14] = pi + 1;   ps[15] = pi + 2;
+          ps[ 8] = ps[7];  /* values for 5, 6, 9, 10 are    */ ps[11] = pi + 3;
+          ps[ 4] = tmp2;   /* calculated below              */ ps[ 7] = pi + 4;
+          ps[ 0] = tmp1;  ps[ 1] = pi + 7;   ps[ 2] = pi + 6;  ps[ 3] = pi + 5;
+          tmp1 = cs[3];
+          cs[2] = cs[1]; cs[3] = ci;
+          cs[0] = tmp1;  cs[1] = ci + 1;
           break;
         case 3:
-          ps[12] = ps[0];  ps[13] = ps[1];   ps[14] = ps[2];   ps[15] = ps[3];
-          ps[ 8] = pi;     /* values for 5, 6, 9, 10 are    */ ps[11] = pi + 7;
-          ps[ 4] = pi + 1; /* calculated below              */ ps[ 7] = pi + 6;
-          ps[ 0] = pi + 2; ps[ 1] = pi + 3;  ps[ 2] = pi + 4;  ps[ 3] = pi + 5;
-          cs[2] = cs[0]; cs[3] = cs[1];
-          cs[0] = ci;    cs[1] = ci + 1;
+          ps[12] = ps[0];  ps[13] = pi + 0;   ps[14] = pi + 1; ps[15] = pi + 2;
+          ps[ 8] = ps[1];  /* values for 5, 6, 9, 10 are    */ ps[11] = pi + 3;
+          ps[ 4] = ps[2];  /* calculated below              */ ps[ 7] = pi + 4;
+          ps[ 0] = ps[3];  ps[ 1] = pi + 7;   ps[ 2] = pi + 6; ps[ 3] = pi + 5;
+          cs[2] = cs[0]; cs[3] = ci;
+          cs[0] = cs[1]; cs[1] = ci + 1;
           break;
       }
       // set p11, p12, p21, p22
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index 1659206..cc93374 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -127,6 +127,7 @@
 !bug946506.pdf
 !issue3885.pdf
 !bug859204.pdf
+!coons-allflags-withfunction.pdf
 !issue4246.pdf
 !issue4461.pdf
 !issue4573.pdf
diff --git a/test/pdfs/coons-allflags-withfunction.pdf b/test/pdfs/coons-allflags-withfunction.pdf
new file mode 100644
index 0000000..fcbf775
Binary files /dev/null and b/test/pdfs/coons-allflags-withfunction.pdf differ
diff --git a/test/test_manifest.json b/test/test_manifest.json
index b91a6a9..ff7efb6 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -2247,6 +2247,12 @@
        "lastPage": 4,
        "type": "eq"
     },
+    {  "id": "issue4227",
+       "file": "pdfs/coons-allflags-withfunction.pdf",
+       "md5": "c5f79c24bf9eb66698be0e4ecaa1bdf8",
+       "rounds": 1,
+       "type": "eq"
+    },
     {  "id": "issue4246",
       "file": "pdfs/issue4246.pdf",
       "md5": "ed81787b83cc317c9f049643b853bea3",

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list