Skip to content

Commit

Permalink
Fix sprite chopping
Browse files Browse the repository at this point in the history
Had some rounding around the wrong way.

Change-Id: I90ea339c35074ca7287c069bdbdd106578b1501b
Reviewed-by: Martin Jones <martin.jones@nokia.com>
  • Loading branch information
Alan Alpert authored and Qt by Nokia committed Dec 20, 2011
1 parent f0c82e7 commit 265fe77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/quick/items/qquickspriteengine.cpp
Expand Up @@ -234,14 +234,14 @@ QImage QQuickSpriteEngine::assembledImage()
struct helper{
static int divRoundUp(int a, int b){return (a+b-1)/b;}
};
int rowsNeeded = helper::divRoundUp(state->frames(), helper::divRoundUp(maxSize, state->frameWidth()));
int rowsNeeded = helper::divRoundUp(state->frames(), (maxSize / state->frameWidth()));
if (rowsNeeded * state->frameHeight() > maxSize){
qWarning() << "SpriteEngine: Animation too large to fit in one texture..." << state->source().toLocalFile();
qWarning() << "SpriteEngine: Your texture max size today is " << maxSize;
}
state->m_generatedCount = rowsNeeded;
h += state->frameHeight() * rowsNeeded;
w = qMax(w, helper::divRoundUp(maxSize, state->frameWidth()));
w = qMax(w, ((int)(maxSize / state->frameWidth())) * state->frameWidth());
m_imageStateCount += rowsNeeded;
}else{
h += state->frameHeight();
Expand Down

0 comments on commit 265fe77

Please sign in to comment.