mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibGfx: Add Bitmap::begin() / Bitmap::end()
Useful for accessing a bitmap like a linear container.
This commit is contained in:
parent
830fd0d5b2
commit
c24e4acd19
Notes:
sideshowbarker
2024-07-17 01:51:00 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/c24e4acd19 Pull-request: https://github.com/SerenityOS/serenity/pull/18171 Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/gmta
1 changed files with 13 additions and 0 deletions
|
@ -135,6 +135,9 @@ public:
|
|||
[[nodiscard]] ARGB32* scanline(int physical_y);
|
||||
[[nodiscard]] ARGB32 const* scanline(int physical_y) const;
|
||||
|
||||
[[nodiscard]] ARGB32* begin();
|
||||
[[nodiscard]] ARGB32* end();
|
||||
|
||||
[[nodiscard]] IntRect rect() const { return { {}, m_size }; }
|
||||
[[nodiscard]] IntSize size() const { return m_size; }
|
||||
[[nodiscard]] int width() const { return m_size.width(); }
|
||||
|
@ -293,6 +296,16 @@ ALWAYS_INLINE ARGB32 const* Bitmap::scanline(int y) const
|
|||
return reinterpret_cast<ARGB32 const*>(scanline_u8(y));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE ARGB32* Bitmap::begin()
|
||||
{
|
||||
return scanline(0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE ARGB32* Bitmap::end()
|
||||
{
|
||||
return reinterpret_cast<ARGB32*>(reinterpret_cast<u8*>(m_data) + (m_size.height() * m_pitch));
|
||||
}
|
||||
|
||||
template<>
|
||||
ALWAYS_INLINE Color Bitmap::get_pixel<StorageFormat::BGRx8888>(int x, int y) const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue