summaryrefslogtreecommitdiffstats
path: root/src/svg/qsvgtinydocument.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/svg/qsvgtinydocument.cpp')
-rw-r--r--src/svg/qsvgtinydocument.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp
index 21e9e9f..e2cefeb 100644
--- a/src/svg/qsvgtinydocument.cpp
+++ b/src/svg/qsvgtinydocument.cpp
@@ -466,19 +466,20 @@ QMatrix QSvgTinyDocument::matrixForElement(const QString &id) const
int QSvgTinyDocument::currentFrame() const
{
- const qreal runningPercentage = qMin(qreal(m_time.elapsed()) / qreal(m_animationDuration), qreal(1.));
+ double runningPercentage = qMin(m_time.elapsed()/double(m_animationDuration), 1.);
- const int totalFrames = m_fps * m_animationDuration;
+ int totalFrames = m_fps * m_animationDuration;
return int(runningPercentage * totalFrames);
}
void QSvgTinyDocument::setCurrentFrame(int frame)
{
- const int totalFrames = m_fps * m_animationDuration;
- const qreal framePercentage = frame / totalFrames;
- const qreal timeForFrame = m_animationDuration * framePercentage * 1000; //in ms
- const int timeToAdd = int(timeForFrame - m_time.elapsed());
+ int totalFrames = m_fps * m_animationDuration;
+ double framePercentage = frame/double(totalFrames);
+ double timeForFrame = m_animationDuration * framePercentage; //in S
+ timeForFrame *= 1000; //in ms
+ int timeToAdd = int(timeForFrame - m_time.elapsed());
m_time = m_time.addMSecs(timeToAdd);
}