1
0
Fork 0
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:
Andreas Kling 2023-02-19 22:24:45 +01:00
parent bd5d8e9d35
commit 1f907a834f
Notes: sideshowbarker 2024-07-16 23:57:37 +09:00

View file

@ -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()));