From 90ec2c9294409b19b983c1988f89bc5f385d108d Mon Sep 17 00:00:00 2001 From: Daan Sprenkels Date: Wed, 23 Dec 2015 18:17:23 +0100 Subject: [PATCH] shading-pattern: Decreased `Shadings.SMALL_NUMBER` and added a test case for #6298 --- src/core/pattern.js | 6 +- test/pdfs/.gitignore | 1 + test/pdfs/issue6298.pdf | 159 ++++++++++++++++++++++++++++++++++++++++ test/test_manifest.json | 6 ++ 4 files changed, 168 insertions(+), 4 deletions(-) create mode 100644 test/pdfs/issue6298.pdf diff --git a/src/core/pattern.js b/src/core/pattern.js index 589443e0f..2f5c4bd38 100644 --- a/src/core/pattern.js +++ b/src/core/pattern.js @@ -102,10 +102,8 @@ var Pattern = (function PatternClosure() { var Shadings = {}; // A small number to offset the first/last color stops so we can insert ones to -// support extend. Number.MIN_VALUE appears to be too small and breaks the -// extend. 1e-7 works in FF but chrome seems to use an even smaller sized number -// internally so we have to go bigger. -Shadings.SMALL_NUMBER = 1e-2; +// support extend. Number.MIN_VALUE is too small and breaks the extend. +Shadings.SMALL_NUMBER = 1e-6; // Radial and axial shading have very similar implementations // If needed, the implementations can be broken into two classes diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 74aa95331..fea8827eb 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -197,6 +197,7 @@ !issue6069.pdf !issue6106.pdf !issue6296.pdf +!issue6298.pdf !bug1001080.pdf !issue6108.pdf !issue6113.pdf diff --git a/test/pdfs/issue6298.pdf b/test/pdfs/issue6298.pdf new file mode 100644 index 000000000..edc11682e --- /dev/null +++ b/test/pdfs/issue6298.pdf @@ -0,0 +1,159 @@ +%PDF-1.4 +%âãÏÓ +1 0 obj +<< +/Metadata 2 0 R +/Type /Catalog +/Pages 3 0 R +>> +endobj +3 0 obj +<< +/Kids [4 0 R] +/Type /Pages +/Count 1 +>> +endobj +4 0 obj +<< +/Resources +<< +/ProcSet [/PDF] +/Shading 5 0 R +/ExtGState 6 0 R +/ColorSpace 7 0 R +/Pattern 8 0 R +>> +/Contents 9 0 R +/Parent 3 0 R +/Type /Page +/MediaBox [0 0 1000 100] +>> +endobj +9 0 obj +<< +/Length 43 +>> +stream +/R7 gs +/R8 cs +/R9 scn +0 0 1000 1000 re +f +Q + +endstream +endobj +10 0 obj +<< +/OPM 1 +/Type /ExtGState +>> +endobj +11 0 obj [/Pattern] +endobj +12 0 obj +<< +/PatternType 2 +/Shading 13 0 R +/Matrix [1 0 0 1 0 0] +>> +endobj +13 0 obj +<< +/Coords [0 0 1000 0] +/Extend [false false] +/Function 14 0 R +/ShadingType 2 +/ColorSpace /DeviceRGB +>> +endobj +14 0 obj +<< +/N 1 +/FunctionType 2 +/C1 [0 1 0] +/C0 [0 0 1] +/Domain [0 1] +>> +endobj +7 0 obj +<< +/R8 11 0 R +>> +endobj +6 0 obj +<< +/R7 10 0 R +>> +endobj +8 0 obj +<< +/R9 12 0 R +>> +endobj +5 0 obj +<< +/R10 13 0 R +>> +endobj +2 0 obj +<< +/Subtype /XML +/Type /Metadata +/Length 1340 +>> +stream + + + + + +2015-11-25T15:23:52+01:00 +2015-11-25T15:23:52+01:00 +Asymptote 2.15 + +Untitled + + + + + +endstream +endobj +15 0 obj +<< +/ModDate (D:20151125152352+01'00') +/CreationDate (D:20151125152352+01'00') +/Creator (Asymptote 2.15) +/Producer (GPL Ghostscript 9.10) +>> +endobj xref +0 16 +0000000000 65535 f +0000000015 00000 n +0000000921 00000 n +0000000082 00000 n +0000000141 00000 n +0000000886 00000 n +0000000818 00000 n +0000000784 00000 n +0000000852 00000 n +0000000330 00000 n +0000000426 00000 n +0000000474 00000 n +0000000502 00000 n +0000000579 00000 n +0000000701 00000 n +0000002346 00000 n +trailer + +<< +/Info 15 0 R +/ID [<00343308f37198793d00d83bd9194491> <00343308f37198793d00d83bd9194491>] +/Root 1 0 R +/Size 16 +>> +startxref +2503 +%%EOF diff --git a/test/test_manifest.json b/test/test_manifest.json index 694509251..4ebf23cfc 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -2597,6 +2597,12 @@ "rounds": 1, "type": "eq" }, + { "id": "issue6298.pdf", + "file": "pdfs/issue6298.pdf", + "md5": "214340be34f463611fc3127ad0695034", + "rounds": 1, + "type": "eq" + }, { "id": "issue5549.pdf", "file": "pdfs/issue5549.pdf", "md5": "6c36df6ebc583c9e18aad0ad00d257b8",