From 10ef5ef1fff23dbfaf21a7e3fb8360c65ffb23fa Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Fri, 29 Jun 2018 16:55:00 +0900 Subject: [PATCH] Check if the surfarce rect is changed Change-Id: Id2c20944ca990848a3ff841298466e678fa2e74d --- dali/integration-api/core.h | 7 +++++++ dali/internal/common/core-impl.cpp | 3 +++ dali/internal/update/manager/update-manager.cpp | 16 +++++++++++++++- dali/internal/update/manager/update-manager.h | 6 ++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/dali/integration-api/core.h b/dali/integration-api/core.h index 7db841a..39f3416 100644 --- a/dali/integration-api/core.h +++ b/dali/integration-api/core.h @@ -95,6 +95,12 @@ public: bool NeedsNotification() { return needsNotification; } /** + * Query wheter the default surface rect is changed or not. + * @return true if the default surface rect is changed. + */ + bool SurfaceRectChanged() { return surfaceRectChanged; } + + /** * This method is provided so that FPS can be easily calculated with a release version * of Core. * @return the seconds from last frame as float @@ -105,6 +111,7 @@ public: unsigned int keepUpdating; ///< A bitmask of KeepUpdating values bool needsNotification; + bool surfaceRectChanged; float secondsFromLastFrame; }; diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index 7637a27..53378e0 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -227,6 +227,9 @@ void Core::Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, // Check the Notification Manager message queue to set needsNotification status.needsNotification = mNotificationManager->MessagesToProcess(); + // Check if the default surface is changed + status.surfaceRectChanged = mUpdateManager->IsDefaultSurfaceRectChanged(); + // No need to keep update running if there are notifications to process. // Any message to update will wake it up anyways } diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index 6ef46be..1722334 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -201,7 +201,8 @@ struct UpdateManager::Impl animationFinishedDuringUpdate( false ), previousUpdateScene( false ), renderTaskWaiting( false ), - renderersAdded( false ) + renderersAdded( false ), + surfaceRectChanged( false ) { sceneController = new SceneControllerImpl( renderMessageDispatcher, renderQueue, discardQueue ); @@ -306,6 +307,7 @@ struct UpdateManager::Impl bool previousUpdateScene; ///< True if the scene was updated in the previous frame (otherwise it was optimized out) 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 private: @@ -1006,6 +1008,8 @@ void UpdateManager::SetBackgroundColor( const Vector4& color ) void UpdateManager::SetDefaultSurfaceRect( const Rect& rect ) { + mImpl->surfaceRectChanged = true; + typedef MessageValue1< RenderManager, Rect > DerivedType; // Reserve some memory inside the render queue @@ -1046,6 +1050,16 @@ void UpdateManager::SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths ) SortSiblingNodesRecursively( *( mImpl->root ) ); } +bool UpdateManager::IsDefaultSurfaceRectChanged() +{ + bool surfaceRectChanged = mImpl->surfaceRectChanged; + + // Reset the flag + mImpl->surfaceRectChanged = false; + + return surfaceRectChanged; +} + void UpdateManager::AddSampler( OwnerPointer< Render::Sampler >& sampler ) { // Message has ownership of Sampler while in transit from update to render diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index ccecef8..8e381fc 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -597,6 +597,12 @@ public: */ void SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths ); + /** + * Query wheter the default surface rect is changed or not. + * @return true if the default surface rect is changed. + */ + bool IsDefaultSurfaceRectChanged(); + private: // Undefined -- 2.7.4