mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
LibHTML: Mark image bitmaps outside the visible viewport as volatile
When the visible viewport rect changes, we walk the layout tree and check where each LayoutImage is in relation to the viewport rect. Images outside have their bitmaps marked as volatile. Note that the bitmaps are managed by ImageDecoder objects. If a bitmap is purged by the kernel while volatile, we construct a new ImageDecoder next time we need pixels for the image.
This commit is contained in:
parent
7e068565bc
commit
54bd322881
Notes:
sideshowbarker
2024-07-19 10:48:59 +09:00
Author: https://github.com/awesomekling
Commit: 54bd322881
5 changed files with 38 additions and 2 deletions
|
@ -80,3 +80,17 @@ const GraphicsBitmap* HTMLImageElement::bitmap() const
|
|||
return nullptr;
|
||||
return m_image_decoder->bitmap();
|
||||
}
|
||||
|
||||
void HTMLImageElement::set_volatile(Badge<LayoutDocument>, bool v)
|
||||
{
|
||||
if (!m_image_decoder)
|
||||
return;
|
||||
if (v) {
|
||||
m_image_decoder->set_volatile();
|
||||
return;
|
||||
}
|
||||
bool has_image = m_image_decoder->set_nonvolatile();
|
||||
if (has_image)
|
||||
return;
|
||||
m_image_decoder = ImageDecoder::create(m_encoded_data.data(), m_encoded_data.size());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue