mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 03:57:15 +02: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:
Notes:
sideshowbarker
2024-07-17 05:00:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/8d3240d633 Pull-request: https://github.com/SerenityOS/serenity/pull/18943 Reviewed-by: https://github.com/winfr34k
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user