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 May 29, 2023
1 parent 6d8810b commit 0b33db6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
Binary file added bug1445735.pdf
Binary file not shown.
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
8 changes: 8 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7676,5 +7676,13 @@
"link": true,
"forms": true,
"type": "eq"
},
{
"id": "bug1445735",
"file": "pdfs/bug1445735.pdf",
"md5": "a5470d82c1d23eac1fef2fa37f95e980",
"rounds": 1,
"link": true,
"type": "eq"
}
]

0 comments on commit 0b33db6

Please sign in to comment.