#include <dali/internal/update/common/scene-graph-property-notification.h>
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/update/nodes/scene-graph-layer.h>
+#include <dali/internal/update/manager/scene-graph-frame-callback.h> // for OwnerPointer< FrameCallback >
#include <dali/internal/update/rendering/scene-graph-renderer.h> // for OwnerPointer< Renderer >
#include <dali/internal/update/rendering/scene-graph-texture-set.h> // for OwnerPointer< TextureSet >
#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
/**
* Installs a new layer as the root node.
- * @pre The UpdateManager does not already have an installed root node.
* @pre The layer is of derived Node type Layer.
* @pre The layer does not have a parent.
* @param[in] layer The new root node.
void InstallRoot( OwnerPointer<Layer>& layer );
/**
+ * Uninstalls the root node.
+ * @pre The layer is of derived Node type Layer.
+ * @pre The layer does not have a parent.
+ * @param[in] layer The root node.
+ * @post The node is owned by UpdateManager.
+ */
+ void UninstallRoot( Layer* layer );
+
+ /**
* Add a Node; UpdateManager takes ownership.
* @pre The node does not have a parent.
* @note even though nodes are pool allocated, they also contain other heap allocated data, thus using OwnerPointer when transferring the data
* Remove a camera from scene
* @param[in] camera to remove
*/
- void RemoveCamera( const Camera* camera );
+ void RemoveCamera( Camera* camera );
/**
* Add a newly created object.
* @param[in] frameBuffer The framebuffer to add
* The framebuffer will be owned by RenderManager
*/
- void AddFrameBuffer( Render::FrameBuffer* frameBuffer );
+ void AddFrameBuffer( OwnerPointer< Render::FrameBuffer >& frameBuffer );
/**
* Removes a FrameBuffer from the render manager
void SetDefaultSurfaceRect( const Rect<int>& rect );
/**
+ * Set the default surface orientation.
+ * @param[in] orientation The orientation value representing the surface.
+ */
+ void SetDefaultSurfaceOrientation( int orientation );
+
+ /**
* @copydoc Dali::Stage::KeepRendering()
*/
void KeepRendering( float durationSeconds );
/**
* Adds an implementation of the FrameCallbackInterface.
- * @param[in] frameCallback A pointer to the implementation of the FrameCallbackInterface
+ * @param[in] frameCallback An OwnerPointer to the SceneGraph FrameCallback object
* @param[in] rootNode A pointer to the root node to apply the FrameCallback to
*/
- void AddFrameCallback( FrameCallbackInterface* frameCallback, const Node* rootNode );
+ void AddFrameCallback( OwnerPointer< FrameCallback >& frameCallback, const Node* rootNode );
/**
* Removes the specified implementation of FrameCallbackInterface.
new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root );
}
+inline void UninstallRootMessage( UpdateManager& manager, const Layer* constRoot )
+{
+ // Scene graph thread can destroy this object.
+ Layer* root = const_cast< Layer* >( constRoot );
+
+ typedef MessageValue1< UpdateManager, Layer* > LocalType;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::UninstallRoot, root );
+}
+
inline void AddNodeMessage( UpdateManager& manager, OwnerPointer<Node>& node )
{
// Message has ownership of Node while in transit from event -> update
inline void RemoveCameraMessage( UpdateManager& manager, const Camera* camera )
{
- typedef MessageValue1< UpdateManager, const Camera* > LocalType;
+ typedef MessageValue1< UpdateManager, Camera* > LocalType;
// Reserve some memory inside the message queue
uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, camera );
+ new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, const_cast<Camera*>( camera ) );
}
inline void AddObjectMessage( UpdateManager& manager, OwnerPointer<PropertyOwner>& object )
new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
}
-inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
+inline void RemoveObjectMessage( UpdateManager& manager, const PropertyOwner* object )
{
typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
+ new (slot) LocalType( &manager, &UpdateManager::RemoveObject, const_cast<PropertyOwner*>( object ) );
}
inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Animation >& animation )
}
// The render thread can safely change the Shader
-inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
+inline void RemoveShaderMessage( UpdateManager& manager, const Shader* shader )
{
typedef MessageValue1< UpdateManager, Shader* > LocalType;
uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
+ new (slot) LocalType( &manager, &UpdateManager::RemoveShader, const_cast<Shader*>( shader ) );
}
inline void SetShaderProgramMessage( UpdateManager& manager,
- Shader& shader,
+ const Shader& shader,
Internal::ShaderDataPtr shaderData,
bool modifiesGeometry )
{
uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, shaderData, modifiesGeometry );
+ new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, const_cast<Shader*>( &shader ), shaderData, modifiesGeometry );
}
inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
}
+inline void SetDefaultSurfaceOrientationMessage( UpdateManager& manager, int orientation )
+{
+ typedef MessageValue1< UpdateManager, int > LocalType;
+
+ // Reserve some memory inside the message queue
+ unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceOrientation, orientation );
+}
+
inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
{
typedef MessageValue1< UpdateManager, float > LocalType;
* Create a message for setting the depth of a layer
* @param[in] manager The update manager
* @param[in] layers list of layers
- * @param[in] rootLayer True if the layers are added via the SystemOverlay API
+ * @param[in] rootLayer The rool layer
*/
inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, const Layer* rootLayer )
{
new (slot) LocalType( &manager, &UpdateManager::AddRenderer, object );
}
-inline void RemoveRendererMessage( UpdateManager& manager, Renderer& object )
+inline void RemoveRendererMessage( UpdateManager& manager, const Renderer& object )
{
typedef MessageValue1< UpdateManager, Renderer* > LocalType;
// Reserve some memory inside the message queue
uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, &object );
+ new (slot) LocalType( &manager, &UpdateManager::RemoveRenderer, const_cast<Renderer*>( &object ) );
}
// The render thread can safely change the Shader
}
-inline void AddFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer )
+inline void AddFrameBuffer( UpdateManager& manager, OwnerPointer< Render::FrameBuffer >& frameBuffer )
{
- typedef MessageValue1< UpdateManager, Render::FrameBuffer* > LocalType;
+ typedef MessageValue1< UpdateManager, OwnerPointer< Render::FrameBuffer > > LocalType;
// Reserve some memory inside the message queue
uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddFrameBuffer, &frameBuffer );
+ new (slot) LocalType( &manager, &UpdateManager::AddFrameBuffer, frameBuffer );
}
inline void RemoveFrameBuffer( UpdateManager& manager, Render::FrameBuffer& frameBuffer )
new (slot) LocalType( &manager, &UpdateManager::AddPropertyResetter, resetter );
}
-inline void AddFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterface& frameCallback, const Node& rootNode )
+inline void AddFrameCallbackMessage( UpdateManager& manager, OwnerPointer< FrameCallback >& frameCallback, const Node& rootNode )
{
- typedef MessageValue2< UpdateManager, FrameCallbackInterface*, const Node* > LocalType;
+ typedef MessageValue2< UpdateManager, OwnerPointer< FrameCallback >, const Node* > LocalType;
// Reserve some memory inside the message queue
uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddFrameCallback, &frameCallback, &rootNode );
+ new (slot) LocalType( &manager, &UpdateManager::AddFrameCallback, frameCallback, &rootNode );
}
inline void RemoveFrameCallbackMessage( UpdateManager& manager, FrameCallbackInterface& frameCallback )