1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +00:00

LibWeb: Convert border painting to new pixel units

This commit is contained in:
Sam Atkins 2022-10-27 16:02:32 +01:00 committed by Linus Groh
parent 0233627545
commit 0bf4089af9
12 changed files with 135 additions and 140 deletions

View file

@ -49,9 +49,9 @@ void ImagePaintable::paint(PaintContext& context, PaintPhase phase) const
alt = image_element.src();
context.painter().draw_text(enclosing_int_rect(absolute_rect()), alt, Gfx::TextAlignment::Center, computed_values().color(), Gfx::TextElision::Right);
} else if (auto bitmap = layout_box().image_loader().bitmap(layout_box().image_loader().current_frame_index())) {
auto image_rect = absolute_rect().to_rounded<int>();
ScopedCornerRadiusClip corner_clip { context.painter(), image_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };
context.painter().draw_scaled_bitmap(image_rect, *bitmap, bitmap->rect(), 1.0f, to_gfx_scaling_mode(computed_values().image_rendering()));
auto image_rect = context.rounded_device_rect(absolute_rect().to_type<CSSPixels>());
ScopedCornerRadiusClip corner_clip { context, context.painter(), image_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };
context.painter().draw_scaled_bitmap(image_rect.to_type<int>(), *bitmap, bitmap->rect(), 1.0f, to_gfx_scaling_mode(computed_values().image_rendering()));
}
}
}