1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-01 11:12:07 +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:
Andreas Kling 2023-05-20 16:27:31 +02:00
parent 4ee1e5b224
commit 8d3240d633
9 changed files with 71 additions and 18 deletions

View file

@ -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());
}
}