X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-image%2Fanimated-image-visual.h;h=3858f6d104dc0206f4ec761cfb21f5ff17ce3f9a;hb=ab447436de92a2e8bc8cd1393f4807f19ef6b316;hp=5c9b31cbb59c516d34ce630d6a42da2efc1b7b96;hpb=c20463e1d4a77117810c67adfec49bcdfab5efde;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 index 5c9b31c..3858f6d 100644 --- 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) 2021 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,12 +24,14 @@ #include #include #include -#include +#include // INTERNAL INCLUDES #include #include #include +#include +#include namespace Dali { @@ -40,6 +42,7 @@ namespace Toolkit namespace Internal { +class ImageVisualShaderFactory; class AnimatedImageVisual; typedef IntrusivePtr< AnimatedImageVisual > AnimatedImageVisualPtr; @@ -89,46 +92,54 @@ public: * @brief Create the animated image Visual using the image URL. * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object - * @param[in] imageUrl The URL to gif resource to use + * @param[in] shaderFactory The ImageVisualShaderFactory object + * @param[in] imageUrl The URL to animated image 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 /** * @copydoc Visual::Base::GetNaturalSize */ - virtual void GetNaturalSize( Vector2& naturalSize ); + void GetNaturalSize( Vector2& naturalSize ) override; /** * @copydoc Visual::Base::CreatePropertyMap */ - virtual void DoCreatePropertyMap( Property::Map& map ) const; + void DoCreatePropertyMap( Property::Map& map ) const override; /** * @copydoc Visual::Base::CreateInstancePropertyMap */ - virtual void DoCreateInstancePropertyMap( Property::Map& map ) const; + void DoCreateInstancePropertyMap( Property::Map& map ) const override; + + /** + * @copydoc Visual::Base::OnDoAction + */ + void OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes ) override; protected: @@ -136,18 +147,24 @@ 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(). */ - virtual ~AnimatedImageVisual(); + ~AnimatedImageVisual() override; + + /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; /** * @copydoc Visual::Base::DoSetProperties */ - virtual void DoSetProperties( const Property::Map& propertyMap ); + void DoSetProperties( const Property::Map& propertyMap ) override; /** * Helper method to set individual values by index key. @@ -157,19 +174,19 @@ protected: void DoSetProperty( Property::Index index, const Property::Value& value ); /** - * @copydoc Visual::Base::DoSetOnStage + * @copydoc Visual::Base::DoSetOnScene */ - virtual void DoSetOnStage( Actor& actor ); + void DoSetOnScene( Actor& actor ) override; /** - * @copydoc Visual::Base::DoSetOffStage + * @copydoc Visual::Base::DoSetOffScene */ - virtual void DoSetOffStage( Actor& actor ); + void DoSetOffScene( Actor& actor ) override; /** * @copydoc Visual::Base::OnSetTransform */ - virtual void OnSetTransform(); + void OnSetTransform() override; private: /** @@ -204,7 +221,7 @@ private: * Called when the next frame is ready. * @param[in] textureSet the texture set to apply */ - void FrameReady( TextureSet textureSet ); + void FrameReady( TextureSet textureSet ) override; /** * Display the next frame. It is called when the mFrameDelayTimer ticks. @@ -213,10 +230,10 @@ private: bool DisplayNextFrame(); /** - * Initialize the gif variables. - * @param[in] imageUrl The url of the animated gif + * Initialize the animated image variables. + * @param[in] imageUrl The url of the animated image */ - void InitializeGif( const VisualUrl& imageUrl ); + void InitializeAnimatedImage( const VisualUrl& imageUrl ); // Undefined AnimatedImageVisual( const AnimatedImageVisual& animatedImageVisual ); @@ -228,13 +245,13 @@ private: Timer mFrameDelayTimer; WeakHandle mPlacementActor; + ImageVisualShaderFactory& mImageVisualShaderFactory; - // Variables for GIF player - Dali::Vector mFrameDelayContainer; + // Variables for Animated Image player Vector4 mPixelArea; VisualUrl mImageUrl; - std::unique_ptr mGifLoading; // Only needed for animated gifs - uint32_t mCurrentFrameIndex; // Frame index into textureRects + Dali::AnimatedImageLoading mAnimatedImageLoading; // Only needed for animated image + uint32_t mFrameIndexForJumpTo; // Frame index into textureRects // Variables for Multi-Image player ImageCache::UrlList* mImageUrls; @@ -242,6 +259,8 @@ private: uint16_t mCacheSize; uint16_t mBatchSize; uint16_t mFrameDelay; + int16_t mLoopCount; + int16_t mCurrentLoopIndex; uint16_t mUrlIndex; // Shared variables @@ -250,7 +269,10 @@ private: Dali::WrapMode::Type mWrapModeU:3; Dali::WrapMode::Type mWrapModeV:3; + DevelAnimatedImageVisual::Action::Type mActionStatus:3; + DevelImageVisual::StopBehavior::Type mStopBehavior:2; bool mStartFirstFrame:1; + bool mIsJumpTo:1; }; } // namespace Internal