1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:27:45 +00:00

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

View file

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