mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-17 08:43:11 +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();
|
return m_bounds->trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTrimmedBounds(const gfx::Rect& bounds) { m_bounds->setTrimmedBounds(bounds); }
|
void setTrimmedBounds(const gfx::Rect& bounds) {
|
||||||
void setInTextureBounds(const gfx::Rect& bounds) { m_bounds->setInTextureBounds(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 isLinked() const { return m_isLinked; }
|
||||||
bool isDuplicated() const { return m_isDuplicated; }
|
bool isDuplicated() const { return m_isDuplicated; }
|
||||||
@ -870,6 +879,8 @@ void DocExporter::captureSamples(Samples& samples,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
spriteBounds = get_trimmed_bounds(sprite, m_trimByGrid);
|
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
|
// Cache trimmed bounds so we don't have to recalculate them
|
||||||
// in the next iteration/preview.
|
// in the next iteration/preview.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user