X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-image%2Fanimated-image-visual.h;h=dcd48ce91daf74774ebfb75b76655beea48df8f4;hb=f2608c9be345a239eac3693feb084d51d2a7af11;hp=1e71ba1bdcd01438105d9cd9bb80225915e343ff;hpb=d399196d70fcd9d09e0d15bb17d5c2c4f1bc35ab;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h old mode 100644 new mode 100755 index 1e71ba1..dcd48ce --- a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h +++ b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_ANIMATED_IMAGE_VISUAL_H /* - * Copyright (c) 2017 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. @@ -24,11 +24,13 @@ #include #include #include +#include // INTERNAL INCLUDES #include #include #include +#include namespace Dali { @@ -39,6 +41,7 @@ namespace Toolkit namespace Internal { +class ImageVisualShaderFactory; class AnimatedImageVisual; typedef IntrusivePtr< AnimatedImageVisual > AnimatedImageVisualPtr; @@ -88,29 +91,32 @@ public: * @brief Create the animated image Visual using the image URL. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] shaderFactory The ImageVisualShaderFactory object * @param[in] imageUrl The URL to gif resource to use * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, const VisualUrl& imageUrl, const Property::Map& properties ); + static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties ); /** * @brief Create the animated image Visual using image URLs. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] shaderFactory The ImageVisualShaderFactory object * @param[in] imageUrls A Property::Array containing the URLs to the image resources * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, const Property::Array& imageUrls, const Property::Map& properties ); + static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const Property::Array& imageUrls, const Property::Map& properties ); /** * @brief Create the animated image visual using the image URL. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] shaderFactory The ImageVisualShaderFactory object * @param[in] imageUrl The URL to animated image resource to use */ - static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, const VisualUrl& imageUrl ); + static AnimatedImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl ); public: // from Visual @@ -129,14 +135,20 @@ 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: /** * @brief Constructor. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object + * @param[in] shaderFactory The ImageVisualShaderFactory object */ - AnimatedImageVisual( VisualFactoryCache& factoryCache ); + AnimatedImageVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory ); /** * @brief A reference counted object may only be deleted by calling Unreference(). @@ -184,6 +196,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 ); @@ -193,18 +206,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 ); @@ -214,6 +223,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 ); @@ -225,12 +239,13 @@ private: Timer mFrameDelayTimer; WeakHandle mPlacementActor; + ImageVisualShaderFactory& mImageVisualShaderFactory; // Variables for GIF player - Dali::Vector mTextureRectContainer; Dali::Vector mFrameDelayContainer; Vector4 mPixelArea; VisualUrl mImageUrl; + std::unique_ptr mGifLoading; // Only needed for animated gifs uint32_t mCurrentFrameIndex; // Frame index into textureRects // Variables for Multi-Image player @@ -239,13 +254,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:3; bool mStartFirstFrame:1; };