X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-vector-image%2Fanimated-vector-image-visual.h;h=c809634515825443e2e2464b10401ff9b3303c46;hp=28d79a4b29c353e36f57be52747931111b23140e;hb=7018f61b640b6fcf9cb576b537bafcb6bb8240e8;hpb=f558388c388bcdf4939ca7af098cbcfc1631ad89 diff --git a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h index 28d79a4..c809634 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h +++ b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_ANIMATED_VECTOR_IMAGE_VISUAL_H /* - * Copyright (c) 2018 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. @@ -19,28 +19,28 @@ */ // EXTERNAL INCLUDES +#include +#include #include +#include #include -#include // INTERNAL INCLUDES +#include +#include +#include #include #include -#include namespace Dali { - namespace Toolkit { - namespace Internal { - class ImageVisualShaderFactory; -class VectorRasterizeThread; class AnimatedVectorImageVisual; -using AnimatedVectorImageVisualPtr = IntrusivePtr< AnimatedVectorImageVisual >; +using AnimatedVectorImageVisualPtr = IntrusivePtr; /** * The visual which renders an animated vector image using VectorAnimationRenderer. @@ -53,10 +53,9 @@ using AnimatedVectorImageVisualPtr = IntrusivePtr< AnimatedVectorImageVisual >; * | url | STRING | * */ -class AnimatedVectorImageVisual: public Visual::Base +class AnimatedVectorImageVisual : public Visual::Base, public ConnectionTracker, public VectorAnimationManager::LifecycleObserver { public: - /** * @brief Create the AnimatedVectorImageVisual using the image URL. * @@ -66,7 +65,7 @@ public: * @param[in] properties A Property::Map containing settings for this visual * @return A smart-pointer to the newly allocated visual. */ - static AnimatedVectorImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties ); + static AnimatedVectorImageVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties); /** * @brief Create the AnimatedVectorImageVisual using the image URL. @@ -76,27 +75,31 @@ public: * @param[in] imageUrl The URL to an animated vector image to use * @return A smart-pointer to the newly allocated visual. */ - static AnimatedVectorImageVisualPtr New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl ); - -public: // from Visual + static AnimatedVectorImageVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl); +public: // from Visual /** * @copydoc Visual::Base::GetNaturalSize */ - virtual void GetNaturalSize( Vector2& naturalSize ) override; + void GetNaturalSize(Vector2& naturalSize) override; /** * @copydoc Visual::Base::CreatePropertyMap */ - virtual void DoCreatePropertyMap( Property::Map& map ) const override; + void DoCreatePropertyMap(Property::Map& map) const override; /** * @copydoc Visual::Base::CreateInstancePropertyMap */ - virtual void DoCreateInstancePropertyMap( Property::Map& map ) const override; + void DoCreateInstancePropertyMap(Property::Map& map) const override; -protected: +protected: // From VectorAnimationManager::LifecycleObserver: + /** + * @copydoc VectorAnimationManager::LifecycleObserver::VectorAnimationManagerDestroyed() + */ + void VectorAnimationManagerDestroyed() override; +protected: /** * @brief Constructor. * @@ -104,73 +107,128 @@ protected: * @param[in] shaderFactory The ImageVisualShaderFactory object * @param[in] imageUrl The URL to an animated vector image to use */ - AnimatedVectorImageVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl ); + AnimatedVectorImageVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl); /** * @brief A reference counted object may only be deleted by calling Unreference(). */ - virtual ~AnimatedVectorImageVisual(); + ~AnimatedVectorImageVisual() override; + + /** + * @copydoc Visual::Base::OnInitialize + */ + void OnInitialize() override; /** * @copydoc Visual::Base::DoSetProperties */ - virtual void DoSetProperties( const Property::Map& propertyMap ) override; + void DoSetProperties(const Property::Map& propertyMap) override; /** - * @copydoc Visual::Base::DoSetOnStage + * @copydoc Visual::Base::DoSetOnScene */ - virtual void DoSetOnStage( Actor& actor ) override; + void DoSetOnScene(Actor& actor) override; /** - * @copydoc Visual::Base::DoSetOffStage + * @copydoc Visual::Base::DoSetOffScene */ - virtual void DoSetOffStage( Actor& actor ) override; + void DoSetOffScene(Actor& actor) override; /** * @copydoc Visual::Base::OnSetTransform */ - virtual void OnSetTransform() override; + void OnSetTransform() override; /** * @copydoc Visual::Base::OnDoAction */ - virtual void OnDoAction( const Property::Index actionId, const Property::Value& attributes ) override; + void OnDoAction(const Property::Index actionId, const Property::Value& attributes) override; private: - /** * Helper method to set individual values by index key. * @param[in] index The index key of the value * @param[in] value The value */ - void DoSetProperty( Property::Index index, const Property::Value& value ); + void DoSetProperty(Property::Index index, const Property::Value& value); /** - * @brief Event callback from rasterize thread. This is called after the first frame is ready. + * @brief Called when the texture upload is completed. */ - void OnResourceReady(); + void OnUploadCompleted(); /** * @brief Event callback from rasterize thread. This is called after the animation is finished. */ void OnAnimationFinished(); + /** + * @brief Send animation data to the rasterize thread. + */ + void SendAnimationData(); + + /** + * @brief Set the vector image size. + */ + void SetVectorImageSize(); + + /** + * @brief Stop the animation. + */ + void StopAnimation(); + + /** + * @brief Trigger rasterization of the vector content. + */ + void TriggerVectorRasterization(); + + /** + * @brief Callback when the world scale factor changes. + */ + void OnScaleNotification(PropertyNotification& source); + + /** + * @brief Callback when the size changes. + */ + void OnSizeNotification(PropertyNotification& source); + + /** + * @brief Callback when the visibility of the actor is changed. + */ + void OnControlVisibilityChanged(Actor actor, bool visible, DevelActor::VisibilityChange::Type type); + + /** + * @brief Callback when the visibility of the window is changed. + */ + void OnWindowVisibilityChanged(Window window, bool visible); + + /** + * @brief Callback when the event is processed. + */ + void OnProcessEvents(); + // Undefined - AnimatedVectorImageVisual( const AnimatedVectorImageVisual& visual ) = delete; + AnimatedVectorImageVisual(const AnimatedVectorImageVisual& visual) = delete; // Undefined - AnimatedVectorImageVisual& operator=( const AnimatedVectorImageVisual& visual ) = delete; + AnimatedVectorImageVisual& operator=(const AnimatedVectorImageVisual& visual) = delete; private: - ImageVisualShaderFactory& mImageVisualShaderFactory; - VisualUrl mUrl; - Vector2 mVisualSize; - Vector2 mPlayRange; - WeakHandle< Actor > mPlacementActor; - std::unique_ptr< VectorRasterizeThread > mVectorRasterizeThread; - - int32_t mLoopCount; - DevelAnimatedVectorImageVisual::Action::Type mActionStatus; + VisualUrl mUrl; + VectorAnimationTask::AnimationData mAnimationData; + VectorAnimationTaskPtr mVectorAnimationTask; + ImageVisualShaderFactory& mImageVisualShaderFactory; + PropertyNotification mScaleNotification; + PropertyNotification mSizeNotification; + Vector2 mVisualSize; + Vector2 mVisualScale; + WeakHandle mPlacementActor; + DevelImageVisual::PlayState::Type mPlayState; + CallbackBase* mEventCallback; // Not owned + bool mLoadFailed; + bool mRendererAdded; + bool mCoreShutdown; + bool mRedrawInScalingDown; }; } // namespace Internal