Fix timeline thumbnail zoom can't scale beyond 1:1 pixels (fix #4974)

Prior this fix when using large thumbnail sizes on the timeline with
smaller cel images, instead of enlarging the thumbnail image to fit
the full area available, it just adds transparent whitespace around
the thumbnail image.
This commit is contained in:
Gaspar Capello 2025-02-11 11:06:23 -03:00
parent bbe656c856
commit 3e3dd2a653

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2019-2020 Igara Studio S.A. // Copyright (C) 2019-2025 Igara Studio S.A.
// Copyright (C) 2018 David Capello // Copyright (C) 2018 David Capello
// Copyright (C) 2016 Carlo Caputo // Copyright (C) 2016 Carlo Caputo
// //
@ -23,13 +23,7 @@ namespace app { namespace thumb {
os::SurfaceRef get_cel_thumbnail(const doc::Cel* cel, const gfx::Size& fitInSize) os::SurfaceRef get_cel_thumbnail(const doc::Cel* cel, const gfx::Size& fitInSize)
{ {
gfx::Size newSize; gfx::Size newSize(gfx::Rect(cel->bounds()).fitIn(gfx::Rect(fitInSize)).size());
if (cel->bounds().w > fitInSize.w || cel->bounds().h > fitInSize.h)
newSize = gfx::Rect(cel->bounds()).fitIn(gfx::Rect(fitInSize)).size();
else
newSize = cel->bounds().size();
if (newSize.w < 1 || newSize.h < 1) if (newSize.w < 1 || newSize.h < 1)
return nullptr; return nullptr;