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

[raster] Fix glitchy/pixelated rendering of rasters on high DPI screens #56047

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

nirvn
Copy link
Contributor

@nirvn nirvn commented Jan 29, 2024

Description

This PR fixes a pretty bad regression we've been suffering from since we enabled Qt's auto scaling on high DPI environment whereas raster (of all types: geotiffs, XYZ rasters, etc.) would render pixelated on high DPI screens.

Here's a before (left) vs. fixed (right) with a simple OSM XYZ layer:
before_vs_after2

As mentioned above, this was not only tiled layers though. Here's a before (left) vs. fixed (right) with a geotiff:
image

Fixes #55644

@github-actions github-actions bot added this to the 3.36.0 milestone Jan 29, 2024
Copy link

github-actions bot commented Jan 29, 2024

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit b0974ab)

@nirvn nirvn added backport release-3_34 Rasters Related to general raster layer handling (not specific data formats) labels Jan 29, 2024
Copy link

Tests failed for Qt 5

One or more tests failed using the build from commit e2f64fb

different_dpi_target_vector_hdpi

different_dpi_target_vector_hdpi

Test failed at test_different_dpi_target_vector at tests/src/python/test_selective_masking.py:1117

Rendered image did not match tests/testdata/control_images/selective_masking/different_dpi_target_vector_hdpi/different_dpi_target_vector_hdpi.png (found 683 pixels different)

The full test report (included comparison of rendered vs expected images) can be found here.

Further documentation on the QGIS test infrastructure can be found in the Developer's Guide.

@@ -95,6 +95,7 @@ def updateMask(control_image_path, rendered_image_path, mask_image_path):
if not control_image:
error(f'Could not read control image {control_image_path}')

print(rendered_image_path)
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove

@nirvn nirvn enabled auto-merge (rebase) January 30, 2024 10:32
@nirvn nirvn merged commit 960391d into qgis:master Jan 30, 2024
29 checks passed
@qgis-bot
Copy link
Collaborator

The backport to release-3_34 failed:

The process '/usr/bin/git' failed with exit code 1
stderr
error: could not apply b0974abc2c1... Update test masks, fix clang-tidy warnings
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

stdout
Auto-merging src/core/raster/qgsrasterdrawer.cpp
Auto-merging src/core/raster/qgsrasterlayerrenderer.cpp
[backport-56047-to-release-3_34 5ea298a8010] [raster] Fix glitchy/pixelated rendering of rasters on high DPI screens
 Author: Mathieu Pellerin <nirvn.asia@gmail.com>
 Date: Mon Jan 29 10:18:59 2024 +0700
 3 files changed, 15 insertions(+), 17 deletions(-)
Auto-merging src/core/raster/qgsrasterdrawer.cpp
Auto-merging src/core/raster/qgsrasterlayerrenderer.cpp
warning: Cannot merge binary files: tests/testdata/control_images/selective_masking/different_dpi_target_vector_hdpi/different_dpi_target_vector_hdpi_mask.png (HEAD vs. b0974abc2c1 (Update test masks, fix clang-tidy warnings))
Auto-merging tests/testdata/control_images/selective_masking/different_dpi_target_vector_hdpi/different_dpi_target_vector_hdpi_mask.png
CONFLICT (content): Merge conflict in tests/testdata/control_images/selective_masking/different_dpi_target_vector_hdpi/different_dpi_target_vector_hdpi_mask.png

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release-3_34 release-3_34
# Navigate to the new working tree
cd .worktrees/backport-release-3_34
# Create a new branch
git switch --create backport-56047-to-release-3_34
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick e2f64fb4102274d53d2d0c6f576c27c87fb54cc0,b0974abc2c14bc471a81b9d2f3ae0a09cb6fee25
# Push it to GitHub
git push --set-upstream origin backport-56047-to-release-3_34
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release-3_34

Then, create a pull request where the base branch is release-3_34 and the compare/head branch is backport-56047-to-release-3_34.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release-3_34 failed backport The automated backport attempt failed, needs a manual backport Rasters Related to general raster layer handling (not specific data formats)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tileservers always blurry
3 participants