mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Don't include empty samples in the sprite sheet when the whole sprite is trimmed
We have to include at least one pixel for each sample.
This commit is contained in:
parent
a74cec6369
commit
4bafbe461a
@ -222,8 +222,17 @@ public:
|
||||
return m_bounds->trimmed();
|
||||
}
|
||||
|
||||
void setTrimmedBounds(const gfx::Rect& bounds) { m_bounds->setTrimmedBounds(bounds); }
|
||||
void setInTextureBounds(const gfx::Rect& bounds) { m_bounds->setInTextureBounds(bounds); }
|
||||
void setTrimmedBounds(const gfx::Rect& bounds) {
|
||||
// TODO we cannot assign an empty rectangle (samples that are
|
||||
// completely trimmed out should be included as a sample of size 1x1)
|
||||
ASSERT(!bounds.isEmpty());
|
||||
m_bounds->setTrimmedBounds(bounds);
|
||||
}
|
||||
|
||||
void setInTextureBounds(const gfx::Rect& bounds) {
|
||||
ASSERT(!bounds.isEmpty());
|
||||
m_bounds->setInTextureBounds(bounds);
|
||||
}
|
||||
|
||||
bool isLinked() const { return m_isLinked; }
|
||||
bool isDuplicated() const { return m_isDuplicated; }
|
||||
@ -870,6 +879,8 @@ void DocExporter::captureSamples(Samples& samples,
|
||||
}
|
||||
else {
|
||||
spriteBounds = get_trimmed_bounds(sprite, m_trimByGrid);
|
||||
if (spriteBounds.isEmpty())
|
||||
spriteBounds = gfx::Rect(0, 0, 1, 1);
|
||||
|
||||
// Cache trimmed bounds so we don't have to recalculate them
|
||||
// in the next iteration/preview.
|
||||
|
Loading…
Reference in New Issue
Block a user