mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
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.
This commit is contained in:
parent
7652dbd983
commit
5031603cdc
Notes:
sideshowbarker
2024-07-17 01:27:18 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/5031603cdc Pull-request: https://github.com/SerenityOS/serenity/pull/18921
1 changed files with 0 additions and 6 deletions
|
@ -1288,19 +1288,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) {
|
||||
|
|
Loading…
Reference in a new issue