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

Better CSS scaling for deviceRixelRatio != 1. #6552

Merged
merged 1 commit into from
Oct 28, 2015

Conversation

yurydelendik
Copy link
Contributor

There are some devices with devicePixelRatio that is equal to 3, 1.5 or sometimes 1.25 (e.g. Windows medium font). Trying harder to better fit native canvas pixels into CSS layout, e.g. for devicePixelRatio==1.25, it will try to create canvas which physical width divisible by 5 and CSS width divisible by 4, hoping that during composition the pixels lay perfectly on screens physical pixels.

@yurydelendik
Copy link
Contributor Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/ddc5b10bb18b785/output.txt

@yurydelendik
Copy link
Contributor Author

@yurydelendik yurydelendik changed the title [WIP] Better CSS scaling for deviceRixelRatio != 1. Better CSS scaling for deviceRixelRatio != 1. Oct 23, 2015
@timvandermeij
Copy link
Contributor

I see a positive response to this patch on the Bugzilla issue. Perhaps @brendandahl can review this patch?

@yurydelendik
Copy link
Contributor Author

The patch is trivial (simple math) -- open for feedback from community, especially Windows users with various scallings set.

@timvandermeij
Copy link
Contributor

This is how it looks for me on Windows 10 x64. Left is the current master, right is this patch. The right side is definitely sharper and the left side is more blurry (click to enlarge).

diff

@@ -238,6 +238,55 @@ function binarySearchFirstItem(items, condition) {
}

/**
* Approximates float number as a fraction using Farley sequence (max order
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you mean the Farey sequence (without an "l")?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks.

timvandermeij added a commit that referenced this pull request Oct 28, 2015
Better CSS scaling for deviceRixelRatio != 1.
@timvandermeij timvandermeij merged commit 335aeb2 into mozilla:master Oct 28, 2015
@timvandermeij
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants