LibGfx+LibWeb: Add DecodedImageFrame

Decoded image data should not continue to traffic in ImmutableBitmap now
that the bitmap wrapper is being retired. Introduce DecodedImageFrame as
the paintable decoded-image unit and store a Bitmap plus ColorSpace in
it directly.

Thread the new frame type through decoded image data, display-list
image commands, filters, canvas drawImage, patterns, WebGL texture
upload, and CSS/SVG image consumers. ImmutableBitmap remains only at
the legacy boundaries that still need it, such as HTML video snapshots
and callers that explicitly ask for a bitmap snapshot.

This keeps color-space ownership with the decoded frame while making
the expensive or legacy ImmutableBitmap path explicit at the few call
sites that still need it.
This commit is contained in:
Aliaksandr Kalenik
2026-05-05 13:52:33 +02:00
committed by Gregory Bertilson
parent 3c25d080b1
commit 40f2abb7fe
Notes: github-actions[bot] 2026-05-05 19:40:35 +00:00
53 changed files with 368 additions and 214 deletions

View File

@@ -8,6 +8,7 @@
#include <LibCore/Timer.h>
#include <LibGC/Weak.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/DecodedImageFrame.h>
#include <LibGfx/ImmutableBitmap.h>
#include <LibWeb/ARIA/Roles.h>
#include <LibWeb/Bindings/HTMLImageElement.h>
@@ -248,8 +249,10 @@ RefPtr<Gfx::ImmutableBitmap> HTMLImageElement::immutable_bitmap() const
RefPtr<Gfx::ImmutableBitmap> HTMLImageElement::default_image_bitmap_sized(Gfx::IntSize size) const
{
if (auto data = m_current_request->image_data())
return data->bitmap(0, size);
if (auto data = m_current_request->image_data()) {
if (auto frame = data->frame(0, size))
return Gfx::ImmutableBitmap::create(frame->bitmap_ref());
}
return nullptr;
}
@@ -281,8 +284,10 @@ Optional<CSSPixelFraction> HTMLImageElement::intrinsic_aspect_ratio() const
RefPtr<Gfx::ImmutableBitmap> HTMLImageElement::current_image_bitmap_sized(Gfx::IntSize size) const
{
if (auto data = m_current_request->image_data())
return data->bitmap(m_current_frame_index, size);
if (auto data = m_current_request->image_data()) {
if (auto frame = data->frame(m_current_frame_index, size))
return Gfx::ImmutableBitmap::create(frame->bitmap_ref());
}
return nullptr;
}