mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +00:00
LibWeb: Paint 1x1 backgrounds as color fill instead of tiling bitmap
This yields a huge speedup on pages that use this weird but not-entirely-uncommon technique.
This commit is contained in:
@@ -146,4 +146,13 @@ JS::GCPtr<HTML::DecodedImageData> ImageStyleValue::image_data() const
|
||||
return m_image_request->image_data();
|
||||
}
|
||||
|
||||
Optional<Gfx::Color> ImageStyleValue::color_if_single_pixel_bitmap() const
|
||||
{
|
||||
if (auto const* b = bitmap(m_current_frame_index)) {
|
||||
if (b->width() == 1 && b->height() == 1)
|
||||
return b->bitmap().get_pixel(0, 0);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user