mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:07:35 +00:00
LibGfx: Make Bitmap::scaled(1) return a clone
While returning the same image is a cute optimization, it violates the expectation that the returned Bitmap is a new bitmap, not shared with anyone else.
This commit is contained in:
parent
bd5d8e9d35
commit
1f907a834f
1 changed files with 1 additions and 1 deletions
|
@ -343,7 +343,7 @@ ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::scaled(int sx, int sy) const
|
|||
{
|
||||
VERIFY(sx >= 0 && sy >= 0);
|
||||
if (sx == 1 && sy == 1)
|
||||
return NonnullRefPtr { *this };
|
||||
return clone();
|
||||
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::create(format(), { width() * sx, height() * sy }, scale()));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue