Fix DALI_DEBUG_RENDERING crash
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / animated-image / animated-image-visual.h
index 2796c20..0db9154 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_ANIMATED_IMAGE_VISUAL_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/math/vector4.h>
+#include <dali/public-api/object/weak-handle.h>
 #include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/devel-api/adaptor-framework/gif-loading.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
 #include <dali-toolkit/internal/visuals/visual-url.h>
 #include <dali-toolkit/internal/visuals/animated-image/image-cache.h>
+#include <dali-toolkit/devel-api/visuals/animated-image-visual-actions-devel.h>
 
 namespace Dali
 {
@@ -128,6 +131,11 @@ public:  // from Visual
    */
   virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
 
+  /**
+   * @copydoc Visual::Base::OnDoAction
+   */
+  virtual void OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes ) override;
+
 protected:
 
   /**
@@ -183,6 +191,7 @@ private:
   /**
    * Adds the texture set to the renderer, and the renderer to the
    * placement actor, and starts the frame timer
+   * @param[in] textureSet The texture set to apply
    */
   void StartFirstFrame( TextureSet& textureSet );
 
@@ -192,18 +201,14 @@ private:
   TextureSet PrepareTextureSet();
 
   /**
-   * Load the gif image and pack the frames into atlas.
-   * @return The atlas texture.
-   */
-  TextureSet PrepareAnimatedGifImage();
-
-  /**
    * Set the image size from the texture set
+   * @param[in] textureSet The texture set to get the size from
    */
   void SetImageSize( TextureSet& textureSet );
 
   /**
    * Called when the next frame is ready.
+   * @param[in] textureSet the texture set to apply
    */
   void FrameReady( TextureSet textureSet );
 
@@ -213,6 +218,11 @@ private:
    */
   bool DisplayNextFrame();
 
+  /**
+   * Initialize the gif variables.
+   * @param[in] imageUrl The url of the animated gif
+   */
+  void InitializeGif( const VisualUrl& imageUrl );
 
   // Undefined
   AnimatedImageVisual( const AnimatedImageVisual& animatedImageVisual );
@@ -226,10 +236,10 @@ private:
   WeakHandle<Actor> mPlacementActor;
 
   // Variables for GIF player
-  Dali::Vector<Vector4> mTextureRectContainer;
   Dali::Vector<uint32_t> mFrameDelayContainer;
   Vector4 mPixelArea;
   VisualUrl mImageUrl;
+  std::unique_ptr<Dali::GifLoading> mGifLoading; // Only needed for animated gifs
   uint32_t mCurrentFrameIndex; // Frame index into textureRects
 
   // Variables for Multi-Image player
@@ -238,13 +248,17 @@ private:
   uint16_t mCacheSize;
   uint16_t mBatchSize;
   uint16_t mFrameDelay;
+  int16_t mLoopCount;
+  int16_t mCurrentLoopIndex;
   uint16_t mUrlIndex;
 
   // Shared variables
+  uint32_t mFrameCount; // Number of frames
   ImageDimensions mImageSize;
 
   Dali::WrapMode::Type mWrapModeU:3;
   Dali::WrapMode::Type mWrapModeV:3;
+  DevelAnimatedImageVisual::Action::Type mActionStatus:2;
   bool mStartFirstFrame:1;
 };