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
Fixed scaling artefacts in paint worklets caused by zoom and hidpi #17499
Fixed scaling artefacts in paint worklets caused by zoom and hidpi #17499
Conversation
Heads up! This PR modifies the following files:
|
r? @glennw |
|
OK, I added a definition to pub fn device_pixel_ratio(&self) -> ScaleFactor<f32, CSSPixel, DevicePixel> {
let mut dppx = self.pres_context().mOverrideDPPX;
if dppx <= 0.0 { dppx = 1.0; }
ScaleFactor::new(dppx)
} |
No, that's not right. That's an override value if someone really needs to override the normal value and have the prescontext pretend like the override is what's going on. The normal value is nsPresContext::AppUnitsPerCSSPixel()/presContext->AppUnitsPerDevPixel() or so. |
@bzbarsky: thanks! |
335eb86
to
73c21e8
Compare
Slightly annoyingly, those functions aren't exported by our Gecko bindings. I think this is equivalent: pub fn device_pixel_ratio(&self) -> ScaleFactor<f32, CSSPixel, DevicePixel> {
let au_per_dpx = self.pres_context().mCurAppUnitsPerDevPixel as f32;
let au_per_px = AU_PER_PX as f32;
ScaleFactor::new(au_per_px / au_per_dpx)
} |
Yes, that seems reasonable. But again, mOverrideDPPX overrides if it's |
73c21e8
to
ee387a5
Compare
Good point. Thanks! |
☔ The latest upstream changes (presumably #17239) made this pull request unmergeable. Please resolve the merge conflicts. |
ec193d7
to
b7e22dd
Compare
@glennw This PR's dependencies have been merged, so it's ready for review! |
☔ The latest upstream changes (presumably #17767) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@asajeffrey r=me on the changes - it'd be good if we could add a reftest either here or as a follow up though (I'm not sure if the reftest harness allows setting dpi ratio though). |
8eb8de3
to
c9c569a
Compare
Squashed. @bors-servo: r=glennw |
📌 Commit c9c569a has been approved by |
Fixed scaling artefacts in paint worklets caused by zoom and hidpi <!-- Please describe your changes on the following line: --> This PR renders paint worklet canvases at the device pixel resolution, rather than the CSS pixel resolution. It's a dependent PR, building on #17239, #17326 and #17364. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #17454 - [X] These changes do not require tests because we don't run reftests with zoom enabled <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17499) <!-- Reviewable:end -->
💔 Test failed - linux-dev |
c9c569a
to
caa3585
Compare
Got build-cef to compile. @bors-servo r=glennw |
📌 Commit caa3585 has been approved by |
Fixed scaling artefacts in paint worklets caused by zoom and hidpi <!-- Please describe your changes on the following line: --> This PR renders paint worklet canvases at the device pixel resolution, rather than the CSS pixel resolution. It's a dependent PR, building on #17239, #17326 and #17364. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #17454 - [X] These changes do not require tests because we don't run reftests with zoom enabled <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17499) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
This PR renders paint worklet canvases at the device pixel resolution, rather than the CSS pixel resolution.
It's a dependent PR, building on #17239, #17326 and #17364.
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is