summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2023-05-19 01:09:06 +0200
committerAndreas Kling <kling@serenityos.org>2023-05-19 06:16:14 +0200
commit2959c2f2eb2c52929ce92a33d2af2367bede40aa (patch)
treec2e193fb8e9c560bc9e5481f8c9e1101720cd5dd
parentb79fd3d1a90f959d71e8d1b56ad9f8c088681e78 (diff)
downloadserenity-2959c2f2eb2c52929ce92a33d2af2367bede40aa.zip
LibGfx: Remove clip check in `Painter::do_draw_scaled_bitmap`
We were performing a check whether source pixels would fall into a clipped rect too early. Since we already clamp the resulting source coordinates to the clipped rect, we can just remove this code.
-rw-r--r--Userland/Libraries/LibGfx/Painter.cpp6
1 files changed, 0 insertions, 6 deletions
diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp
index 5771b6f6d6..f932c6cde9 100644
--- a/Userland/Libraries/LibGfx/Painter.cpp
+++ b/Userland/Libraries/LibGfx/Painter.cpp
@@ -1273,19 +1273,13 @@ ALWAYS_INLINE static void do_draw_scaled_bitmap(Gfx::Bitmap& target, IntRect con
i64 vscale = src_rect.height() * shift / dst_rect.height();
i64 src_left = src_rect.left() * shift;
i64 src_top = src_rect.top() * shift;
- i64 clipped_src_bottom_shifted = (clipped_src_rect.y() + clipped_src_rect.height()) * shift;
- i64 clipped_src_right_shifted = (clipped_src_rect.x() + clipped_src_rect.width()) * shift;
for (int y = clipped_rect.top(); y <= clipped_rect.bottom(); ++y) {
auto* scanline = reinterpret_cast<Color*>(target.scanline(y));
auto desired_y = (y - dst_rect.y()) * vscale + src_top;
- if (desired_y < clipped_src_rect.top() || desired_y > clipped_src_bottom_shifted)
- continue;
for (int x = clipped_rect.left(); x <= clipped_rect.right(); ++x) {
auto desired_x = (x - dst_rect.x()) * hscale + src_left;
- if (desired_x < clipped_src_rect.left() || desired_x > clipped_src_right_shifted)
- continue;
Color src_pixel;
if constexpr (scaling_mode == Painter::ScalingMode::BilinearBlend) {