From: Alan Alpert Date: Fri, 16 Dec 2011 05:23:59 +0000 (+1000) Subject: Fix sprite chopping X-Git-Tag: qt-v5.0.0-alpha1~812 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=265fe7770778b85e174c39c33ecc9431d7f55b75;p=profile%2Fivi%2Fqtdeclarative.git Fix sprite chopping Had some rounding around the wrong way. Change-Id: I90ea339c35074ca7287c069bdbdd106578b1501b Reviewed-by: Martin Jones --- diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp index c25ccf3..ddd667a 100644 --- a/src/quick/items/qquickspriteengine.cpp +++ b/src/quick/items/qquickspriteengine.cpp @@ -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();