+ if(mAnimationData.width != width || mAnimationData.height != height)
+ {
+ mAnimationData.width = width;
+ mAnimationData.height = height;
+ mAnimationData.resendFlag |= VectorAnimationTask::RESEND_SIZE;
+ }
+}
+
+void AnimatedVectorImageVisual::StopAnimation()
+{
+ if(mAnimationData.playState != DevelImageVisual::PlayState::STOPPED)
+ {
+ mAnimationData.playState = DevelImageVisual::PlayState::STOPPED;
+ mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE;
+
+ mPlayState = DevelImageVisual::PlayState::STOPPED;
+ }
+}
+
+void AnimatedVectorImageVisual::TriggerVectorRasterization()
+{
+ if(!mEventCallback && !mCoreShutdown)
+ {
+ mEventCallback = MakeCallback(this, &AnimatedVectorImageVisual::OnProcessEvents);
+ auto& vectorAnimationManager = mFactoryCache.GetVectorAnimationManager();
+ vectorAnimationManager.RegisterEventCallback(mEventCallback);
+ Stage::GetCurrent().KeepRendering(0.0f); // Trigger event processing
+ }
+}
+
+void AnimatedVectorImageVisual::OnScaleNotification(PropertyNotification& source)
+{
+ Actor actor = mPlacementActor.GetHandle();
+ if(actor)
+ {
+ Vector3 scale = actor.GetProperty<Vector3>(Actor::Property::WORLD_SCALE);
+
+ if((mVisualScale.width != scale.width || mVisualScale.height != scale.height) && (mRedrawInScalingDown || scale.width >= 1.0f || scale.height >= 1.0f))
+ {
+ mVisualScale.width = scale.width;
+ mVisualScale.height = scale.height;
+
+ DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnScaleNotification: scale = %f, %f [%p]\n", mVisualScale.width, mVisualScale.height, this);
+
+ SetVectorImageSize();
+ SendAnimationData();
+
+ Stage::GetCurrent().KeepRendering(0.0f); // Trigger event processing
+ }
+ }
+}
+
+void AnimatedVectorImageVisual::OnSizeNotification(PropertyNotification& source)
+{
+ Actor actor = mPlacementActor.GetHandle();
+ if(actor)
+ {
+ Vector3 size = actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE);
+
+ if(mVisualSize.width != size.width || mVisualSize.height != size.height)
+ {
+ mVisualSize.width = size.width;
+ mVisualSize.height = size.height;
+
+ DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnSizeNotification: size = %f, %f [%p]\n", mVisualSize.width, mVisualSize.height, this);
+
+ SetVectorImageSize();
+ SendAnimationData();
+
+ Stage::GetCurrent().KeepRendering(0.0f); // Trigger event processing
+ }
+ }
+}
+
+void AnimatedVectorImageVisual::OnControlVisibilityChanged(Actor actor, bool visible, DevelActor::VisibilityChange::Type type)
+{
+ if(!visible)
+ {
+ StopAnimation();
+ TriggerVectorRasterization();
+
+ DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnControlVisibilityChanged: invisibile. Pause animation [%p]\n", this);
+ }
+}
+
+void AnimatedVectorImageVisual::OnWindowVisibilityChanged(Window window, bool visible)
+{
+ if(!visible)
+ {
+ StopAnimation();
+ TriggerVectorRasterization();
+
+ DALI_LOG_INFO(gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnWindowVisibilityChanged: invisibile. Pause animation [%p]\n", this);
+ }
+}
+
+void AnimatedVectorImageVisual::OnProcessEvents()
+{
+ SendAnimationData();
+
+ mEventCallback = nullptr; // The callback will be deleted in the VectorAnimationManager
+}
+
+Shader AnimatedVectorImageVisual::GenerateShader() const
+{
+ Shader shader;
+ if(mImpl->mCustomShader)
+ {
+ shader = Shader::New(mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource().data() : mImpl->mCustomShader->mVertexShader,
+ mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource().data() : mImpl->mCustomShader->mFragmentShader,
+ mImpl->mCustomShader->mHints);
+
+ shader.RegisterProperty(PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT);
+ }
+ else