Files
pdfcraft/crates
Muhammad Saad bbba4b2585 M10: let a small image fill its fixed page (#3273 review)
The fit scale was capped with MAX_SIDE, which bounds a page side, not a
ratio. Past that scale the image came out smaller than the sheet: a
4 x 2 image at 1200 dpi covered 3456 pt of a 14400 pt page instead of
all of it, and a 30 x 30 JFIF at 65535 dpi covered 475 pt of Letter.

The fit scale needs no cap of its own. It is min(pw / w, ph / h), so
the drawn size is at most the page's by construction, and w and h are
above zero because a decoded image has at least one pixel and every
decoder here falls back to 72 dpi rather than pass on a non-positive
resolution. The guards against a zero divisor went with the cap, with
a comment saying why the division is defined.

Found by the review bot. The test was written before the fix and
observed failing at 3456 x 1728.
2026-10-31 13:19:29 +04:00
..