#define DALI_TOOLKIT_INTERNAL_ANIMATED_VECTOR_IMAGE_VISUAL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// EXTERNAL INCLUDES
#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/object/weak-handle.h>
-#include <memory>
+#include <dali/public-api/object/property-notification.h>
+#include <dali/public-api/adaptor-framework/window.h>
+#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/integration-api/processor-interface.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-url.h>
#include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-actions-devel.h>
+#include <dali-toolkit/internal/visuals/animated-vector-image/vector-animation-task.h>
namespace Dali
{
{
class ImageVisualShaderFactory;
-class VectorRasterizeThread;
class AnimatedVectorImageVisual;
using AnimatedVectorImageVisualPtr = IntrusivePtr< AnimatedVectorImageVisual >;
* | url | STRING |
*
*/
-class AnimatedVectorImageVisual: public Visual::Base
+class AnimatedVectorImageVisual: public Visual::Base, public ConnectionTracker, public Integration::Processor
{
public:
/**
* @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:
/**
* @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;
+
+protected: // Implementation of Processor
+
+ /**
+ * @copydoc Dali::Integration::Processor::Process()
+ */
+ void Process() override;
private:
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 );
// Undefined
AnimatedVectorImageVisual( const AnimatedVectorImageVisual& visual ) = delete;
AnimatedVectorImageVisual& operator=( const AnimatedVectorImageVisual& visual ) = delete;
private:
- ImageVisualShaderFactory& mImageVisualShaderFactory;
VisualUrl mUrl;
+ VectorAnimationTask::AnimationData mAnimationData;
+ VectorAnimationTaskPtr mVectorAnimationTask;
+ ImageVisualShaderFactory& mImageVisualShaderFactory;
+ PropertyNotification mScaleNotification;
+ PropertyNotification mSizeNotification;
Vector2 mVisualSize;
+ Vector2 mVisualScale;
WeakHandle< Actor > mPlacementActor;
- std::unique_ptr< VectorRasterizeThread > mVectorRasterizeThread;
- DevelAnimatedVectorImageVisual::Action::Type mActionStatus;
+ DevelImageVisual::PlayState::Type mPlayState;
+ bool mRendererAdded;
+ bool mRasterizationTriggered;
};
} // namespace Internal