#include <dali/internal/update/controllers/render-message-dispatcher.h>
#include <dali/internal/update/controllers/scene-controller-impl.h>
#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
+#include <dali/internal/update/manager/frame-callback-processor.h>
#include <dali/internal/update/manager/render-task-processor.h>
#include <dali/internal/update/manager/sorted-layers.h>
#include <dali/internal/update/manager/update-algorithms.h>
shaders(),
panGestureProcessor( NULL ),
messageQueue( renderController, sceneGraphBuffers ),
+ frameCallbackProcessor( NULL ),
keepRenderingSeconds( 0.0f ),
nodeDirtyFlags( TransformFlag ), // set to TransformFlag to ensure full update the first time through Update()
frameCounter( 0 ),
+ renderingBehavior( DevelStage::Rendering::IF_REQUIRED ),
animationFinishedDuringUpdate( false ),
previousUpdateScene( false ),
renderTaskWaiting( false ),
- renderersAdded( false )
+ renderersAdded( false ),
+ surfaceRectChanged( false )
{
sceneController = new SceneControllerImpl( renderMessageDispatcher, renderQueue, discardQueue );
delete sceneController;
}
+ /**
+ * Lazy init for FrameCallbackProcessor.
+ */
+ FrameCallbackProcessor& GetFrameCallbackProcessor()
+ {
+ if( ! frameCallbackProcessor )
+ {
+ frameCallbackProcessor = new FrameCallbackProcessor( transformManager, *root );
+ }
+ return *frameCallbackProcessor;
+ }
+
SceneGraphBuffers sceneGraphBuffers; ///< Used to keep track of which buffers are being written or read
RenderMessageDispatcher renderMessageDispatcher; ///< Used for passing messages to the render-thread
NotificationManager& notificationManager; ///< Queues notification messages for the event-thread.
std::vector<Internal::ShaderDataPtr> updateCompiledShaders; ///< Shaders to be sent from Update to Event
Mutex compiledShaderMutex; ///< lock to ensure no corruption on the renderCompiledShaders
+ OwnerPointer<FrameCallbackProcessor> frameCallbackProcessor; ///< Owned FrameCallbackProcessor, only created if required.
+
float keepRenderingSeconds; ///< Set via Dali::Stage::KeepRendering
int nodeDirtyFlags; ///< cumulative node dirty flags from previous frame
int frameCounter; ///< Frame counter used in debugging to choose which frame to debug and which to ignore.
+ DevelStage::Rendering renderingBehavior; ///< Set via DevelStage::SetRenderingBehavior
+
bool animationFinishedDuringUpdate; ///< Flag whether any animations finished during the Update()
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:
//Update the transformations of all the nodes
mImpl->transformManager.Update();
+ // Call the frame-callback-processor if set
+ if( mImpl->frameCallbackProcessor )
+ {
+ mImpl->frameCallbackProcessor->Update( bufferIndex, elapsedSeconds );
+ }
+
//Process Property Notifications
ProcessPropertyNotifications( bufferIndex );
unsigned int keepUpdatingRequest = KeepUpdating::NOT_REQUESTED;
+ // If the rendering behavior is set to continuously render, then continue to render.
// If Stage::KeepRendering() has been called, then continue until the duration has elapsed.
// Keep updating until no messages are received and no animations are running.
// If an animation has just finished, update at least once more for Discard end-actions.
// No need to check for renderQueue as there is always a render after update and if that
// render needs another update it will tell the adaptor to call update again
- if ( mImpl->keepRenderingSeconds > 0.0f )
+ if ( ( mImpl->renderingBehavior == DevelStage::Rendering::CONTINUOUSLY ) ||
+ ( mImpl->keepRenderingSeconds > 0.0f ) )
{
keepUpdatingRequest |= KeepUpdating::STAGE_KEEP_RENDERING;
}
void UpdateManager::SetDefaultSurfaceRect( const Rect<int>& rect )
{
+ mImpl->surfaceRectChanged = true;
+
typedef MessageValue1< RenderManager, Rect<int> > DerivedType;
// Reserve some memory inside the render queue
mImpl->keepRenderingSeconds = std::max( mImpl->keepRenderingSeconds, durationSeconds );
}
+void UpdateManager::SetRenderingBehavior( DevelStage::Rendering renderingBehavior )
+{
+ mImpl->renderingBehavior = renderingBehavior;
+}
+
void UpdateManager::SetLayerDepths( const SortedLayerPointers& layers, bool systemLevel )
{
if ( !systemLevel )
SortSiblingNodesRecursively( *( mImpl->root ) );
}
+bool UpdateManager::IsDefaultSurfaceRectChanged()
+{
+ bool surfaceRectChanged = mImpl->surfaceRectChanged;
+
+ // Reset the flag
+ mImpl->surfaceRectChanged = false;
+
+ return surfaceRectChanged;
+}
+
+void UpdateManager::AddFrameCallback( FrameCallbackInterface* frameCallback, const Node* rootNode )
+{
+ mImpl->GetFrameCallbackProcessor().AddFrameCallback( frameCallback, rootNode );
+}
+
+void UpdateManager::RemoveFrameCallback( FrameCallbackInterface* frameCallback )
+{
+ mImpl->GetFrameCallbackProcessor().RemoveFrameCallback( frameCallback );
+}
+
void UpdateManager::AddSampler( OwnerPointer< Render::Sampler >& sampler )
{
// Message has ownership of Sampler while in transit from update to render