1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 07:38:07 +02:00

Fix flaw in mozCurrentTransform polyfill

Set transformation matrix in (polyfilled) mozPrintCallback when a scale
is applied. Removed _scaleX and _scaleY in favor of _transformMatrix to
emphasize that the caller MUST ensure that the state of the matrix is
correct before `addContextCurrentTransform` is called.
This commit is contained in:
Rob Wu 2015-03-11 20:55:26 +01:00
parent c17ff30d19
commit 6eb9e6a6a4
2 changed files with 13 additions and 8 deletions

View file

@ -362,10 +362,11 @@ var PDFPageView = (function PDFPageViewClosure() {
}
this.textLayer = textLayer;
// TODO(mack): use data attributes to store these
ctx._scaleX = outputScale.sx;
ctx._scaleY = outputScale.sy;
if (outputScale.scaled) {
//#if !(MOZCENTRAL || FIREFOX)
// Used by the mozCurrentTransform polyfill in src/display/canvas.js.
ctx._transformMatrix = [outputScale.sx, 0, 0, outputScale.sy, 0, 0];
//#endif
ctx.scale(outputScale.sx, outputScale.sy);
}
@ -516,6 +517,11 @@ var PDFPageView = (function PDFPageViewClosure() {
ctx.fillStyle = 'rgb(255, 255, 255)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.restore();
//#if !(MOZCENTRAL || FIREFOX)
// Used by the mozCurrentTransform polyfill in src/display/canvas.js.
ctx._transformMatrix =
[PRINT_OUTPUT_SCALE, 0, 0, PRINT_OUTPUT_SCALE, 0, 0];
//#endif
ctx.scale(PRINT_OUTPUT_SCALE, PRINT_OUTPUT_SCALE);
var renderContext = {