[Pkg-javascript-commits] [pdf.js] 362/414: Stops bleeding of pattern edges for mesh.
David Prévot
taffit at moszumanska.debian.org
Tue Jun 28 17:12:40 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 398e6acbc52c77e7465ce4a893bb3173c71638f1
Author: Yury Delendik <ydelendik at mozilla.com>
Date: Mon Apr 11 18:21:44 2016 -0500
Stops bleeding of pattern edges for mesh.
---
src/display/pattern_helper.js | 20 +++++++++++++++-----
test/pdfs/bug1260585.pdf.link | 1 +
test/test_manifest.json | 8 ++++++++
3 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/src/display/pattern_helper.js b/src/display/pattern_helper.js
index c5b6a3b..8691370 100644
--- a/src/display/pattern_helper.js
+++ b/src/display/pattern_helper.js
@@ -169,6 +169,9 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
var EXPECTED_SCALE = 1.1;
// MAX_PATTERN_SIZE is used to avoid OOM situation.
var MAX_PATTERN_SIZE = 3000; // 10in @ 300dpi shall be enough
+ // We need to keep transparent border around our pattern for fill():
+ // createPattern with 'no-repeat' will bleed edges accross entire area.
+ var BORDER_SIZE = 2;
var offsetX = Math.floor(bounds[0]);
var offsetY = Math.floor(bounds[1]);
@@ -191,17 +194,22 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
scaleY: 1 / scaleY
};
+ var paddedWidth = width + BORDER_SIZE * 2;
+ var paddedHeight = height + BORDER_SIZE * 2;
+
var canvas, tmpCanvas, i, ii;
if (WebGLUtils.isEnabled) {
canvas = WebGLUtils.drawFigures(width, height, backgroundColor,
figures, context);
// https://bugzilla.mozilla.org/show_bug.cgi?id=972126
- tmpCanvas = cachedCanvases.getCanvas('mesh', width, height, false);
- tmpCanvas.context.drawImage(canvas, 0, 0);
+ tmpCanvas = cachedCanvases.getCanvas('mesh', paddedWidth, paddedHeight,
+ false);
+ tmpCanvas.context.drawImage(canvas, BORDER_SIZE, BORDER_SIZE);
canvas = tmpCanvas.canvas;
} else {
- tmpCanvas = cachedCanvases.getCanvas('mesh', width, height, false);
+ tmpCanvas = cachedCanvases.getCanvas('mesh', paddedWidth, paddedHeight,
+ false);
var tmpCtx = tmpCanvas.context;
var data = tmpCtx.createImageData(width, height);
@@ -217,11 +225,13 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
for (i = 0; i < figures.length; i++) {
drawFigure(data, figures[i], context);
}
- tmpCtx.putImageData(data, 0, 0);
+ tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE);
canvas = tmpCanvas.canvas;
}
- return {canvas: canvas, offsetX: offsetX, offsetY: offsetY,
+ return {canvas: canvas,
+ offsetX: offsetX - BORDER_SIZE * scaleX,
+ offsetY: offsetY - BORDER_SIZE * scaleY,
scaleX: scaleX, scaleY: scaleY};
}
return createMeshCanvas;
diff --git a/test/pdfs/bug1260585.pdf.link b/test/pdfs/bug1260585.pdf.link
new file mode 100644
index 0000000..1038fa2
--- /dev/null
+++ b/test/pdfs/bug1260585.pdf.link
@@ -0,0 +1 @@
+https://bugzilla.mozilla.org/attachment.cgi?id=8736063
diff --git a/test/test_manifest.json b/test/test_manifest.json
index 5f7f175..609391b 100644
--- a/test/test_manifest.json
+++ b/test/test_manifest.json
@@ -2204,6 +2204,14 @@
"link": true,
"type": "load"
},
+ { "id": "bug1260585",
+ "file": "pdfs/bug1260585.pdf",
+ "md5": "9415b1eb00a43c97c15328cd4c8d136a",
+ "rounds": 1,
+ "lastPage": 1,
+ "link": true,
+ "type": "load"
+ },
{ "id": "issue3062",
"file": "pdfs/issue3062.pdf",
"md5": "206715f1258f0e117df4180d98dd4d68",
--
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