[Pkg-javascript-commits] [pdf.js] 180/207: Fixes mesh fill pattern with optional matrix (#5020)
David Prévot
taffit at moszumanska.debian.org
Mon Jul 28 15:36:46 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit dd2adf6200fe8a27f97ac2a3ed36a43abf469c23
Author: Fabian Lange <lange.fabian at gmail.com>
Date: Tue Jul 1 10:48:31 2014 +0200
Fixes mesh fill pattern with optional matrix (#5020)
In the referenced issue, there is a PDF which uses a fill pattern which does not
have a matrix defined. This causes singularValueDecompose2dScale to fail with
undefined property error when accessing elements of that matrix.
This fix will only use the matrix when it is defined. The output for the PDF in
question now looks identical to chrome and preview with respect to the gradient
fill pattern.
---
src/display/pattern_helper.js | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/display/pattern_helper.js b/src/display/pattern_helper.js
index 29b86f0..574edf5 100644
--- a/src/display/pattern_helper.js
+++ b/src/display/pattern_helper.js
@@ -226,24 +226,24 @@ ShadingIRs.Mesh = {
return {
type: 'Pattern',
getPattern: function Mesh_getPattern(ctx, owner, shadingFill) {
- var combinedScale;
- // Obtain scale from matrix and current transformation matrix.
+ var scale;
if (shadingFill) {
- combinedScale = Util.singularValueDecompose2dScale(
- ctx.mozCurrentTransform);
+ scale = Util.singularValueDecompose2dScale(ctx.mozCurrentTransform);
} else {
- var matrixScale = Util.singularValueDecompose2dScale(matrix);
- var curMatrixScale = Util.singularValueDecompose2dScale(
- owner.baseTransform);
- combinedScale = [matrixScale[0] * curMatrixScale[0],
- matrixScale[1] * curMatrixScale[1]];
+ // Obtain scale from matrix and current transformation matrix.
+ scale = Util.singularValueDecompose2dScale(owner.baseTransform);
+ if (matrix) {
+ var matrixScale = Util.singularValueDecompose2dScale(matrix);
+ scale = [scale[0] * matrixScale[0],
+ scale[1] * matrixScale[1]];
+ }
}
// Rasterizing on the main thread since sending/queue large canvases
// might cause OOM.
- var temporaryPatternCanvas = createMeshCanvas(bounds, combinedScale,
- coords, colors, figures, shadingFill ? null : background);
+ var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords,
+ colors, figures, shadingFill ? null : background);
if (!shadingFill) {
ctx.setTransform.apply(ctx, owner.baseTransform);
--
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