Skip to content

Commit

Permalink
Fix incorrect padding between frame images when packing sprite sheets (
Browse files Browse the repository at this point in the history
…fix aseprite/aseprite#3993)

Prior to this fix, Export Sprite Sheet incorrectly generated a
shape padding in some frame image when the following options
were chosen:
- Packed sheet type
- Trim Cels
- Spacing > 0
  • Loading branch information
Gasparoken committed Aug 4, 2023
1 parent c182b50 commit 7985c4c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gfx/packing_rects.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// LAF Gfx Library
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2019-2023 Igara Studio S.A.
// Copyright (C) 2001-2014 David Capello
//
// This file is released under the terms of the MIT license.
Expand Down Expand Up @@ -112,14 +112,17 @@ bool PackingRects::pack(const Size& size,
if (token.canceled())
return false;

gfx::Rect possible(m_bounds.x + u, m_bounds.y + v, rc.w, rc.h);
gfx::Rect possible(m_bounds.x + u,
m_bounds.y + v,
rc.w + m_shapePadding,
rc.h + m_shapePadding);
Region::Overlap overlap = rgn.contains(possible);
if (overlap == Region::In) {
rc = possible;
rgn.createSubtraction(
rgn,
gfx::Region(Rect(rc).inflate(m_shapePadding))
gfx::Region(possible)
);
rc = possible.inflate(-m_shapePadding);
goto next_rc;
}
}
Expand Down

0 comments on commit 7985c4c

Please sign in to comment.