aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickanimatedsprite.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-12-09 15:09:20 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2014-12-09 15:09:26 +0100
commitff466a1881435f927f5df9ce1e5eac07d5591904 (patch)
tree760e068743e6a8e1cc4ec63bb2f8e7dcef88b3e2 /src/quick/items/qquickanimatedsprite.cpp
parente04822f3c2a6b69b7d75e2039256aa2433c59dd2 (diff)
parent4a3f6e58b591f2fe2204f7cbc1efc8abb0aade74 (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/qml/jsruntime/qv4arraydata.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4globalobject.cpp src/qml/jsruntime/qv4internalclass.cpp src/quick/items/qquicktext_p.h src/quick/items/qquicktextedit_p.h src/quick/items/qquicktextinput_p.h Change-Id: If07e483e03197cb997ef47a9c647a479cdb09f4c
Diffstat (limited to 'src/quick/items/qquickanimatedsprite.cpp')
-rw-r--r--src/quick/items/qquickanimatedsprite.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp
index f144345b6c..4d1d8b251e 100644
--- a/src/quick/items/qquickanimatedsprite.cpp
+++ b/src/quick/items/qquickanimatedsprite.cpp
@@ -628,8 +628,25 @@ void QQuickAnimatedSprite::prepareNextFrame()
qreal w = m_spriteEngine->spriteWidth() / m_sheetSize.width();
qreal h = m_spriteEngine->spriteHeight() / m_sheetSize.height();
- qreal x1 = m_spriteEngine->spriteX() / m_sheetSize.width() + frameAt * w;
- qreal y1 = m_spriteEngine->spriteY() / m_sheetSize.height();
+ qreal x1;
+ qreal y1;
+ if (m_paused) {
+ int spriteY = m_spriteEngine->spriteY();
+ if (reverse) {
+ int rows = m_spriteEngine->maxFrames() * m_spriteEngine->spriteWidth() / m_sheetSize.width();
+ spriteY -= rows * m_spriteEngine->spriteHeight();
+ frameAt = (frameCount - 1) - frameAt;
+ }
+
+ int position = frameAt * m_spriteEngine->spriteWidth() + m_spriteEngine->spriteX();
+ int row = position / m_sheetSize.width();
+
+ x1 = (position - (row * m_sheetSize.width())) / m_sheetSize.width();
+ y1 = (row * m_spriteEngine->spriteHeight() + spriteY) / m_sheetSize.height();
+ } else {
+ x1 = m_spriteEngine->spriteX() / m_sheetSize.width() + frameAt * w;
+ y1 = m_spriteEngine->spriteY() / m_sheetSize.height();
+ }
//### hard-coded 0/1 work because we are the only
// images in the sprite sheet (without this we cannot assume