src/hbcore/effects/hbeffectanimation.cpp
changeset 5 627c4a0fd0e7
parent 1 f7ac710697a9
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
    21 ** If you have questions regarding the use of this file, please contact
    21 ** If you have questions regarding the use of this file, please contact
    22 ** Nokia at developer.feedback@nokia.com.
    22 ** Nokia at developer.feedback@nokia.com.
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 
    25 
    26 #include <hbglobal.h>
       
    27 #include "hbeffectanimation_p.h"
    26 #include "hbeffectanimation_p.h"
       
    27 #include "hbglobal.h"
    28 #include "hbeffectgroup_p.h"
    28 #include "hbeffectgroup_p.h"
    29 #include "hbeffectdef_p.h"
    29 #include "hbeffectdef_p.h"
    30 #include "hbeffectfxmldata_p.h"
    30 #include "hbeffectfxmldata_p.h"
    31 #include <QGraphicsItem>
    31 #include <QGraphicsItem>
    32 #include <QtDebug>
    32 #include <QtDebug>
    83     if (looping()) {
    83     if (looping()) {
    84         int current = currentTime();
    84         int current = currentTime();
    85 
    85 
    86         if (current > mLoopEnd) {
    86         if (current > mLoopEnd) {
    87             int newCurrentTime = mLoopStart + current - mLoopEnd;
    87             int newCurrentTime = mLoopStart + current - mLoopEnd;
    88             
    88 
    89             // If the calculated new current time is again beyond the loop end,
    89             // If the calculated new current time is again beyond the loop end,
    90             // change it to the loop end to avoid infinite recursion.
    90             // change it to the loop end to avoid infinite recursion.
    91             if (newCurrentTime > mLoopEnd) {
    91             if (newCurrentTime > mLoopEnd) {
    92                 newCurrentTime = mLoopEnd;
    92                 newCurrentTime = mLoopEnd;
    93             }
    93             }
   107 {
   107 {
   108     // Restart loop if the animation is looping
   108     // Restart loop if the animation is looping
   109     if (looping()) {
   109     if (looping()) {
   110         int current = currentTime();
   110         int current = currentTime();
   111         int newCurrentTime = mLoopStart + current - mLoopEnd;
   111         int newCurrentTime = mLoopStart + current - mLoopEnd;
   112         
   112 
   113         // If the calculated new current time is again beyond the loop end,
   113         // If the calculated new current time is again beyond the loop end,
   114         // change it to the loop end to avoid infinite recursion.
   114         // change it to the loop end to avoid infinite recursion.
   115         if (newCurrentTime > mLoopEnd) {
   115         if (newCurrentTime > mLoopEnd) {
   116             newCurrentTime = mLoopEnd;
   116             newCurrentTime = mLoopEnd;
   117         }
   117         }
   118         
   118 
   119         // Temporarily prevent the animation from reacting to update request,
   119         // Temporarily prevent the animation from reacting to update request,
   120         // because start() causes update with time=0 and the loop might start from a later point of time.
   120         // because start() causes update with time=0 and the loop might start from a later point of time.
   121         mInactive = true;
   121         mInactive = true;
   122         // Restart the animation
   122         // Restart the animation
   123         start();
   123         start();