LibGfx: assert Bitmap::set_pixel does not write out of bounds

This commit is contained in:
Peter Nelson 2020-11-01 16:03:48 +00:00 committed by Andreas Kling
parent 5567408bab
commit 23c4f1a3d4
Notes: sideshowbarker 2024-07-19 01:35:36 +09:00

View file

@ -300,11 +300,13 @@ inline Color Bitmap::get_pixel(int x, int y) const
template<>
inline void Bitmap::set_pixel<StorageFormat::RGB32>(int x, int y, Color color)
{
ASSERT(rect().contains(x, y));
scanline(y)[x] = color.value();
}
template<>
inline void Bitmap::set_pixel<StorageFormat::RGBA32>(int x, int y, Color color)
{
ASSERT(rect().contains(x, y));
scanline(y)[x] = color.value(); // drop alpha
}
inline void Bitmap::set_pixel(int x, int y, Color color)