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.cpp;h=a2d102a10a768d5f8635ec1bc2477450a5ef8018;hp=2ed0502a7d4bf14fd9bcd5b6f0147c777de0781c;hb=55e5ea8082729deca6f0f43f01aeae8dd51a4bdb;hpb=68523511452901c4ade1f3750a0ac8a20db093da diff --git a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp index 2ed0502..a2d102a 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 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. @@ -19,7 +19,7 @@ #include // EXTERNAL INCLUDES -#include +#include #include #include #include @@ -33,6 +33,7 @@ #include #include #include +#include namespace Dali { @@ -46,19 +47,8 @@ namespace Internal namespace { -constexpr auto LOOP_FOREVER = -1; - const Dali::Vector4 FULL_TEXTURE_RECT( 0.f, 0.f, 1.f, 1.f ); -// Flags for re-sending data to the rasterize thread -enum Flags -{ - RESEND_PLAY_RANGE = 1 << 0, - RESEND_LOOP_COUNT = 1 << 1, - RESEND_STOP_BEHAVIOR = 1 << 2, - RESEND_LOOPING_MODE = 1 << 3 -}; - // stop behavior DALI_ENUM_TO_STRING_TABLE_BEGIN( STOP_BEHAVIOR ) DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::StopBehavior, CURRENT_FRAME ) @@ -94,32 +84,52 @@ AnimatedVectorImageVisualPtr AnimatedVectorImageVisual::New( VisualFactoryCache& } AnimatedVectorImageVisual::AnimatedVectorImageVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl ) -: Visual::Base( factoryCache, Visual::FittingMode::FILL ), +: Visual::Base( factoryCache, Visual::FittingMode::FILL, static_cast( Toolkit::DevelVisual::ANIMATED_VECTOR_IMAGE ) ), mUrl( imageUrl ), + mAnimationData(), mVectorAnimationTask( new VectorAnimationTask( factoryCache, imageUrl.GetUrl() ) ), mImageVisualShaderFactory( shaderFactory ), mVisualSize(), mVisualScale( Vector2::ONE ), - mPlayRange(), mPlacementActor(), - mLoopCount( LOOP_FOREVER ), - mResendFlag( 0 ), - mActionStatus( DevelAnimatedVectorImageVisual::Action::STOP ), - mStopBehavior( DevelImageVisual::StopBehavior::CURRENT_FRAME ), - mLoopingMode( DevelImageVisual::LoopingMode::RESTART ), - mRendererAdded( false ) + mPlayState( DevelImageVisual::PlayState::STOPPED ), + mEventCallback( nullptr ), + mRendererAdded( false ), + mCoreShutdown(false), + mRedrawInScalingDown(true) { // the rasterized image is with pre-multiplied alpha format mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA; mVectorAnimationTask->UploadCompletedSignal().Connect( this, &AnimatedVectorImageVisual::OnUploadCompleted ); mVectorAnimationTask->SetAnimationFinishedCallback( new EventThreadCallback( MakeCallback( this, &AnimatedVectorImageVisual::OnAnimationFinished ) ) ); + + auto& vectorAnimationManager = mFactoryCache.GetVectorAnimationManager(); + vectorAnimationManager.AddObserver(*this); } AnimatedVectorImageVisual::~AnimatedVectorImageVisual() { - // Finalize animation task in the main thread - mVectorAnimationTask->Finalize(); + if( ! mCoreShutdown ) + { + auto& vectorAnimationManager = mFactoryCache.GetVectorAnimationManager(); + vectorAnimationManager.RemoveObserver(*this); + + if( mEventCallback ) + { + mFactoryCache.GetVectorAnimationManager().UnregisterEventCallback( mEventCallback ); + } + + // Finalize animation task and disconnect the signal in the main thread + mVectorAnimationTask->UploadCompletedSignal().Disconnect( this, &AnimatedVectorImageVisual::OnUploadCompleted ); + mVectorAnimationTask->Finalize(); + } +} + +void AnimatedVectorImageVisual::VectorAnimationManagerDestroyed() +{ + // Core is shutting down. Don't talk to the plugin any more. + mCoreShutdown = true; } void AnimatedVectorImageVisual::GetNaturalSize( Vector2& naturalSize ) @@ -147,7 +157,7 @@ void AnimatedVectorImageVisual::DoCreatePropertyMap( Property::Map& map ) const { map.Insert( Toolkit::ImageVisual::Property::URL, mUrl.GetUrl() ); } - map.Insert( Toolkit::DevelImageVisual::Property::LOOP_COUNT, mLoopCount ); + map.Insert( Toolkit::DevelImageVisual::Property::LOOP_COUNT, mAnimationData.loopCount ); uint32_t startFrame, endFrame; mVectorAnimationTask->GetPlayRange( startFrame, endFrame ); @@ -157,12 +167,13 @@ void AnimatedVectorImageVisual::DoCreatePropertyMap( Property::Map& map ) const playRange.PushBack( static_cast< int32_t >( endFrame ) ); map.Insert( Toolkit::DevelImageVisual::Property::PLAY_RANGE, playRange ); - map.Insert( Toolkit::DevelImageVisual::Property::PLAY_STATE, static_cast< int32_t >( mVectorAnimationTask->GetPlayState() ) ); + map.Insert( Toolkit::DevelImageVisual::Property::PLAY_STATE, static_cast< int32_t >( mPlayState ) ); map.Insert( Toolkit::DevelImageVisual::Property::CURRENT_FRAME_NUMBER, static_cast< int32_t >( mVectorAnimationTask->GetCurrentFrameNumber() ) ); map.Insert( Toolkit::DevelImageVisual::Property::TOTAL_FRAME_NUMBER, static_cast< int32_t >( mVectorAnimationTask->GetTotalFrameNumber() ) ); - map.Insert( Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR, mStopBehavior ); - map.Insert( Toolkit::DevelImageVisual::Property::LOOPING_MODE, mLoopingMode ); + map.Insert( Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR, mAnimationData.stopBehavior ); + map.Insert( Toolkit::DevelImageVisual::Property::LOOPING_MODE, mAnimationData.loopingMode ); + map.Insert( Toolkit::DevelImageVisual::Property::REDRAW_IN_SCALING_DOWN, mRedrawInScalingDown ); Property::Map layerInfo; mVectorAnimationTask->GetLayerInfo( layerInfo ); @@ -202,8 +213,14 @@ void AnimatedVectorImageVisual::DoSetProperties( const Property::Map& propertyMa { DoSetProperty( Toolkit::DevelImageVisual::Property::LOOPING_MODE, keyValue.second ); } + else if( keyValue.first == REDRAW_IN_SCALING_DOWN_NAME ) + { + DoSetProperty( Toolkit::DevelImageVisual::Property::REDRAW_IN_SCALING_DOWN, keyValue.second ); + } } } + + TriggerVectorRasterization(); } void AnimatedVectorImageVisual::DoSetProperty( Property::Index index, const Property::Value& value ) @@ -215,59 +232,68 @@ void AnimatedVectorImageVisual::DoSetProperty( Property::Index index, const Prop int32_t loopCount; if( value.Get( loopCount ) ) { - mLoopCount = loopCount; - mResendFlag |= RESEND_LOOP_COUNT; + mAnimationData.loopCount = loopCount; + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_LOOP_COUNT; } break; } case Toolkit::DevelImageVisual::Property::PLAY_RANGE: { - Property::Array* array = value.GetArray(); + const Property::Array* array = value.GetArray(); if( array ) { - mPlayRange = *array; - mResendFlag |= RESEND_PLAY_RANGE; + mAnimationData.playRange = *array; + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_RANGE; } break; } case Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR: { - int32_t stopBehavior = mStopBehavior; + int32_t stopBehavior = mAnimationData.stopBehavior; if( Scripting::GetEnumerationProperty( value, STOP_BEHAVIOR_TABLE, STOP_BEHAVIOR_TABLE_COUNT, stopBehavior ) ) { - mStopBehavior = DevelImageVisual::StopBehavior::Type( stopBehavior ); - mResendFlag |= RESEND_STOP_BEHAVIOR; + mAnimationData.stopBehavior = DevelImageVisual::StopBehavior::Type( stopBehavior ); + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_STOP_BEHAVIOR; } break; } case Toolkit::DevelImageVisual::Property::LOOPING_MODE: { - int32_t loopingMode = mLoopingMode; + int32_t loopingMode = mAnimationData.loopingMode; if( Scripting::GetEnumerationProperty( value, LOOPING_MODE_TABLE, LOOPING_MODE_TABLE_COUNT, loopingMode ) ) { - mLoopingMode = DevelImageVisual::LoopingMode::Type( loopingMode ); - mResendFlag |= RESEND_LOOPING_MODE; + mAnimationData.loopingMode = DevelImageVisual::LoopingMode::Type( loopingMode ); + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_LOOPING_MODE; + } + break; + } + case Toolkit::DevelImageVisual::Property::REDRAW_IN_SCALING_DOWN: + { + bool redraw; + if( value.Get( redraw ) ) + { + mRedrawInScalingDown = redraw; } break; } } } -void AnimatedVectorImageVisual::DoSetOnStage( Actor& actor ) +void AnimatedVectorImageVisual::DoSetOnScene( Actor& actor ) { Shader shader; if( mImpl->mCustomShader ) { - shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource() : mImpl->mCustomShader->mVertexShader, - mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource() : mImpl->mCustomShader->mFragmentShader, + 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 { - shader = mImageVisualShaderFactory.GetShader( mFactoryCache, false, true ); + shader = mImageVisualShaderFactory.GetShader( mFactoryCache, false, true, false ); } Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY ); @@ -302,12 +328,13 @@ void AnimatedVectorImageVisual::DoSetOnStage( Actor& actor ) DevelWindow::VisibilityChangedSignal( window ).Connect( this, &AnimatedVectorImageVisual::OnWindowVisibilityChanged ); } - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOnStage [%p]\n", this ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOnScene [%p]\n", this ); } -void AnimatedVectorImageVisual::DoSetOffStage( Actor& actor ) +void AnimatedVectorImageVisual::DoSetOffScene( Actor& actor ) { StopAnimation(); + SendAnimationData(); if( mImpl->mRenderer ) { @@ -335,14 +362,14 @@ void AnimatedVectorImageVisual::DoSetOffStage( Actor& actor ) mVisualSize = Vector2::ZERO; mVisualScale = Vector2::ONE; - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOffStage [%p]\n", this ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOffScene [%p]\n", this ); } void AnimatedVectorImageVisual::OnSetTransform() { Vector2 visualSize = mImpl->mTransform.GetVisualSize( mImpl->mControlSize ); - if( IsOnStage() && visualSize != mVisualSize ) + if( IsOnScene() && visualSize != mVisualSize ) { DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnSetTransform: width = %f, height = %f [%p]\n", visualSize.width, visualSize.height, this ); @@ -350,19 +377,13 @@ void AnimatedVectorImageVisual::OnSetTransform() SetVectorImageSize(); - SendAnimationData(); - - if( mActionStatus == DevelAnimatedVectorImageVisual::Action::PLAY ) - { - mVectorAnimationTask->PlayAnimation(); - - mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY ); - } - else + if( mPlayState == DevelImageVisual::PlayState::PLAYING && mAnimationData.playState != DevelImageVisual::PlayState::PLAYING ) { - // Render one frame - mVectorAnimationTask->RenderFrame(); + mAnimationData.playState = DevelImageVisual::PlayState::PLAYING; + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE; } + + SendAnimationData(); } } @@ -373,40 +394,35 @@ void AnimatedVectorImageVisual::OnDoAction( const Property::Index actionId, cons { case DevelAnimatedVectorImageVisual::Action::PLAY: { - if( IsOnStage() && mVisualSize != Vector2::ZERO ) + if( IsOnScene() && mVisualSize != Vector2::ZERO ) { - mVectorAnimationTask->PlayAnimation(); - - mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY ); + if( mAnimationData.playState != DevelImageVisual::PlayState::PLAYING ) + { + mAnimationData.playState = DevelImageVisual::PlayState::PLAYING; + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE; + } } - mActionStatus = DevelAnimatedVectorImageVisual::Action::PLAY; + mPlayState = DevelImageVisual::PlayState::PLAYING; break; } case DevelAnimatedVectorImageVisual::Action::PAUSE: { - mVectorAnimationTask->PauseAnimation(); - - if( mImpl->mRenderer ) + if( mAnimationData.playState == DevelImageVisual::PlayState::PLAYING ) { - mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED ); + mAnimationData.playState = DevelImageVisual::PlayState::PAUSED; + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE; } - - mActionStatus = DevelAnimatedVectorImageVisual::Action::PAUSE; + mPlayState = DevelImageVisual::PlayState::PAUSED; break; } case DevelAnimatedVectorImageVisual::Action::STOP: { - if( mVectorAnimationTask->GetPlayState() != DevelImageVisual::PlayState::STOPPED ) - { - mVectorAnimationTask->StopAnimation(); - } - - if( mImpl->mRenderer ) + if( mAnimationData.playState != DevelImageVisual::PlayState::STOPPED ) { - mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED ); + mAnimationData.playState = DevelImageVisual::PlayState::STOPPED; + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE; } - - mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP; + mPlayState = DevelImageVisual::PlayState::STOPPED; break; } case DevelAnimatedVectorImageVisual::Action::JUMP_TO: @@ -414,28 +430,23 @@ void AnimatedVectorImageVisual::OnDoAction( const Property::Index actionId, cons int32_t frameNumber; if( attributes.Get( frameNumber ) ) { - mVectorAnimationTask->SetCurrentFrameNumber( frameNumber ); - - if( IsOnStage() && mVectorAnimationTask->GetPlayState() != DevelImageVisual::PlayState::PLAYING ) - { - mVectorAnimationTask->RenderFrame(); - Stage::GetCurrent().KeepRendering( 0.0f ); // Trigger rendering - } + mAnimationData.currentFrame = frameNumber; + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_CURRENT_FRAME; } break; } case DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY: { - Property::Map* map = attributes.GetMap(); + const Property::Map* map = attributes.GetMap(); if( map ) { DoSetProperties( *map ); - - SendAnimationData(); } break; } } + + TriggerVectorRasterization(); } void AnimatedVectorImageVisual::OnUploadCompleted() @@ -455,11 +466,13 @@ void AnimatedVectorImageVisual::OnUploadCompleted() void AnimatedVectorImageVisual::OnAnimationFinished() { - DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnAnimationFinished: action state = %d [%p]\n", mActionStatus, this ); + DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnAnimationFinished: action state = %d [%p]\n", mPlayState, this ); - if( mActionStatus != DevelAnimatedVectorImageVisual::Action::STOP ) + if( mPlayState != DevelImageVisual::PlayState::STOPPED ) { - mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP; + mPlayState = DevelImageVisual::PlayState::STOPPED; + + mAnimationData.playState = DevelImageVisual::PlayState::STOPPED; if( mImpl->mEventObserver ) { @@ -475,49 +488,23 @@ void AnimatedVectorImageVisual::OnAnimationFinished() void AnimatedVectorImageVisual::SendAnimationData() { - if( mResendFlag ) + if( mAnimationData.resendFlag ) { - bool isPlaying = false; - if( mVectorAnimationTask->GetPlayState() == DevelImageVisual::PlayState::PLAYING ) - { - mVectorAnimationTask->PauseAnimation(); - isPlaying = true; - } + mVectorAnimationTask->SetAnimationData( mAnimationData ); - if( mResendFlag & RESEND_LOOP_COUNT ) - { - mVectorAnimationTask->SetLoopCount( mLoopCount ); - } - - if( mResendFlag & RESEND_PLAY_RANGE ) - { - mVectorAnimationTask->SetPlayRange( mPlayRange ); - } - - if( mResendFlag & RESEND_STOP_BEHAVIOR ) - { - mVectorAnimationTask->SetStopBehavior( mStopBehavior ); - } - - if( mResendFlag & RESEND_LOOPING_MODE ) - { - mVectorAnimationTask->SetLoopingMode( mLoopingMode ); - } - - if( IsOnStage() ) + if( mImpl->mRenderer ) { - if( isPlaying ) + if( mAnimationData.playState == DevelImageVisual::PlayState::PLAYING ) { - mVectorAnimationTask->PlayAnimation(); + mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY ); } else { - mVectorAnimationTask->RenderFrame(); - Stage::GetCurrent().KeepRendering( 0.0f ); + mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED ); } } - mResendFlag = 0; + mAnimationData.resendFlag = 0; } } @@ -526,27 +513,30 @@ void AnimatedVectorImageVisual::SetVectorImageSize() uint32_t width = static_cast< uint32_t >( mVisualSize.width * mVisualScale.width ); uint32_t height = static_cast< uint32_t >( mVisualSize.height * mVisualScale.height ); - mVectorAnimationTask->SetSize( width, height ); - - if( IsOnStage() && mVectorAnimationTask->GetPlayState() != DevelImageVisual::PlayState::PLAYING ) - { - mVectorAnimationTask->RenderFrame(); - Stage::GetCurrent().KeepRendering( 0.0f ); // Trigger rendering - } + mAnimationData.width = width; + mAnimationData.height = height; + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_SIZE; } void AnimatedVectorImageVisual::StopAnimation() { - if( mActionStatus != DevelAnimatedVectorImageVisual::Action::STOP ) + if( mAnimationData.playState != DevelImageVisual::PlayState::STOPPED ) { - mVectorAnimationTask->StopAnimation(); + mAnimationData.playState = DevelImageVisual::PlayState::STOPPED; + mAnimationData.resendFlag |= VectorAnimationTask::RESEND_PLAY_STATE; - mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP; + mPlayState = DevelImageVisual::PlayState::STOPPED; + } +} - if( mImpl->mRenderer ) - { - mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED ); - } +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 } } @@ -556,12 +546,19 @@ void AnimatedVectorImageVisual::OnScaleNotification( PropertyNotification& sourc if( actor ) { Vector3 scale = actor.GetProperty< Vector3 >( Actor::Property::WORLD_SCALE ); - 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 ); + if(mRedrawInScalingDown || scale.width >= 1.0f || scale.height >= 1.0f) + { + mVisualScale.width = scale.width; + mVisualScale.height = scale.height; - SetVectorImageSize(); + 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 + } } } @@ -570,13 +567,16 @@ void AnimatedVectorImageVisual::OnSizeNotification( PropertyNotification& source Actor actor = mPlacementActor.GetHandle(); if( actor ) { - Vector3 size = actor.GetCurrentSize(); + Vector3 size = actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ); 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 } } @@ -585,6 +585,7 @@ void AnimatedVectorImageVisual::OnControlVisibilityChanged( Actor actor, bool vi if( !visible ) { StopAnimation(); + TriggerVectorRasterization(); DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnControlVisibilityChanged: invisibile. Pause animation [%p]\n", this ); } @@ -595,11 +596,19 @@ void AnimatedVectorImageVisual::OnWindowVisibilityChanged( Window window, bool v 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 +} + } // namespace Internal } // namespace Toolkit