mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 17:44:56 +09: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
Notes:
sideshowbarker
2024-07-16 23:57:37 +09:00
Author: https://github.com/awesomekling
Commit: 1f907a834f
Pull-request: https://github.com/SerenityOS/serenity/pull/17557
Reviewed-by: https://github.com/linusg
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);
|
VERIFY(sx >= 0 && sy >= 0);
|
||||||
if (sx == 1 && sy == 1)
|
if (sx == 1 && sy == 1)
|
||||||
return NonnullRefPtr { *this };
|
return clone();
|
||||||
|
|
||||||
auto new_bitmap = TRY(Gfx::Bitmap::create(format(), { width() * sx, height() * sy }, scale()));
|
auto new_bitmap = TRY(Gfx::Bitmap::create(format(), { width() * sx, height() * sy }, scale()));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue