Fix cmd::TrimCel() for tilemaps when drawing tiles

This commit is contained in:
David Capello 2020-10-15 15:34:53 -03:00
parent 8b1f887720
commit 0effbacd11

View File

@ -1,5 +1,5 @@
// Aseprite // Aseprite
// Copyright (C) 2019 Igara Studio S.A. // Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2016 David Capello // Copyright (C) 2016 David Capello
// //
// This program is distributed under the terms of // This program is distributed under the terms of
@ -25,14 +25,13 @@ using namespace doc;
TrimCel::TrimCel(Cel* cel) TrimCel::TrimCel(Cel* cel)
{ {
gfx::Rect newBounds; gfx::Rect newBounds = cel->bounds();
if (algorithm::shrink_bounds(cel->image(),
cel->image()->maskColor(), if (algorithm::shrink_cel_bounds(cel,
cel->layer(), newBounds)) { cel->image()->maskColor(),
newBounds.offset(cel->position()); newBounds)) {
if (cel->imageBounds() != newBounds) { if (cel->bounds() != newBounds)
add(new cmd::CropCel(cel, newBounds)); add(new cmd::CropCel(cel, newBounds));
}
} }
else { else {
// Delete the given "cel" and all its links. // Delete the given "cel" and all its links.