diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-11-10 22:42:29 +0200 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-11-10 22:42:29 +0200 |
commit | f5701f0def37fcc0c2b38ae9552eb3a896a34687 (patch) | |
tree | aa9a7ebb39bedb6794f199d94525f5ddfb696308 /src/quick/items/qquickanimatedsprite.cpp | |
parent | da0aac1057552048f59075beb31861a6cc076684 (diff) | |
parent | e24effdceb3a504182ae271200408750991aa94a (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.8' into tqtc/lts-5.15-opensourcev5.15.8-lts-lgpl
Change-Id: I2e0f34eea87c1393dff82f153650eccf5048248f
Diffstat (limited to 'src/quick/items/qquickanimatedsprite.cpp')
-rw-r--r-- | src/quick/items/qquickanimatedsprite.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp index f239f24367..8818bc5608 100644 --- a/src/quick/items/qquickanimatedsprite.cpp +++ b/src/quick/items/qquickanimatedsprite.cpp @@ -894,7 +894,7 @@ void QQuickAnimatedSprite::prepareNextFrame(QSGSpriteNode *node) maybeUpdate(); } - qreal frameCount = d->m_spriteEngine->spriteFrames(); + int frameCount = d->m_spriteEngine->spriteFrames(); bool reverse = d->m_spriteEngine->sprite()->reverse(); if (reverse) frameAt = (frameCount - 1) - frameAt; @@ -931,15 +931,15 @@ void QQuickAnimatedSprite::prepareNextFrame(QSGSpriteNode *node) x2 = x1 - w; y2 = y1; } else { - x2 = 1.0 - w; + x2 = d->m_sheetSize.width() - w; y2 = y1 - h; - if (y2 < 0.0) { + if (y2 < 0) { //the last row may not fill the entire width int maxRowFrames = d->m_sheetSize.width() / d->m_spriteEngine->spriteWidth(); if (d->m_spriteEngine->maxFrames() % maxRowFrames) x2 = ((d->m_spriteEngine->maxFrames() % maxRowFrames) - 1) * w; - y2 = 1.0 - h; + y2 = d->m_sheetSize.height() - h; } } } else { @@ -947,10 +947,10 @@ void QQuickAnimatedSprite::prepareNextFrame(QSGSpriteNode *node) x2 = x1 + w; y2 = y1; } else { - x2 = 0.0; + x2 = 0; y2 = y1 + h; - if (y2 >= 1.0) - y2 = 0.0; + if (y2 >= d->m_sheetSize.height()) + y2 = 0; } } |