[dali_1.4.44] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / animated-vector-image / animated-vector-image-visual.cpp
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/stage.h>
23 #include <dali/devel-api/rendering/renderer-devel.h>
24 #include <dali/devel-api/adaptor-framework/window-devel.h>
25 #include <dali/integration-api/debug.h>
26
27 // INTERNAL INCLUDES
28 #include <dali-toolkit/public-api/visuals/image-visual-properties.h>
29 #include <dali-toolkit/public-api/visuals/visual-properties.h>
30 #include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
31 #include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-signals-devel.h>
32 #include <dali-toolkit/internal/visuals/image-visual-shader-factory.h>
33 #include <dali-toolkit/internal/visuals/visual-factory-cache.h>
34 #include <dali-toolkit/internal/visuals/visual-string-constants.h>
35 #include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
36
37 namespace Dali
38 {
39
40 namespace Toolkit
41 {
42
43 namespace Internal
44 {
45
46 namespace
47 {
48
49 constexpr auto LOOP_FOREVER = -1;
50
51 const Dali::Vector4 FULL_TEXTURE_RECT( 0.f, 0.f, 1.f, 1.f );
52
53 // Flags for re-sending data to the rasterize thread
54 enum Flags
55 {
56   RESEND_PLAY_RANGE    = 1 << 0,
57   RESEND_LOOP_COUNT    = 1 << 1,
58   RESEND_STOP_BEHAVIOR = 1 << 2,
59   RESEND_LOOPING_MODE  = 1 << 3
60 };
61
62 // stop behavior
63 DALI_ENUM_TO_STRING_TABLE_BEGIN( STOP_BEHAVIOR )
64 DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::StopBehavior, CURRENT_FRAME )
65 DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::StopBehavior, FIRST_FRAME )
66 DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::StopBehavior, LAST_FRAME )
67 DALI_ENUM_TO_STRING_TABLE_END( STOP_BEHAVIOR )
68
69 // looping mode
70 DALI_ENUM_TO_STRING_TABLE_BEGIN( LOOPING_MODE )
71 DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::LoopingMode, RESTART )
72 DALI_ENUM_TO_STRING_WITH_SCOPE( Dali::Toolkit::DevelImageVisual::LoopingMode, AUTO_REVERSE )
73 DALI_ENUM_TO_STRING_TABLE_END( LOOPING_MODE )
74
75 #if defined(DEBUG_ENABLED)
76 Debug::Filter* gVectorAnimationLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_VECTOR_ANIMATION" );
77 #endif
78
79 } // unnamed namespace
80
81 AnimatedVectorImageVisualPtr AnimatedVectorImageVisual::New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties )
82 {
83   AnimatedVectorImageVisualPtr visual( new AnimatedVectorImageVisual( factoryCache, shaderFactory, imageUrl ) );
84   visual->SetProperties( properties );
85
86   return visual;
87 }
88
89 AnimatedVectorImageVisualPtr AnimatedVectorImageVisual::New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl )
90 {
91   AnimatedVectorImageVisualPtr visual( new AnimatedVectorImageVisual( factoryCache, shaderFactory, imageUrl ) );
92
93   return visual;
94 }
95
96 AnimatedVectorImageVisual::AnimatedVectorImageVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl )
97 : Visual::Base( factoryCache, Visual::FittingMode::FILL ),
98   mUrl( imageUrl ),
99   mVectorAnimationTask( new VectorAnimationTask( factoryCache, imageUrl.GetUrl() ) ),
100   mImageVisualShaderFactory( shaderFactory ),
101   mVisualSize(),
102   mVisualScale( Vector2::ONE ),
103   mPlacementActor(),
104   mLoopCount( LOOP_FOREVER ),
105   mStartFrame( 0 ),
106   mEndFrame( 0 ),
107   mResendFlag( 0 ),
108   mActionStatus( DevelAnimatedVectorImageVisual::Action::STOP ),
109   mStopBehavior( DevelImageVisual::StopBehavior::CURRENT_FRAME ),
110   mLoopingMode( DevelImageVisual::LoopingMode::RESTART ),
111   mRendererAdded( false )
112 {
113   // the rasterized image is with pre-multiplied alpha format
114   mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
115
116   mVectorAnimationTask->UploadCompletedSignal().Connect( this, &AnimatedVectorImageVisual::OnUploadCompleted );
117   mVectorAnimationTask->SetAnimationFinishedCallback( new EventThreadCallback( MakeCallback( this, &AnimatedVectorImageVisual::OnAnimationFinished ) ) );
118 }
119
120 AnimatedVectorImageVisual::~AnimatedVectorImageVisual()
121 {
122 }
123
124 void AnimatedVectorImageVisual::GetNaturalSize( Vector2& naturalSize )
125 {
126   if( mVisualSize != Vector2::ZERO )
127   {
128     naturalSize = mVisualSize;
129   }
130   else
131   {
132     uint32_t width, height;
133     mVectorAnimationTask->GetDefaultSize( width, height );
134     naturalSize.x = width;
135     naturalSize.y = height;
136   }
137
138   DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::GetNaturalSize: w = %f, h = %f [%p]\n", naturalSize.width, naturalSize.height, this );
139 }
140
141 void AnimatedVectorImageVisual::DoCreatePropertyMap( Property::Map& map ) const
142 {
143   map.Clear();
144   map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::ANIMATED_VECTOR_IMAGE );
145   if( mUrl.IsValid() )
146   {
147     map.Insert( Toolkit::ImageVisual::Property::URL, mUrl.GetUrl() );
148   }
149   map.Insert( Toolkit::DevelImageVisual::Property::LOOP_COUNT, mLoopCount );
150
151   uint32_t startFrame, endFrame;
152   mVectorAnimationTask->GetPlayRange( startFrame, endFrame );
153
154   Property::Array playRange;
155   playRange.PushBack( static_cast< int32_t >( startFrame ) );
156   playRange.PushBack( static_cast< int32_t >( endFrame ) );
157   map.Insert( Toolkit::DevelImageVisual::Property::PLAY_RANGE, playRange );
158
159   map.Insert( Toolkit::DevelImageVisual::Property::PLAY_STATE, static_cast< int32_t >( mVectorAnimationTask->GetPlayState() ) );
160   map.Insert( Toolkit::DevelImageVisual::Property::CURRENT_FRAME_NUMBER, static_cast< int32_t >( mVectorAnimationTask->GetCurrentFrameNumber() ) );
161   map.Insert( Toolkit::DevelImageVisual::Property::TOTAL_FRAME_NUMBER, static_cast< int32_t >( mVectorAnimationTask->GetTotalFrameNumber() ) );
162
163   map.Insert( Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR, mStopBehavior );
164   map.Insert( Toolkit::DevelImageVisual::Property::LOOPING_MODE, mLoopingMode );
165
166   Property::Map layerInfo;
167   mVectorAnimationTask->GetLayerInfo( layerInfo );
168   map.Insert( Toolkit::DevelImageVisual::Property::CONTENT_INFO, layerInfo );
169 }
170
171 void AnimatedVectorImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
172 {
173   // Do nothing
174 }
175
176 void AnimatedVectorImageVisual::DoSetProperties( const Property::Map& propertyMap )
177 {
178   // url already passed in from constructor
179   for( Property::Map::SizeType iter = 0; iter < propertyMap.Count(); ++iter )
180   {
181     KeyValuePair keyValue = propertyMap.GetKeyValue( iter );
182     if( keyValue.first.type == Property::Key::INDEX )
183     {
184       DoSetProperty( keyValue.first.indexKey, keyValue.second );
185     }
186     else
187     {
188        if( keyValue.first == LOOP_COUNT_NAME )
189        {
190           DoSetProperty( Toolkit::DevelImageVisual::Property::LOOP_COUNT, keyValue.second );
191        }
192        else if( keyValue.first == PLAY_RANGE_NAME )
193        {
194           DoSetProperty( Toolkit::DevelImageVisual::Property::PLAY_RANGE, keyValue.second );
195        }
196        else if( keyValue.first == STOP_BEHAVIOR_NAME )
197        {
198           DoSetProperty( Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR, keyValue.second );
199        }
200        else if( keyValue.first == LOOPING_MODE_NAME )
201        {
202           DoSetProperty( Toolkit::DevelImageVisual::Property::LOOPING_MODE, keyValue.second );
203        }
204     }
205   }
206 }
207
208 void AnimatedVectorImageVisual::DoSetProperty( Property::Index index, const Property::Value& value )
209 {
210   switch(index)
211   {
212     case Toolkit::DevelImageVisual::Property::LOOP_COUNT:
213     {
214       int32_t loopCount;
215       if( value.Get( loopCount ) )
216       {
217         mLoopCount = loopCount;
218         mResendFlag |= RESEND_LOOP_COUNT;
219       }
220       break;
221     }
222     case Toolkit::DevelImageVisual::Property::PLAY_RANGE:
223     {
224       Property::Array* array = value.GetArray();
225       if( array )
226       {
227         size_t count = array->Count();
228         if( count >= 2 )
229         {
230           int startFrame, endFrame;
231           int totalFrame = mVectorAnimationTask->GetTotalFrameNumber();
232           array->GetElementAt( 0 ).Get( startFrame );
233           array->GetElementAt( 1 ).Get( endFrame );
234
235           if( startFrame >= 0 && startFrame < totalFrame && endFrame >= 0 && endFrame < totalFrame )
236           {
237             mStartFrame = startFrame;
238             mEndFrame = endFrame;
239             mResendFlag |= RESEND_PLAY_RANGE;
240           }
241           else
242           {
243             DALI_LOG_ERROR( "Invalid play range [%d, %d / %d]\n", startFrame, endFrame, totalFrame );
244           }
245         }
246       }
247       break;
248     }
249     case Toolkit::DevelImageVisual::Property::STOP_BEHAVIOR:
250     {
251       int32_t stopBehavior = mStopBehavior;
252       if( Scripting::GetEnumerationProperty( value, STOP_BEHAVIOR_TABLE, STOP_BEHAVIOR_TABLE_COUNT, stopBehavior ) )
253       {
254         mStopBehavior = DevelImageVisual::StopBehavior::Type( stopBehavior );
255         mResendFlag |= RESEND_STOP_BEHAVIOR;
256       }
257       break;
258     }
259     case Toolkit::DevelImageVisual::Property::LOOPING_MODE:
260     {
261       int32_t loopingMode = mLoopingMode;
262       if( Scripting::GetEnumerationProperty( value, LOOPING_MODE_TABLE, LOOPING_MODE_TABLE_COUNT, loopingMode ) )
263       {
264         mLoopingMode = DevelImageVisual::LoopingMode::Type( loopingMode );
265         mResendFlag |= RESEND_LOOPING_MODE;
266       }
267       break;
268     }
269   }
270 }
271
272 void AnimatedVectorImageVisual::DoSetOnStage( Actor& actor )
273 {
274   Shader shader;
275
276   if( mImpl->mCustomShader )
277   {
278     shader = Shader::New( mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource() : mImpl->mCustomShader->mVertexShader,
279                           mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource() : mImpl->mCustomShader->mFragmentShader,
280                           mImpl->mCustomShader->mHints );
281
282     shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
283   }
284   else
285   {
286     shader = mImageVisualShaderFactory.GetShader( mFactoryCache, false, true );
287   }
288
289   Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
290
291   mImpl->mRenderer = Renderer::New( geometry, shader );
292
293   TextureSet textureSet = TextureSet::New();
294   mImpl->mRenderer.SetTextures( textureSet );
295
296   // Register transform properties
297   mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
298
299   // Defer the rasterisation task until we get given a size (by Size Negotiation algorithm)
300
301   // Hold the weak handle of the placement actor and delay the adding of renderer until the rasterization is finished.
302   mPlacementActor = actor;
303
304   mVectorAnimationTask->SetRenderer( mImpl->mRenderer );
305
306   // Add property notification for scaling & size
307   mScaleNotification = actor.AddPropertyNotification( Actor::Property::WORLD_SCALE, StepCondition( 0.1f, 1.0f ) );
308   mScaleNotification.NotifySignal().Connect( this, &AnimatedVectorImageVisual::OnScaleNotification );
309
310   mSizeNotification = actor.AddPropertyNotification( Actor::Property::SIZE, StepCondition( 3.0f ) );
311   mSizeNotification.NotifySignal().Connect( this, &AnimatedVectorImageVisual::OnSizeNotification );
312
313   DevelActor::VisibilityChangedSignal( actor ).Connect( this, &AnimatedVectorImageVisual::OnControlVisibilityChanged );
314
315   Window window = DevelWindow::Get( actor );
316   if( window )
317   {
318     DevelWindow::VisibilityChangedSignal( window ).Connect( this, &AnimatedVectorImageVisual::OnWindowVisibilityChanged );
319   }
320
321   DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOnStage [%p]\n", this );
322 }
323
324 void AnimatedVectorImageVisual::DoSetOffStage( Actor& actor )
325 {
326   PauseAnimation();
327
328   if( mImpl->mRenderer )
329   {
330     actor.RemoveRenderer( mImpl->mRenderer );
331     mImpl->mRenderer.Reset();
332
333     mRendererAdded = false;
334   }
335
336   // Remove property notification
337   actor.RemovePropertyNotification( mScaleNotification );
338   actor.RemovePropertyNotification( mSizeNotification );
339
340   DevelActor::VisibilityChangedSignal( actor ).Disconnect( this, &AnimatedVectorImageVisual::OnControlVisibilityChanged );
341
342   Window window = DevelWindow::Get( actor );
343   if( window )
344   {
345     DevelWindow::VisibilityChangedSignal( window ).Disconnect( this, &AnimatedVectorImageVisual::OnWindowVisibilityChanged );
346   }
347
348   mPlacementActor.Reset();
349
350   // Reset the visual size to zero so that when adding the actor back to stage the rasterization is forced
351   mVisualSize = Vector2::ZERO;
352   mVisualScale = Vector2::ONE;
353
354   DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOffStage [%p]\n", this );
355 }
356
357 void AnimatedVectorImageVisual::OnSetTransform()
358 {
359   Vector2 visualSize = mImpl->mTransform.GetVisualSize( mImpl->mControlSize );
360
361   if( IsOnStage() && visualSize != mVisualSize )
362   {
363     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnSetTransform: width = %f, height = %f [%p]\n", visualSize.width, visualSize.height, this );
364
365     mVisualSize = visualSize;
366
367     SetVectorImageSize();
368
369     SendAnimationData();
370
371     if( mActionStatus == DevelAnimatedVectorImageVisual::Action::PLAY )
372     {
373       mVectorAnimationTask->PlayAnimation();
374
375       mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY );
376     }
377     else
378     {
379       // Render one frame
380       mVectorAnimationTask->RenderFrame();
381     }
382   }
383 }
384
385 void AnimatedVectorImageVisual::OnDoAction( const Property::Index actionId, const Property::Value& attributes )
386 {
387   // Check if action is valid for this visual type and perform action if possible
388   switch( actionId )
389   {
390     case DevelAnimatedVectorImageVisual::Action::PLAY:
391     {
392       if( IsOnStage() && mVisualSize != Vector2::ZERO )
393       {
394         mVectorAnimationTask->PlayAnimation();
395
396         mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY );
397       }
398       mActionStatus = DevelAnimatedVectorImageVisual::Action::PLAY;
399       break;
400     }
401     case DevelAnimatedVectorImageVisual::Action::PAUSE:
402     {
403       mVectorAnimationTask->PauseAnimation();
404
405       if( mImpl->mRenderer )
406       {
407         mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
408       }
409
410       mActionStatus = DevelAnimatedVectorImageVisual::Action::PAUSE;
411       break;
412     }
413     case DevelAnimatedVectorImageVisual::Action::STOP:
414     {
415       if( mVectorAnimationTask->GetPlayState() != DevelImageVisual::PlayState::STOPPED )
416       {
417         mVectorAnimationTask->StopAnimation();
418       }
419
420       if( mImpl->mRenderer )
421       {
422         mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
423       }
424
425       mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP;
426       break;
427     }
428     case DevelAnimatedVectorImageVisual::Action::JUMP_TO:
429     {
430       int32_t frameNumber;
431       if( attributes.Get( frameNumber ) )
432       {
433         mVectorAnimationTask->SetCurrentFrameNumber( frameNumber );
434
435         if( IsOnStage() && mVectorAnimationTask->GetPlayState() != DevelImageVisual::PlayState::PLAYING )
436         {
437           mVectorAnimationTask->RenderFrame();
438           Stage::GetCurrent().KeepRendering( 0.0f );    // Trigger rendering
439         }
440       }
441       break;
442     }
443     case DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY:
444     {
445       Property::Map* map = attributes.GetMap();
446       if( map )
447       {
448         DoSetProperties( *map );
449
450         SendAnimationData();
451       }
452       break;
453     }
454   }
455 }
456
457 void AnimatedVectorImageVisual::OnUploadCompleted()
458 {
459   // If weak handle is holding a placement actor, it is the time to add the renderer to actor.
460   Actor actor = mPlacementActor.GetHandle();
461   if( actor && !mRendererAdded )
462   {
463     actor.AddRenderer( mImpl->mRenderer );
464     mRendererAdded = true;
465   }
466
467   ResourceReady( Toolkit::Visual::ResourceStatus::READY );
468
469   DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnUploadCompleted: Renderer is added [%p]\n", this );
470 }
471
472 void AnimatedVectorImageVisual::OnAnimationFinished()
473 {
474   DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnAnimationFinished: action state = %d [%p]\n", mActionStatus, this );
475
476   if( mActionStatus != DevelAnimatedVectorImageVisual::Action::STOP )
477   {
478     mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP;
479
480     if( mImpl->mEventObserver )
481     {
482       mImpl->mEventObserver->NotifyVisualEvent( *this, DevelAnimatedVectorImageVisual::Signal::ANIMATION_FINISHED );
483     }
484   }
485
486   if( mImpl->mRenderer )
487   {
488     mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
489   }
490 }
491
492 void AnimatedVectorImageVisual::SendAnimationData()
493 {
494   if( mResendFlag )
495   {
496     bool isPlaying = false;
497     if( mVectorAnimationTask->GetPlayState() == DevelImageVisual::PlayState::PLAYING )
498     {
499       mVectorAnimationTask->PauseAnimation();
500       isPlaying = true;
501     }
502
503     if( mResendFlag & RESEND_LOOP_COUNT )
504     {
505       mVectorAnimationTask->SetLoopCount( mLoopCount );
506     }
507
508     if( mResendFlag & RESEND_PLAY_RANGE )
509     {
510       mVectorAnimationTask->SetPlayRange( mStartFrame, mEndFrame );
511     }
512
513     if( mResendFlag & RESEND_STOP_BEHAVIOR )
514     {
515       mVectorAnimationTask->SetStopBehavior( mStopBehavior );
516     }
517
518     if( mResendFlag & RESEND_LOOPING_MODE )
519     {
520       mVectorAnimationTask->SetLoopingMode( mLoopingMode );
521     }
522
523     if( IsOnStage() )
524     {
525       if( isPlaying )
526       {
527         mVectorAnimationTask->PlayAnimation();
528       }
529       else
530       {
531         mVectorAnimationTask->RenderFrame();
532         Stage::GetCurrent().KeepRendering( 0.0f );
533       }
534     }
535
536     mResendFlag = 0;
537   }
538 }
539
540 void AnimatedVectorImageVisual::SetVectorImageSize()
541 {
542   uint32_t width = static_cast< uint32_t >( mVisualSize.width * mVisualScale.width );
543   uint32_t height = static_cast< uint32_t >( mVisualSize.height * mVisualScale.height );
544
545   mVectorAnimationTask->SetSize( width, height );
546
547   if( IsOnStage() && mVectorAnimationTask->GetPlayState() != DevelImageVisual::PlayState::PLAYING )
548   {
549     mVectorAnimationTask->RenderFrame();
550     Stage::GetCurrent().KeepRendering( 0.0f );    // Trigger rendering
551   }
552 }
553
554 void AnimatedVectorImageVisual::PauseAnimation()
555 {
556   if( mActionStatus == DevelAnimatedVectorImageVisual::Action::PLAY )
557   {
558     mVectorAnimationTask->PauseAnimation();
559
560     mActionStatus = DevelAnimatedVectorImageVisual::Action::PAUSE;
561
562     if( mImpl->mRenderer )
563     {
564       mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
565     }
566   }
567 }
568
569 void AnimatedVectorImageVisual::OnScaleNotification( PropertyNotification& source )
570 {
571   Actor actor = mPlacementActor.GetHandle();
572   if( actor )
573   {
574     Vector3 scale = actor.GetProperty< Vector3 >( Actor::Property::WORLD_SCALE );
575     mVisualScale.width = scale.width;
576     mVisualScale.height = scale.height;
577
578     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnScaleNotification: scale = %f, %f [%p]\n", mVisualScale.width, mVisualScale.height, this );
579
580     SetVectorImageSize();
581   }
582 }
583
584 void AnimatedVectorImageVisual::OnSizeNotification( PropertyNotification& source )
585 {
586   Actor actor = mPlacementActor.GetHandle();
587   if( actor )
588   {
589     Vector3 size = actor.GetCurrentSize();
590     mVisualSize.width = size.width;
591     mVisualSize.height = size.height;
592
593     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnSizeNotification: size = %f, %f [%p]\n", mVisualSize.width, mVisualSize.height, this );
594
595     SetVectorImageSize();
596   }
597 }
598
599 void AnimatedVectorImageVisual::OnControlVisibilityChanged( Actor actor, bool visible, DevelActor::VisibilityChange::Type type )
600 {
601   if( !visible )
602   {
603     PauseAnimation();
604
605     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnControlVisibilityChanged: invisibile. Pause animation [%p]\n", this );
606   }
607 }
608
609 void AnimatedVectorImageVisual::OnWindowVisibilityChanged( Window window, bool visible )
610 {
611   if( !visible )
612   {
613     PauseAnimation();
614
615     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnWindowVisibilityChanged: invisibile. Pause animation [%p]\n", this );
616   }
617 }
618
619 } // namespace Internal
620
621 } // namespace Toolkit
622
623 } // namespace Dali