mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-02 16:33:13 +00:00
LibWeb: Make ImageBox ask ImageProvider for intrinsic size and ratio
This paves the way for ImageProvider to have something vector-based underneath. :^)
This commit is contained in:
parent
4ee1e5b224
commit
8d3240d633
Notes:
sideshowbarker
2024-07-17 05:00:08 +09:00
Author: https://github.com/awesomekling
Commit: 8d3240d633
Pull-request: https://github.com/SerenityOS/serenity/pull/18943
Reviewed-by: https://github.com/winfr34k
9 changed files with 71 additions and 18 deletions
|
@ -37,14 +37,19 @@ int AnimatedBitmapDecodedImageData::frame_duration(size_t frame_index) const
|
|||
return m_frames[frame_index].duration;
|
||||
}
|
||||
|
||||
Optional<int> AnimatedBitmapDecodedImageData::natural_width() const
|
||||
Optional<CSSPixels> AnimatedBitmapDecodedImageData::intrinsic_width() const
|
||||
{
|
||||
return m_frames.first().bitmap->width();
|
||||
}
|
||||
|
||||
Optional<int> AnimatedBitmapDecodedImageData::natural_height() const
|
||||
Optional<CSSPixels> AnimatedBitmapDecodedImageData::intrinsic_height() const
|
||||
{
|
||||
return m_frames.first().bitmap->height();
|
||||
}
|
||||
|
||||
Optional<float> AnimatedBitmapDecodedImageData::intrinsic_aspect_ratio() const
|
||||
{
|
||||
return static_cast<float>(m_frames.first().bitmap->width()) / static_cast<float>(m_frames.first().bitmap->height());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue