mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:17:35 +00:00
LibGfx: Add data_size() accessors to Bitmap and CMYKBitmap
These return the size of the data in bytes.
This commit is contained in:
parent
0acc370f7b
commit
11b623b1fd
2 changed files with 9 additions and 2 deletions
|
@ -142,6 +142,7 @@ public:
|
|||
|
||||
[[nodiscard]] ARGB32* begin();
|
||||
[[nodiscard]] ARGB32* end();
|
||||
[[nodiscard]] size_t data_size() const;
|
||||
|
||||
[[nodiscard]] IntRect rect() const { return { {}, m_size }; }
|
||||
[[nodiscard]] IntSize size() const { return m_size; }
|
||||
|
@ -282,7 +283,12 @@ ALWAYS_INLINE ARGB32* Bitmap::begin()
|
|||
|
||||
ALWAYS_INLINE ARGB32* Bitmap::end()
|
||||
{
|
||||
return reinterpret_cast<ARGB32*>(reinterpret_cast<u8*>(m_data) + (m_size.height() * m_pitch));
|
||||
return reinterpret_cast<ARGB32*>(reinterpret_cast<u8*>(m_data) + data_size());
|
||||
}
|
||||
|
||||
ALWAYS_INLINE size_t Bitmap::data_size() const
|
||||
{
|
||||
return m_size.height() * m_pitch;
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue