mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 14:27:35 +00:00
LibGfx: Use Checked::multiplication_would_overflow()
This commit is contained in:
parent
63b8c6913c
commit
acf2061837
1 changed files with 1 additions and 4 deletions
|
@ -43,10 +43,7 @@ static bool size_would_overflow(BitmapFormat format, const Size& size)
|
||||||
{
|
{
|
||||||
if (size.width() < 0 || size.height() < 0)
|
if (size.width() < 0 || size.height() < 0)
|
||||||
return true;
|
return true;
|
||||||
Checked<size_t> size_in_bytes = static_cast<size_t>(size.width());
|
return Checked<size_t>::multiplication_would_overflow(size.width(), size.height(), Bitmap::bpp_for_format(format));
|
||||||
size_in_bytes *= size.height();
|
|
||||||
size_in_bytes *= Bitmap::bpp_for_format(format);
|
|
||||||
return size_in_bytes.has_overflow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<Bitmap> Bitmap::create(BitmapFormat format, const Size& size)
|
RefPtr<Bitmap> Bitmap::create(BitmapFormat format, const Size& size)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue