From 2e335d3a1e3ad9c6a09bc06f3d7fa9e13efb0053 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Wed, 26 Jun 2019 18:44:56 +0100 Subject: [PATCH] Ensure we render once more when any node property or the node hierarchy changes Change-Id: Id018dc94578084553aeabddfe1c7c3e2ff24365e --- automated-tests/src/dali/utc-Dali-Actor.cpp | 27 +++++++++++++++++++++++++ dali/internal/update/manager/update-manager.cpp | 16 ++++++--------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index b8c7e95..d578048 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -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; +} diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index e98f8b7..d2311f9 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -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; } } -- 2.7.4