mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibGfx: Use Checked::multiplication_would_overflow()
This commit is contained in:
parent
63b8c6913c
commit
acf2061837
Notes:
sideshowbarker
2024-07-19 07:34:14 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/acf20618378
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)
|
||||
return true;
|
||||
Checked<size_t> size_in_bytes = static_cast<size_t>(size.width());
|
||||
size_in_bytes *= size.height();
|
||||
size_in_bytes *= Bitmap::bpp_for_format(format);
|
||||
return size_in_bytes.has_overflow();
|
||||
return Checked<size_t>::multiplication_would_overflow(size.width(), size.height(), Bitmap::bpp_for_format(format));
|
||||
}
|
||||
|
||||
RefPtr<Bitmap> Bitmap::create(BitmapFormat format, const Size& size)
|
||||
|
|
Loading…
Add table
Reference in a new issue