summaryrefslogtreecommitdiff
path: root/Userland/Demos
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-01-22 15:13:47 -0500
committerAndreas Kling <kling@serenityos.org>2021-01-22 22:13:53 +0100
commit2ec6bbd7a15088c2e56e1450132b05777093e89c (patch)
treef2f4f0c45e27535ca1d5e1392d276f6618a4a364 /Userland/Demos
parent7278ff66051f9b71403c28521c3f07c11d4e8ff5 (diff)
downloadserenity-2ec6bbd7a15088c2e56e1450132b05777093e89c.zip
LibGfx: Add a draw_scaled_bitmap() variant that takes a FloatRect as src_rect
Consider draw_scaled_bitmap({0, 0, 10, 10}, source, {0, 0, 5, 5}). Imagine wanting to split that up into two calls, like e.g. the compositor when redrawing the background with damage rects. You really want to be able to say draw_scaled_bitmap({0, 0, 5, 10}, source, {0, 0, 2.5, 5}) but up to now you couldn't. Now you can. This makes painting very low-res images (such as tile.png) in mode "stretch" work much better.
Diffstat (limited to 'Userland/Demos')
-rw-r--r--Userland/Demos/LibGfxScaleDemo/main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Demos/LibGfxScaleDemo/main.cpp b/Userland/Demos/LibGfxScaleDemo/main.cpp
index e8dffe98f1..72a7c6885a 100644
--- a/Userland/Demos/LibGfxScaleDemo/main.cpp
+++ b/Userland/Demos/LibGfxScaleDemo/main.cpp
@@ -100,8 +100,8 @@ void Canvas::draw(Gfx::Painter& painter)
auto buggie = Gfx::Bitmap::load_from_file("/res/graphics/buggie.png");
painter.blit({ 25, 39 }, *buggie, { 2, 30, 62, 20 });
- painter.draw_scaled_bitmap({ 88, 39, 62 * 2, 20 * 2 }, *buggie, { 2, 30, 62, 20 });
- painter.draw_scaled_bitmap({ 202, 39, 80, 40 }, *buggie, { 2, 30, 62, 20 });
+ painter.draw_scaled_bitmap({ 88, 39, 62 * 2, 20 * 2 }, *buggie, Gfx::IntRect { 2, 30, 62, 20 });
+ painter.draw_scaled_bitmap({ 202, 39, 80, 40 }, *buggie, Gfx::IntRect { 2, 30, 62, 20 });
}
int main(int argc, char** argv)