[Pkg-javascript-commits] [pdf.js] 18/115: apply transformation matrix to RadialGradient radiuses, not only to circle origin points fix for #6006

David Prévot taffit at moszumanska.debian.org
Wed Dec 16 20:03:10 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 6ce83d329076ff9656e7e0c3bfeee2f064bd26f9
Author: Daan Sprenkels <dsprenkels at gmail.com>
Date:   Mon Nov 16 00:26:42 2015 +0100

    apply transformation matrix to RadialGradient radiuses,
    not only to circle origin points
    fix for #6006
---
 src/core/pattern.js     |   5 ++
 test/pdfs/.gitignore    |   1 +
 test/pdfs/issue6006.pdf | 124 ++++++++++++++++++++++++++++++++++++++++++++++++
 test/test_manifest.json |   7 +++
 4 files changed, 137 insertions(+)

diff --git a/src/core/pattern.js b/src/core/pattern.js
index a922ae7..41d6c29 100644
--- a/src/core/pattern.js
+++ b/src/core/pattern.js
@@ -205,6 +205,11 @@ Shadings.RadialAxial = (function RadialAxialClosure() {
       if (matrix) {
         p0 = Util.applyTransform(p0, matrix);
         p1 = Util.applyTransform(p1, matrix);
+        if (shadingType === ShadingType.RADIAL) {
+          var scale = Util.singularValueDecompose2dScale(matrix);
+          r0 *= scale[0];
+          r1 *= scale[1];
+        }
       }
 
       return ['RadialAxial', type, this.colorStops, p0, p1, r0, r1];
diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore
index a73785c..a246c1f 100644
--- a/test/pdfs/.gitignore
+++ b/test/pdfs/.gitignore
@@ -60,6 +60,7 @@
 !bug1157493.pdf
 !pdfjsbad1586.pdf
 !freeculture.pdf
+!issue6006.pdf
 !pdfkit_compressed.pdf
 !TAMReview.pdf
 !pr4922.pdf
diff --git a/test/pdfs/issue6006.pdf b/test/pdfs/issue6006.pdf
new file mode 100644
index 0000000..ebe9736
--- /dev/null
+++ b/test/pdfs/issue6006.pdf
@@ -0,0 +1,124 @@
+%PDF-1.5
+%����
+1 0 obj 
+<<
+/Kids [2 0 R]
+/Count 1
+/Type /Pages
+>>
+endobj 
+2 0 obj 
+<<
+/Parent 1 0 R
+/Resources 3 0 R
+/MediaBox [0 0 100 100]
+/Contents 4 0 R
+/Type /Page
+>>
+endobj 
+4 0 obj 
+<<
+/Length 42
+>>
+stream
+q
+/Pattern cs /p4 scn
+0 0 100 100 re f
+Q 
+
+endstream 
+endobj 
+3 0 obj 
+<<
+/Pattern 
+<<
+/p4 5 0 R
+>>
+>>
+endobj 
+5 0 obj 
+<<
+/Matrix [50 0 0 50 50 50]
+/Shading 
+<<
+/ColorSpace /DeviceRGB
+/Function 6 0 R
+/Coords [0 0 0 0 0 1]
+/ShadingType 3
+/Extend [true true]
+>>
+/PatternType 2
+/Type /Pattern
+>>
+endobj 
+6 0 obj 
+<<
+/FunctionType 3
+/Functions [7 0 R 8 0 R 9 0 R]
+/Encode [-1 1 0 1 0 1]
+/Bounds [0.40 0.50]
+/Domain [0 1]
+>>
+endobj 
+7 0 obj 
+<<
+/FunctionType 2
+/N 1
+/C1 [1 1 1]
+/Domain [0 1]
+/C0 [0 0 1]
+>>
+endobj 
+8 0 obj 
+<<
+/FunctionType 2
+/N 1
+/C1 [1 1 1]
+/Domain [0 1]
+/C0 [1 1 1]
+>>
+endobj 
+9 0 obj 
+<<
+/FunctionType 2
+/N 1
+/C1 [1 0 0]
+/Domain [0 1]
+/C0 [1 1 1]
+>>
+endobj 
+10 0 obj 
+<<
+/Pages 1 0 R
+/Type /Catalog
+>>
+endobj 
+11 0 obj 
+<<
+/Title (PDF.js test case for issue #6006)
+/Author (Daan Sprenkels <dsprenkels at gmail.com>)
+>>
+endobj xref
+0 12
+0000000000 65535 f 
+0000000015 00000 n 
+0000000074 00000 n 
+0000000275 00000 n 
+0000000180 00000 n 
+0000000324 00000 n 
+0000000515 00000 n 
+0000000642 00000 n 
+0000000724 00000 n 
+0000000806 00000 n 
+0000000888 00000 n 
+0000000940 00000 n 
+trailer
+
+<<
+/Info 11 0 R
+/Root 10 0 R
+/Size 12
+>>
+startxref
+1053
+%%EOF
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 2b8b830..b724f56 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -1617,6 +1617,13 @@
       "link": true,
       "type": "eq"
     },
+    {
+      "id": "issue6006",
+      "file": "pdfs/issue6006.pdf",
+      "md5": "65558dcdd2f20d4372458419c10bfa72",
+      "rounds": 1,
+      "type": "eq"
+    },
     {  "id": "issue1810",
       "file": "pdfs/issue1810.pdf",
       "md5": "b173a9dfb7bf00e1a298c6e8cb95c03e",

-- 
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