mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 23:39:02 +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
|
@ -72,7 +72,7 @@ void ResourceLoader::load_sync(const URL& url, Function<void(const ByteBuffer&,
|
|||
|
||||
static HashMap<LoadRequest, NonnullRefPtr<Resource>> s_resource_cache;
|
||||
|
||||
RefPtr<Resource> ResourceLoader::load_resource(const LoadRequest& request)
|
||||
RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, const LoadRequest& request)
|
||||
{
|
||||
if (!request.is_valid())
|
||||
return nullptr;
|
||||
|
@ -83,7 +83,7 @@ RefPtr<Resource> ResourceLoader::load_resource(const LoadRequest& request)
|
|||
return it->value;
|
||||
}
|
||||
|
||||
auto resource = Resource::create({}, request);
|
||||
auto resource = Resource::create({}, type, request);
|
||||
|
||||
s_resource_cache.set(request, resource);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue