1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

LibWeb: Paint bitmaps with rounded_int_rect(), not enclosing_int_rect()

This fixes the issue where an `<img>` set to its native size would
sometimes still appear blurry, because it had a fractional position,
causing `enclosing_int_rect()` to expand by 1px.
This commit is contained in:
Sam Atkins 2021-09-21 15:36:32 +01:00 committed by Andreas Kling
parent 0b7eefd4e5
commit e07cf6f41b
3 changed files with 3 additions and 3 deletions

View file

@ -100,7 +100,7 @@ void CanvasRenderingContext2D::draw_image(const HTMLImageElement& image_element,
Gfx::FloatRect dst_rect = { x, y, (float)image_element.bitmap()->width(), (float)image_element.bitmap()->height() };
auto rect = m_transform.map(dst_rect);
painter->draw_scaled_bitmap(enclosing_int_rect(rect), *image_element.bitmap(), src_rect, 1.0f, Gfx::Painter::ScalingMode::BilinearBlend);
painter->draw_scaled_bitmap(rounded_int_rect(rect), *image_element.bitmap(), src_rect, 1.0f, Gfx::Painter::ScalingMode::BilinearBlend);
}
void CanvasRenderingContext2D::scale(float sx, float sy)