Ensure we render once more when any node property or the node hierarchy changes 25/208625/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 26 Jun 2019 17:44:56 +0000 (18:44 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 26 Jun 2019 17:45:06 +0000 (18:45 +0100)
Change-Id: Id018dc94578084553aeabddfe1c7c3e2ff24365e

automated-tests/src/dali/utc-Dali-Actor.cpp
dali/internal/update/manager/update-manager.cpp

index b8c7e95..d578048 100644 (file)
@@ -7199,3 +7199,30 @@ int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
 
   END_TEST;
 }
+
+int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
+{
+  TestApplication application;
+  auto stage = Stage::GetCurrent();
+
+  tet_infoline( "Ensure we clear the screen when the last actor is removed" );
+
+  Actor actor = CreateRenderableActor();
+  actor.SetSize( 100.0f, 100.0f );
+  stage.Add( actor );
+
+  application.SendNotification();
+  application.Render();
+
+  auto& glAbstraction = application.GetGlAbstraction();
+  const auto clearCountBefore = glAbstraction.GetClearCountCalled();
+
+  actor.SetVisible( false );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
+
+  END_TEST;
+}
index e98f8b7..d2311f9 100644 (file)
@@ -193,8 +193,7 @@ struct UpdateManager::Impl
     previousUpdateScene( false ),
     renderTaskWaiting( false ),
     renderersAdded( false ),
-    surfaceRectChanged( false ),
-    nodeDisconnected( false )
+    surfaceRectChanged( false )
   {
     sceneController = new SceneControllerImpl( renderMessageDispatcher, renderQueue, discardQueue );
 
@@ -300,7 +299,6 @@ struct UpdateManager::Impl
   bool                                 renderTaskWaiting;             ///< A REFRESH_ONCE render task is waiting to be rendered
   bool                                 renderersAdded;                ///< Flag to keep track when renderers have been added to avoid unnecessary processing
   bool                                 surfaceRectChanged;            ///< True if the default surface rect is changed
-  bool                                 nodeDisconnected;              ///< True if a node is disconnected in the current update
 
 private:
 
@@ -410,8 +408,6 @@ void UpdateManager::DisconnectNode( Node* node )
 {
   DALI_LOG_INFO( gLogFilter, Debug::General, "[%x] DisconnectNode\n", node );
 
-  mImpl->nodeDisconnected = true;
-
   Node* parent = node->GetParent();
   DALI_ASSERT_ALWAYS( NULL != parent );
   parent->SetDirtyFlag( NodePropertyFlags::CHILD_DELETED ); // make parent dirty so that render items dont get reused
@@ -938,14 +934,14 @@ uint32_t UpdateManager::Update( float elapsedSeconds,
                      "Update: numberOfRenderTasks(%d), taskListCount(%d), Render Instructions(%d)\n",
                      numberOfRenderTasks, taskListCount, mImpl->renderInstructions.Count( bufferIndex ) );
 
-      // If a node has been disconnected in this update and we do not have any instructions to send, then generate a dummy instruction to force another render
-      if( mImpl->nodeDisconnected && ( mImpl->renderInstructions.Count( bufferIndex ) == 0 ) )
+
+
+      // If any node is dirty, i.e. a property has changed or a child has been deleted, and we do not have any instructions to send, then generate a dummy instruction to force another render
+      if( ( mImpl->nodeDirtyFlags != NodePropertyFlags::NOTHING ) && ( mImpl->renderInstructions.Count( bufferIndex ) == 0 ) )
       {
-        DALI_LOG_INFO( gLogFilter, Debug::General, "Node disconnected, creating dummy instruction\n" );
+        DALI_LOG_INFO( gLogFilter, Debug::General, "Node flags dirty, creating dummy instruction\n" );
         mImpl->renderInstructions.GetNextInstruction( bufferIndex ); // This creates and adds an empty instruction. We do not need to modify it.
       }
-
-      mImpl->nodeDisconnected = false;
     }
   }