[dali_1.4.35] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / animated-vector-image / vector-rasterize-thread.h
index c1c9c0b..0855f14 100644 (file)
@@ -46,6 +46,8 @@ class VectorRasterizeThread : public Thread
 {
 public:
 
+  using UploadCompletedSignalType = Dali::VectorAnimationRenderer::UploadCompletedSignalType;
+
   /**
    * @brief Constructor.
    *
@@ -94,12 +96,6 @@ public:
   void RenderFrame();
 
   /**
-   * @brief This callback is called after the first frame is ready.
-   * @param[in] callback The resource ready callback
-   */
-  void SetResourceReadyCallback( EventThreadCallback* callback );
-
-  /**
    * @brief This callback is called after the animation is finished.
    * @param[in] callback The animation finished callback
    */
@@ -123,7 +119,7 @@ public:
    * @brief Get the play state
    * @return The play state
    */
-  DevelImageVisual::PlayState GetPlayState() const;
+  DevelImageVisual::PlayState::Type GetPlayState() const;
 
   /**
    * @brief Queries whether the resource is ready.
@@ -155,6 +151,25 @@ public:
    */
   void GetDefaultSize( uint32_t& width, uint32_t& height ) const;
 
+  /**
+   * @brief Sets the stop behavior of the animation. This is performed when the animation is stopped.
+   * @param[in] stopBehavior The stop behavior
+   */
+  void SetStopBehavior( DevelImageVisual::StopBehavior::Type stopBehavior );
+
+  /**
+   * @brief Sets the looping mode.
+   * Animation plays forwards and then restarts from the beginning or runs backwards again.
+   * @param[in] loopingMode The looping mode
+   */
+  void SetLoopingMode( DevelImageVisual::LoopingMode::Type loopingMode );
+
+  /**
+   * @brief Connect to this signal to be notified when the texture upload is completed.
+   * @return The signal to connect to.
+   */
+  UploadCompletedSignalType& UploadCompletedSignal();
+
 protected:
 
   /**
@@ -166,15 +181,20 @@ protected:
 private:
 
   /**
-   * @brief Initialize the vector renderer.
+   * @brief Initializes the vector renderer.
    */
   void Initialize();
 
   /**
-   * @brief Rasterize the current frame.
+   * @brief Rasterizes the current frame.
    */
   void Rasterize();
 
+  /**
+   * @brief Gets the frame number when the animation is stopped according to the stop behavior.
+   */
+  uint32_t GetStoppedFrame( uint32_t startFrame, uint32_t endFrame, uint32_t currentFrame );
+
   // Undefined
   VectorRasterizeThread( const VectorRasterizeThread& thread ) = delete;
 
@@ -183,13 +203,22 @@ private:
 
 private:
 
+  enum class PlayState
+  {
+    STOPPING,  ///< The animation is stopping
+    STOPPED,   ///< The animation has stopped
+    PLAYING,   ///< The animation is playing
+    PAUSED     ///< The animation is paused
+  };
+
   std::string                 mUrl;
   VectorAnimationRenderer     mVectorRenderer;
   ConditionalWait             mConditionalWait;
-  std::unique_ptr< EventThreadCallback > mResourceReadyTrigger;
   std::unique_ptr< EventThreadCallback > mAnimationFinishedTrigger;
   Vector2                     mPlayRange;
-  DevelImageVisual::PlayState mPlayState;
+  PlayState                   mPlayState;
+  DevelImageVisual::StopBehavior::Type mStopBehavior;
+  DevelImageVisual::LoopingMode::Type mLoopingMode;
   int64_t                     mFrameDurationNanoSeconds;
   float                       mFrameRate;
   uint32_t                    mCurrentFrame;
@@ -204,6 +233,8 @@ private:
   bool                        mDestroyThread;  ///< Whether the thread be destroyed
   bool                        mResourceReady;
   bool                        mCurrentFrameUpdated;
+  bool                        mForward;
+  bool                        mUpdateFrameNumber;
   const Dali::LogFactoryInterface& mLogFactory; ///< The log factory
 
 };