summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/AbstractView.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-01-19 12:10:47 -0500
committerAndreas Kling <kling@serenityos.org>2021-01-20 10:28:27 +0100
commit5f9c42c404a5acfa66461a3c6568592f5326e9de (patch)
tree9d29f3caeea87721d8ec9a3d754e526bb5d253b9 /Userland/Libraries/LibGUI/AbstractView.cpp
parentc6726f331ea53bc7ee5679a84c6c10af65428a4b (diff)
downloadserenity-5f9c42c404a5acfa66461a3c6568592f5326e9de.zip
LibGfx: Give Bitmap a scale factor
Gfx::Bitmap can now store its scale factor. Normally it's 1, but in high dpi mode it can be 2. If a Bitmap with a scale factor of 2 is blitted to a Painter with scale factor of 2, the pixels can be copied over without any resampling. (When blitting a Bitmap with a scale factor of 1 to a Painter with scale factor of 2, the Bitmap is painted at twice its width and height at paint time. Blitting a Bitmap with a scale factor of 2 to a Painter with scale factor 1 is not supported.) A Bitmap with scale factor of 2 reports the same width() and height() as one with scale factor 1. That's important because many places in the codebase use a bitmap's width() and height() to layout Widgets, and all widget coordinates are in logical coordinates as well, per Documentation/HighDPI.md. Bitmap grows physical_width() / physical_height() to access the actual pixel size. Update a few callers that work with pixels to call this instead. Make Painter's constructor take its scale factor from the target bitmap that's passed in, and update its various blit() methods to handle blitting a 2x bitmap to a 2x painter. This allows removing some gnarly code in Compositor. (In return, put some new gnarly code in LibGfxScaleDemo to preserve behavior there.) No intended behavior change.
Diffstat (limited to 'Userland/Libraries/LibGUI/AbstractView.cpp')
0 files changed, 0 insertions, 0 deletions