mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
LibWeb: Share decoded images at the Resource level :^)
This patch adds ImageResource as a subclass of Resource. This new class also keeps a Gfx::ImageDecoder so that we can share decoded bitmaps between all clients of an image resource inside LibWeb. With this, we now share both encoded and decoded data for images. :^) I had to change how the purgeable-volatile flag is updated to keep the volatile-images-outside-the-visible-viewport optimization working. HTMLImageElement now inherits from ImageResourceClient (a subclass of ResourceClient with additional image-specific stuff) and informs its ImageResource about whether it's inside the viewport or outside. This is pretty awesome! :^)
This commit is contained in:
parent
1c6e4e04a8
commit
d4ddb0013c
Notes:
sideshowbarker
2024-07-19 05:53:00 +09:00
Author: https://github.com/awesomekling
Commit: d4ddb0013c
14 changed files with 200 additions and 30 deletions
|
@ -30,13 +30,16 @@
|
|||
|
||||
namespace Web {
|
||||
|
||||
NonnullRefPtr<Resource> Resource::create(Badge<ResourceLoader>, const LoadRequest& request)
|
||||
NonnullRefPtr<Resource> Resource::create(Badge<ResourceLoader>, Type type, const LoadRequest& request)
|
||||
{
|
||||
return adopt(*new Resource(request));
|
||||
if (type == Type::Image)
|
||||
return adopt(*new ImageResource(request));
|
||||
return adopt(*new Resource(type, request));
|
||||
}
|
||||
|
||||
Resource::Resource(const LoadRequest& request)
|
||||
Resource::Resource(Type type, const LoadRequest& request)
|
||||
: m_request(request)
|
||||
, m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue