Revert "[Tizen] (Vector) Pause animation when the window is hidden"
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 12 Nov 2019 06:37:33 +0000 (15:37 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 12 Nov 2019 06:37:40 +0000 (15:37 +0900)
This reverts commit 75fa3d844d702b299f7d17f01051d9805a8f86a2.

Change-Id: I7005a41eedc0d37c8968d73b157a69a04c1024e2

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h
automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h

index cf2ccef..1615e62 100644 (file)
@@ -44,7 +44,6 @@ public:
   virtual ~Window() = default;
   static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent);
   FocusChangeSignalType mFocusChangeSignal;
-  DevelWindow::VisibilityChangedSignalType mVisibilityChangedSignal;
 };
 
 } // namespace Adaptor
index 5ee2dcb..9849f60 100644 (file)
@@ -48,9 +48,7 @@ namespace Adaptor
 {
 
 Window::Window( const PositionSize& positionSize )
-: SceneHolder( positionSize ),
-  mFocusChangeSignal(),
-  mVisibilityChangedSignal()
+: SceneHolder( positionSize )
 {
 }
 
@@ -157,11 +155,6 @@ void Window::Raise()
   GetImplementation( *this ).mFocusChangeSignal.Emit(*this, true);
 }
 
-void Window::Hide()
-{
-  GetImplementation( *this ).mVisibilityChangedSignal.Emit( *this, false );
-}
-
 FocusChangeSignalType& Window::FocusChangeSignal()
 {
   return GetImplementation( *this ).mFocusChangeSignal;
@@ -217,11 +210,6 @@ WheelEventSignalType& WheelEventSignal( Window window )
   return GetImplementation( window ).WheelEventSignal();
 }
 
-VisibilityChangedSignalType& VisibilityChangedSignal( Window window )
-{
-  return GetImplementation( window ).mVisibilityChangedSignal;
-}
-
 } // namespace DevelWindow
 
 } // Dali
index 271f885..f261051 100644 (file)
@@ -67,7 +67,6 @@ public:
   void SetBackgroundColor( const Vector4& color );
   Vector4 GetBackgroundColor() const;
   void Raise();
-  void Hide();
   FocusChangeSignalType& FocusChangeSignal();
 
 public:
@@ -84,7 +83,6 @@ typedef Signal< void (const KeyEvent&) > KeyEventSignalType;
 typedef Signal< bool (const KeyEvent&) > KeyEventGeneratedSignalType;
 typedef Signal< void (const TouchData&) > TouchSignalType;
 typedef Signal< void (const WheelEvent&) > WheelEventSignalType;
-typedef Signal< void ( Window, bool ) > VisibilityChangedSignalType;
 
 Dali::Window Get( Actor actor );
 Dali::Window DownCast(  BaseHandle handle );
@@ -94,7 +92,6 @@ KeyEventSignalType& KeyEventSignal( Dali::Window window );
 KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Window window );
 TouchSignalType& TouchSignal( Dali::Window window );
 WheelEventSignalType& WheelEventSignal( Window window );
-VisibilityChangedSignalType& VisibilityChangedSignal( Window window );
 }
 
 } // namespace Dali
index 9f4ac84..096b960 100644 (file)
@@ -29,7 +29,6 @@
 #include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-actions-devel.h>
 #include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-signals-devel.h>
 #include <dali/devel-api/rendering/renderer-devel.h>
-#include <dali/devel-api/adaptor-framework/window-devel.h>
 #include "dummy-control.h"
 
 using namespace Dali;
@@ -1231,10 +1230,10 @@ int UtcDaliAnimatedVectorImageVisualMultipleInstances(void)
   END_TEST;
 }
 
-int UtcDaliAnimatedVectorImageVisualControlVisibilityChanged(void)
+int UtcDaliAnimatedVectorImageVisualVisibilityChanged(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliAnimatedVectorImageVisualControlVisibilityChanged" );
+  tet_infoline( "UtcDaliAnimatedVectorImageVisualVisibilityChanged" );
 
   Property::Map propertyMap;
   propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
@@ -1274,48 +1273,3 @@ int UtcDaliAnimatedVectorImageVisualControlVisibilityChanged(void)
 
   END_TEST;
 }
-
-int UtcDaliAnimatedVectorImageVisualWindowVisibilityChanged(void)
-{
-  ToolkitTestApplication application;
-  tet_infoline( "UtcDaliAnimatedVectorImageVisualWindowVisibilityChanged" );
-
-  Property::Map propertyMap;
-  propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
-             .Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME );
-
-  Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap );
-  DALI_TEST_CHECK( visual );
-
-  DummyControl actor = DummyControl::New( true );
-  DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() );
-  dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
-
-  Vector2 controlSize( 20.f, 30.f );
-  actor.SetSize( controlSize );
-
-  Stage::GetCurrent().Add( actor );
-
-  application.SendNotification();
-  application.Render();
-
-  Property::Map attributes;
-  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
-
-  // Check rendering behavior
-  DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
-  Renderer renderer = actor.GetRendererAt( 0u );
-  DALI_TEST_CHECK( renderer );
-  DALI_TEST_CHECK( renderer.GetProperty< int >( DevelRenderer::Property::RENDERING_BEHAVIOR ) == DevelRenderer::Rendering::CONTINUOUSLY );
-
-  Window window = DevelWindow::Get( actor );
-  window.Hide();
-
-  application.SendNotification();
-  application.Render();
-
-  // Check rendering behavior again
-  DALI_TEST_CHECK( renderer.GetProperty< int >( DevelRenderer::Property::RENDERING_BEHAVIOR ) == DevelRenderer::Rendering::IF_REQUIRED );
-
-  END_TEST;
-}
index ea4dee5..16203e7 100644 (file)
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/common/stage.h>
 #include <dali/devel-api/rendering/renderer-devel.h>
-#include <dali/devel-api/adaptor-framework/window-devel.h>
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -310,23 +309,21 @@ void AnimatedVectorImageVisual::DoSetOnStage( Actor& actor )
   mSizeNotification = actor.AddPropertyNotification( Actor::Property::SIZE, StepCondition( 3.0f ) );
   mSizeNotification.NotifySignal().Connect( this, &AnimatedVectorImageVisual::OnSizeNotification );
 
-  DevelActor::VisibilityChangedSignal( actor ).Connect( this, &AnimatedVectorImageVisual::OnControlVisibilityChanged );
-
-  Window window = DevelWindow::Get( actor );
-  if( window )
-  {
-    DevelWindow::VisibilityChangedSignal( window ).Connect( this, &AnimatedVectorImageVisual::OnWindowVisibilityChanged );
-  }
+  DevelActor::VisibilityChangedSignal( actor ).Connect( this, &AnimatedVectorImageVisual::OnVisibilityChanged );
 
   DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::DoSetOnStage [%p]\n", this );
 }
 
 void AnimatedVectorImageVisual::DoSetOffStage( Actor& actor )
 {
-  PauseAnimation();
+  mVectorAnimationTask->PauseAnimation();
+
+  mActionStatus = DevelAnimatedVectorImageVisual::Action::PAUSE;
 
   if( mImpl->mRenderer )
   {
+    mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
+
     actor.RemoveRenderer( mImpl->mRenderer );
     mImpl->mRenderer.Reset();
 
@@ -337,13 +334,7 @@ void AnimatedVectorImageVisual::DoSetOffStage( Actor& actor )
   actor.RemovePropertyNotification( mScaleNotification );
   actor.RemovePropertyNotification( mSizeNotification );
 
-  DevelActor::VisibilityChangedSignal( actor ).Disconnect( this, &AnimatedVectorImageVisual::OnControlVisibilityChanged );
-
-  Window window = DevelWindow::Get( actor );
-  if( window )
-  {
-    DevelWindow::VisibilityChangedSignal( window ).Disconnect( this, &AnimatedVectorImageVisual::OnWindowVisibilityChanged );
-  }
+  DevelActor::VisibilityChangedSignal( actor ).Connect( this, &AnimatedVectorImageVisual::OnVisibilityChanged );
 
   mPlacementActor.Reset();
 
@@ -551,21 +542,6 @@ void AnimatedVectorImageVisual::SetVectorImageSize()
   }
 }
 
-void AnimatedVectorImageVisual::PauseAnimation()
-{
-  if( mActionStatus == DevelAnimatedVectorImageVisual::Action::PLAY )
-  {
-    mVectorAnimationTask->PauseAnimation();
-
-    mActionStatus = DevelAnimatedVectorImageVisual::Action::PAUSE;
-
-    if( mImpl->mRenderer )
-    {
-      mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
-    }
-  }
-}
-
 void AnimatedVectorImageVisual::OnScaleNotification( PropertyNotification& source )
 {
   Actor actor = mPlacementActor.GetHandle();
@@ -596,23 +572,23 @@ void AnimatedVectorImageVisual::OnSizeNotification( PropertyNotification& source
   }
 }
 
-void AnimatedVectorImageVisual::OnControlVisibilityChanged( Actor actor, bool visible, DevelActor::VisibilityChange::Type type )
+void AnimatedVectorImageVisual::OnVisibilityChanged( Actor actor, bool visible, DevelActor::VisibilityChange::Type type )
 {
   if( !visible )
   {
-    PauseAnimation();
+    if( mActionStatus == DevelAnimatedVectorImageVisual::Action::PLAY )
+    {
+      mVectorAnimationTask->PauseAnimation();
 
-    DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnControlVisibilityChanged: invisibile. Pause animation [%p]\n", this );
-  }
-}
+      if( mImpl->mRenderer )
+      {
+        mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
+      }
 
-void AnimatedVectorImageVisual::OnWindowVisibilityChanged( Window window, bool visible )
-{
-  if( !visible )
-  {
-    PauseAnimation();
+      mActionStatus = DevelAnimatedVectorImageVisual::Action::PAUSE;
 
-    DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnWindowVisibilityChanged: invisibile. Pause animation [%p]\n", this );
+      DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnVisibilityChanged: invisibile. Pause animation [%p]\n", this );
+    }
   }
 }
 
index 9143299..78848d0 100644 (file)
@@ -23,7 +23,6 @@
 #include <dali/public-api/object/weak-handle.h>
 #include <dali/public-api/object/property-notification.h>
 #include <dali/devel-api/actors/actor-devel.h>
-#include <dali/public-api/adaptor-framework/window.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
@@ -168,11 +167,6 @@ private:
   void SetVectorImageSize();
 
   /**
-   * @brief Pause the animation.
-   */
-  void PauseAnimation();
-
-  /**
    * @brief Callback when the world scale factor changes.
    */
   void OnScaleNotification( PropertyNotification& source );
@@ -185,12 +179,7 @@ private:
   /**
    * @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 );
+  void OnVisibilityChanged( Actor actor, bool visible, DevelActor::VisibilityChange::Type type );
 
   // Undefined
   AnimatedVectorImageVisual( const AnimatedVectorImageVisual& visual ) = delete;