LibWeb: Add optimized painting command for repeated background

With this change, instead of recording a display list item for each
instance of a repeated background, a new DrawRepeatedImmutableBitmap
type is used. This allows the painter to use optimized repeated image
painting and, when the GPU backend is used, avoid re-uploading the image
texture for each repetition.

Some screenshot tests are affected, but there are no visible
regressions.

https://null.com/games/chainstaff works a lof faster with this change.
This commit is contained in:
Aliaksandr Kalenik 2024-07-23 15:36:28 +03:00 committed by Andreas Kling
commit c5afe70f77
Notes: github-actions[bot] 2024-07-24 09:13:52 +00:00
13 changed files with 74 additions and 0 deletions

View file

@ -141,6 +141,11 @@ void ImageStyleValue::paint(PaintContext& context, DevicePixelRect const& dest_r
}
}
Gfx::ImmutableBitmap const* ImageStyleValue::current_frame_bitmap(DevicePixelRect const& dest_rect) const
{
return bitmap(m_current_frame_index, dest_rect.size().to_type<int>());
}
JS::GCPtr<HTML::DecodedImageData> ImageStyleValue::image_data() const
{
if (!m_image_request)