mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 21:55:07 +00:00
LibHTML: Use ImageLoader for <img> elements to defer bitmap decoding
We now wait until the pixels are actually needed before fully decoding images in <img> elements. This needs some more work and is currently a bit memory-wasteful since we'll hang on to the raw image data forever.
This commit is contained in:
parent
b4c0ea89d5
commit
18fa662eb2
3 changed files with 18 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibDraw/GraphicsBitmap.h>
|
||||
#include <LibDraw/ImageLoader.h>
|
||||
#include <LibHTML/DOM/HTMLElement.h>
|
||||
|
||||
class HTMLImageElement : public HTMLElement {
|
||||
|
@ -16,11 +17,14 @@ public:
|
|||
int preferred_height() const;
|
||||
|
||||
const GraphicsBitmap* bitmap() const;
|
||||
const ImageLoader* image_loader() const { return m_image_loader; }
|
||||
|
||||
private:
|
||||
void load_image(const String& src);
|
||||
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
|
||||
|
||||
RefPtr<ImageLoader> m_image_loader;
|
||||
mutable RefPtr<GraphicsBitmap> m_bitmap;
|
||||
ByteBuffer m_image_data;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue