summaryrefslogtreecommitdiff
path: root/Userland/Demos
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-01-22 09:22:15 -0500
committerAndreas Kling <kling@serenityos.org>2021-01-22 16:58:41 +0100
commitc98055de753dd462915e35609f64780886cda640 (patch)
tree167429a1037773925536d1ee40484168a089112d /Userland/Demos
parent6a78e7e6a8a4816a3c36e9e7d25102b2b25a8ba6 (diff)
downloadserenity-c98055de753dd462915e35609f64780886cda640.zip
LibGfx: Remove Painter::blit_scaled() in favor of Painter::draw_scaled_bitmap()
draw_scaled_bitmap() has a clearer API (just source and dest rects -- blit_scaled() took those and scale factors and then ignored width and height on the source rect and it was less clear what it was supposed to do), and they do mostly the same thing. The draw_scaled_bitmap() API takes an IntRect as source rect, so it's currently not always possible to split a big draw_scaled_bitmap() into two (or more) smaller draw_scaled_bitmap() calls that do the same thing -- that'd require FloatRects. The compositor kind of wants this to be possible, but there's already a FIXME about this not looking quite right with the previous approach either. draw_scaled_bitmap() handles transparent sources, so after this change wallpapers with transparency will be blended instead of copied. But that seems fine, and if not, the Right Fix for that is to remove the alpha channel from wallpapers after loading them anyways. As an added bonus, draw_scaled_bitmap() already handles display scale, so this fixes window server asserts for background images that are shown as "stretch" (#5017). The window server still asserts for "tile" and "offset" for now though. Calling draw_scaled_bitmap() here exposed a bug in it fixed by #5041. Before that is merged, this change here will cause smearing on the background image when moving windows around.
Diffstat (limited to 'Userland/Demos')
-rw-r--r--Userland/Demos/LibGfxDemo/main.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Demos/LibGfxDemo/main.cpp b/Userland/Demos/LibGfxDemo/main.cpp
index f573318269..f3192f4cc7 100644
--- a/Userland/Demos/LibGfxDemo/main.cpp
+++ b/Userland/Demos/LibGfxDemo/main.cpp
@@ -147,7 +147,7 @@ void Canvas::draw()
auto buggie = Gfx::Bitmap::load_from_file("/res/graphics/buggie.png");
painter.blit({ 280, 280 }, *buggie, buggie->rect(), 0.5);
- painter.blit_scaled({ 360, 280, buggie->rect().width() * 2, buggie->rect().height() * 2 }, *buggie, buggie->rect(), 0.5, 0.5);
+ painter.draw_scaled_bitmap({ 360, 280, buggie->rect().width() * 2, buggie->rect().height() * 2 }, *buggie, buggie->rect());
painter.draw_rect({ 20, 260, 480, 320 }, Color::DarkGray);