(Vector) Change properties to get frame numbers
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / animated-vector-image / vector-rasterize-thread.h
index f8d409b..c1c9c0b 100644 (file)
@@ -112,23 +112,12 @@ public:
   void SetLoopCount( int32_t count );
 
   /**
-   * @brief Gets the loop count. -1 means to repeat forever.
-   * @return The number of times to loop
-   */
-  int32_t GetLoopCount() const;
-
-  /**
-   * @brief Set the playing range.
-   * @param[in] range Two values between [0,1] to specify minimum and maximum progress.
+   * @brief Set the playing range in frame number.
+   * @param[in] startFrame The frame number to specify minimum progress.
+   * @param[in] endFrame The frame number to specify maximum progress.
    * The animation will play between those values.
    */
-  void SetPlayRange( Vector2 range );
-
-  /**
-   * @brief Gets the playing range.
-   * @return The play range defined for the animation
-   */
-  Vector2 GetPlayRange() const;
+  void SetPlayRange( uint32_t startFrame, uint32_t endFrame );
 
   /**
    * @brief Get the play state
@@ -142,6 +131,30 @@ public:
    */
   bool IsResourceReady() const;
 
+  /**
+   * @brief Sets the current frame number of the animation.
+   * @param[in] frameNumber The new frame number between [0, the maximum frame number] or between the play range if specified.
+   */
+  void SetCurrentFrameNumber( uint32_t frameNumber );
+
+  /**
+   * @brief Retrieves the current frame number of the animation.
+   * @return The current frame number
+   */
+  uint32_t GetCurrentFrameNumber() const;
+
+  /**
+   * @brief Retrieves the total frame number of the animation.
+   * @return The total frame number
+   */
+  uint32_t GetTotalFrameNumber() const;
+
+  /**
+   * @brief Gets the default size of the file,.
+   * @return The default size of the file
+   */
+  void GetDefaultSize( uint32_t& width, uint32_t& height ) const;
+
 protected:
 
   /**
@@ -153,15 +166,9 @@ protected:
 private:
 
   /**
-   * @brief Called by the rasterize thread which ensures a wait if required.
-   * @return false if the thread should stop.
-   */
-  bool IsThreadReady();
-
-  /**
-   * @brief Start rendering
+   * @brief Initialize the vector renderer.
    */
-  bool StartRender();
+  void Initialize();
 
   /**
    * @brief Rasterize the current frame.
@@ -179,12 +186,12 @@ private:
   std::string                 mUrl;
   VectorAnimationRenderer     mVectorRenderer;
   ConditionalWait             mConditionalWait;
-  Dali::Mutex                 mMutex;
   std::unique_ptr< EventThreadCallback > mResourceReadyTrigger;
   std::unique_ptr< EventThreadCallback > mAnimationFinishedTrigger;
   Vector2                     mPlayRange;
   DevelImageVisual::PlayState mPlayState;
-  float                       mProgress;
+  int64_t                     mFrameDurationNanoSeconds;
+  float                       mFrameRate;
   uint32_t                    mCurrentFrame;
   uint32_t                    mTotalFrame;
   uint32_t                    mStartFrame;
@@ -196,6 +203,7 @@ private:
   bool                        mNeedRender;
   bool                        mDestroyThread;  ///< Whether the thread be destroyed
   bool                        mResourceReady;
+  bool                        mCurrentFrameUpdated;
   const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
 
 };