mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 05:32:13 +00:00
LibWeb: Make CSS background image painting respect destination origin and transparency
It was previously using draw_tiled_bitmap, which always aligns the tiles with the global origin and does not respect the alpha of the source. Switch to a new Painter::blit_tiled helper which uses Painter::blit under the hood, which has more correct behavior.
This commit is contained in:
parent
e97865e982
commit
c2f3d3afe1
3 changed files with 28 additions and 4 deletions
|
@ -46,10 +46,11 @@ void Box::paint(PaintContext& context, PaintPhase phase)
|
|||
auto padded_rect = this->padded_rect();
|
||||
|
||||
if (phase == PaintPhase::Background && !is_body()) {
|
||||
context.painter().fill_rect(enclosing_int_rect(padded_rect), computed_values().background_color());
|
||||
|
||||
if (background_image() && background_image()->bitmap())
|
||||
context.painter().draw_tiled_bitmap(enclosing_int_rect(padded_rect), *background_image()->bitmap());
|
||||
auto background_rect = enclosing_int_rect(padded_rect);
|
||||
context.painter().fill_rect(background_rect, computed_values().background_color());
|
||||
if (background_image() && background_image()->bitmap()) {
|
||||
context.painter().blit_tiled(background_rect, *background_image()->bitmap(), background_image()->bitmap()->rect());
|
||||
}
|
||||
}
|
||||
|
||||
if (phase == PaintPhase::Border) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue