Skip to content

Commit

Permalink
Don't downscale by steps images which will end up with small dimensio…
Browse files Browse the repository at this point in the history
…ns (bug 1445735)
  • Loading branch information
calixteman committed Jun 2, 2023
1 parent cccdc8d commit 0fd2f12
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/display/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,16 @@ class CanvasGraphics {
1
);

if (width / widthScale <= 5 && height / heightScale <= 5) {
// The final image is very small, hence having a poor quality
// when rescaling isn't really a problem.
return {
img,
paintWidth: width,
paintHeight: height,
};
}

let paintWidth = width,
paintHeight = height;
let tmpCanvasId = "prescale1";
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/bug1445735.pdf.link
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://bugzilla.mozilla.org/attachment.cgi?id=8958936
10 changes: 9 additions & 1 deletion test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7713,5 +7713,13 @@
"value": ["Three", "Five"]
}
}
}
},
{
"id": "bug1445735",
"file": "pdfs/bug1445735.pdf",
"md5": "a5470d82c1d23eac1fef2fa37f95e980",
"rounds": 1,
"link": true,
"type": "eq"
}
]

0 comments on commit 0fd2f12

Please sign in to comment.