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

Ensure that rendering of thumbnails work correctly on HiDPI displays (issue 9820) #12618

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

Note that I wasn't able to reproduce the issue in Firefox, but only in Chromium-browsers.

The bug, and it's feels almost trivial once you've found it, is that we're not passing the transform parameter as intended to PDFPageProxy.render when drawing thumbnails on HiDPI displays. Instead the canvas context is, for reasons that I don't even pretent to understand, manually scaled in PDFThumbnailView._getPageDrawContext, which thus doesn't guarantee that the baseTransform property on the CanvasGraphics-instances becomes correct.

The solution is really simple though, just handle the transform the same way in PDFThumbnailView.draw as in PDFPageView.paintOnCanvas and things should just work.

Fixes #9820

…(issue 9820)

*Note that I wasn't able to reproduce the issue in Firefox, but only in Chromium-browsers.*

The bug, and it's feels almost trivial once you've found it, is that we're not passing the `transform` parameter as intended to `PDFPageProxy.render` when drawing thumbnails on HiDPI displays. Instead the canvas context is, for reasons that I don't even pretent to understand, *manually* scaled in `PDFThumbnailView._getPageDrawContext`, which thus doesn't guarantee that the `baseTransform` property on the `CanvasGraphics`-instances becomes correct.

The solution is really simple though, just handle the `transform` the same way in `PDFThumbnailView.draw` as in `PDFPageView.paintOnCanvas` and things should just work.
@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/8b2644cb0c868a2/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/8b2644cb0c868a2/output.txt

Total script time: 4.13 mins

Published

@timvandermeij timvandermeij merged commit 1bf640b into mozilla:master Nov 14, 2020
@timvandermeij
Copy link
Contributor

Nice find!

@Snuffleupagus Snuffleupagus deleted the thumbnails-render-transform branch November 14, 2020 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scaling of thumbnails does not work with larger files
3 participants