Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to prevent CanvasGraphics_getSinglePixelWidth from intermittently returning incorrect values in Firefox (issue 7188) #7330

Merged
merged 1 commit into from
Aug 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/display/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -2298,7 +2298,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
},
getSinglePixelWidth: function CanvasGraphics_getSinglePixelWidth(scale) {
if (this.cachedGetSinglePixelWidth === null) {
// NOTE: The `save` and `restore` commands used below is a workaround
// that is necessary in order to prevent `mozCurrentTransformInverse`
// from intermittently returning incorrect values in Firefox, see:
// https://github.com/mozilla/pdf.js/issues/7188.
this.ctx.save();
var inverse = this.ctx.mozCurrentTransformInverse;
this.ctx.restore();
// max of the current horizontal and vertical scale
this.cachedGetSinglePixelWidth = Math.sqrt(Math.max(
(inverse[0] * inverse[0] + inverse[1] * inverse[1]),
Expand Down