ExportSpriteSheet: fix getting the best fit size for long animations

This commit is contained in:
David Capello 2014-08-12 08:09:09 -03:00
parent 42399df2c8
commit f0fa34cf4a

View File

@ -84,10 +84,12 @@ namespace {
;
int z = 0;
while (z++ < nframes*2) {
bool fully_contained = false;
while (!fully_contained) { // TODO at this moment we're not
// getting the best fit for less
// freearea, just the first one.
gfx::Region rgn(gfx::Rect(w, h));
int contained_frames = 0;
bool fully_contained = false;
for (int v=0; v+frameh <= h && !fully_contained; v+=frameh) {
for (int u=0; u+framew <= w; u+=framew) {
@ -115,7 +117,7 @@ namespace {
result = fit;
}
if (z & 1) w *= 2;
if ((++z) & 1) w *= 2;
else h *= 2;
}