1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

LibGfx: Correctly handle source rect offset in draw_scaled_bitmap

The do_draw_integer_scaled_bitmap() fastpath already handled this
correctly, but the arbitrary scale path did not.
This commit is contained in:
Nico Weber 2021-01-22 10:19:10 -05:00 committed by Andreas Kling
parent d5f403663b
commit 6a78e7e6a8
2 changed files with 3 additions and 1 deletions

View file

@ -843,7 +843,7 @@ ALWAYS_INLINE static void do_draw_scaled_bitmap(Gfx::Bitmap& target, const IntRe
for (int x = clipped_rect.left(); x <= clipped_rect.right(); ++x) {
auto scaled_x = ((x - dst_rect.x()) * hscale) >> 16;
auto scaled_y = ((y - dst_rect.y()) * vscale) >> 16;
auto src_pixel = get_pixel(source, scaled_x, scaled_y);
auto src_pixel = get_pixel(source, scaled_x + src_rect.left(), scaled_y + src_rect.top());
if (has_opacity)
src_pixel.set_alpha(src_pixel.alpha() * opacity);
if constexpr (has_alpha_channel) {