1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/common/dali-common.h>
25 #include <dali/integration-api/resource-declarations.h>
27 #include <dali/internal/common/message.h>
28 #include <dali/internal/common/type-abstraction-enums.h>
29 #include <dali/internal/common/shader-saver.h>
30 #include <dali/internal/event/common/event-thread-services.h>
31 #include <dali/internal/update/animation/scene-graph-animation.h>
32 #include <dali/internal/update/common/scene-graph-buffers.h>
33 #include <dali/internal/update/common/scene-graph-property-notification.h>
34 #include <dali/internal/update/manager/object-owner-container.h>
35 #include <dali/internal/update/node-attachments/node-attachment.h>
36 #include <dali/internal/update/nodes/node.h>
37 #include <dali/internal/update/nodes/scene-graph-layer.h>
38 #include <dali/internal/update/rendering/scene-graph-renderer.h>
39 #include <dali/internal/render/shaders/scene-graph-shader.h>
46 class GlSyncAbstraction;
47 class RenderController;
49 } // namespace Integration
54 class PropertyNotifier;
55 class NotificationManager;
56 class CompleteNotificationInterface;
57 class ResourceManager;
60 // value types used by messages
61 template <> struct ParameterType< PropertyNotification::NotifyMode >
62 : public BasicType< PropertyNotification::NotifyMode > {};
80 * UpdateManager maintains a scene graph i.e. a tree of nodes and attachments and
81 * other property owner objects.
82 * It controls the Update traversal, in which nodes are repositioned/animated,
83 * and organizes the the culling and rendering of the scene.
84 * It also maintains the lifecycle of nodes and other property owners that are
85 * disconnected from the scene graph.
87 class UpdateManager : public ShaderSaver
92 * Construct a new UpdateManager.
93 * @param[in] notificationManager This should be notified when animations have finished.
94 * @param[in] glSyncAbstraction Used to determine when framebuffers are ready
95 * @param[in] animationFinishedNotifier The CompleteNotificationInterface that handles animation completions
96 * @param[in] propertyNotifier The PropertyNotifier
97 * @param[in] resourceManager The resource manager used to load textures etc.
98 * @param[in] discardQueue Nodes are added here when disconnected from the scene-graph.
99 * @param[in] controller After messages are flushed, we request a render from the RenderController.
100 * @param[in] renderManager This is responsible for rendering the results of each "update".
101 * @param[in] renderQueue Used to queue messages for the next render.
102 * @param[in] textureCache Used for caching textures.
103 * @param[in] touchResampler Used for re-sampling touch events.
105 UpdateManager( NotificationManager& notificationManager,
106 Integration::GlSyncAbstraction& glSyncAbstraction,
107 CompleteNotificationInterface& animationFinishedNotifier,
108 PropertyNotifier& propertyNotifier,
109 ResourceManager& resourceManager,
110 DiscardQueue& discardQueue,
111 Integration::RenderController& controller,
112 RenderManager& renderManager,
113 RenderQueue& renderQueue,
114 TextureCache& textureCache,
115 TouchResampler& touchResampler );
120 virtual ~UpdateManager();
122 // Node connection methods
125 * Get the scene graph side list of RenderTasks.
126 * @param[in] systemLevel True if using the system-level overlay.
127 * @return The list of render tasks
129 RenderTaskList* GetRenderTaskList( bool systemLevel );
132 * Installs a new layer as the root node.
133 * @pre The UpdateManager does not already have an installed root node.
134 * @pre The layer is of derived Node type Layer.
135 * @pre The layer does not have a parent.
136 * @param[in] layer The new root node.
137 * @param[in] systemLevel True if using the system-level overlay.
138 * @post The node is owned by UpdateManager.
140 void InstallRoot( Layer* layer, bool systemLevel );
143 * Add a Node; UpdateManager takes ownership.
144 * @pre The node does not have a parent.
145 * @param[in] node The node to add.
147 void AddNode( Node* node );
150 * Connect a Node to the scene-graph.
151 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
152 * @pre The node does not already have a parent.
153 * @param[in] parent The new parent node.
155 void ConnectNode( Node* parent, Node* node );
158 * Disconnect a Node from the scene-graph.
159 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
160 * @pre The node has a parent.
161 * @param[in] node The node to disconnect.
163 void DisconnectNode( Node* node );
166 * Called when a property is set on a disconnected Node (via public API)
167 * A disconnected Node has has no parent or children, and its properties cannot be animated/constrained.
168 * @pre The node does not have a parent.
169 * @param[in] node The node to set as "active".
171 void SetNodeActive( Node* node );
174 * Destroy a Node owned by UpdateManager.
175 * This is not immediate; Nodes are passed to the RenderQueue to allow GL resources to be deleted.
176 * In the following update, the previously queued Nodes may be deleted.
177 * @pre The node has been disconnected from the scene-graph i.e. has no parent or children.
178 * @param[in] node The node to destroy.
180 void DestroyNode( Node* node );
183 * Attach an object to a Node.
184 * The UpdateManager is responsible for calling NodeAttachment::Initialize().
185 * @param[in] node The node which will own the attachment.
186 * @param[in] attachment The object to attach.
188 void AttachToNode( Node* node, NodeAttachment* attachment );
191 * Add a newly created object.
192 * @param[in] object The object to add.
193 * @post The object is owned by UpdateManager.
195 void AddObject( PropertyOwner* object );
199 * @param[in] object The object to remove.
201 void RemoveObject( PropertyOwner* object );
206 * Add a newly created animation.
207 * @param[in] animation The animation to add.
208 * @post The animation is owned by UpdateManager.
210 void AddAnimation( Animation* animation );
214 * @param[in] animation The animation to stop.
216 void StopAnimation( Animation* animation );
219 * Remove an animation.
220 * @param[in] animation The animation to remove.
222 void RemoveAnimation( Animation* animation );
225 * Query whether any animations are currently running.
226 * @return True if any animations are running.
228 bool IsAnimationRunning() const;
230 // Property Notification
233 * Add a newly created property notification
234 * @param[in] propertyNotification The notification to add
235 * @post The propertyNotification is owned by UpdateManager.
237 void AddPropertyNotification( PropertyNotification* propertyNotification );
240 * Remove a property notification
241 * @param[in] propertyNotification The notification to remove
243 void RemovePropertyNotification( PropertyNotification* propertyNotification );
246 * Set Notify state for PropertyNotification
247 * @param[in] propertyNotification The notification to remove
248 * @param[in] notifyMode The notification mode.
250 void PropertyNotificationSetNotify( PropertyNotification* propertyNotification, PropertyNotification::NotifyMode notifyMode );
253 * @brief Get the geometry owner
255 * @return The geometry owner
257 ObjectOwnerContainer< Geometry >& GetGeometryOwner();
259 ObjectOwnerContainer< Renderer >& GetRendererOwner();
261 * @brief Get the material owner
263 * @return The material owner
265 ObjectOwnerContainer< Material >& GetMaterialOwner();
268 * @brief Get the sampler owner
270 * @return The sampler owner
272 ObjectOwnerContainer< Sampler >& GetSamplerOwner();
275 * @brief Get the property buffer owner
277 * @return The property buffer owner
279 ObjectOwnerContainer< PropertyBuffer >& GetPropertyBufferOwner();
285 * Add a newly created shader.
286 * @param[in] shader The shader to add.
287 * @post The shader is owned by the UpdateManager.
289 void AddShader(Shader* shader);
293 * @pre The shader has been added to the UpdateManager.
294 * @param[in] shader The shader to remove.
295 * @post The shader is destroyed.
297 void RemoveShader(Shader* shader);
300 * Set the shader program for a Shader object
301 * @param[in] shader The shader to modify
302 * @param[in] shaderData Source code, hash over source, and optional compiled binary for the shader program
303 * @param[in] modifiesGeometry True if the vertex shader modifies geometry
305 void SetShaderProgram( Shader* shader, Internal::ShaderDataPtr shaderData, bool modifiesGeometry );
308 * @brief Accept compiled shaders passed back on render thread for saving.
309 * @param[in] shaderData Source code, hash over source, and corresponding compiled binary to be saved.
311 virtual void SaveBinary( Internal::ShaderDataPtr shaderData );
314 * @brief Set the destination for compiled shader binaries to be passed on to.
315 * The dispatcher passed in will be called from the update thread.
316 * @param[in] upstream A sink for ShaderDatas to be passed into.
318 void SetShaderSaver( ShaderSaver& upstream );
323 * Add a newly created gesture.
324 * @param[in] gesture The gesture to add.
325 * @post The gesture is owned by the UpdateManager.
327 void AddGesture( PanGesture* gesture );
331 * @pre The gesture has been added to the UpdateManager.
332 * @param[in] gesture The gesture to remove.
333 * @post The gesture is destroyed.
335 void RemoveGesture( PanGesture* gesture );
337 // Message queue handling
340 * Reserve space for another message in the queue; this must then be initialized by the caller.
341 * The message will be read from the update-thread after the next FlushMessages is called.
342 * @post Calling this method may invalidate any previously returned slots.
343 * @param[in] size The message size with respect to the size of type "char".
344 * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
345 * @note the default value of updateScene should match that in EventThreadServices::ReserveMessageSlot.
346 * @return A pointer to the first char allocated for the message.
348 unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene = true );
351 * @return the current event-buffer index.
353 BufferIndex GetEventBufferIndex() const
355 // inlined as its called often from event thread
356 return mSceneGraphBuffers.GetEventBufferIndex();
360 * Called by the event-thread to signal that FlushQueue will be called
361 * e.g. when it has finished event processing.
363 void EventProcessingStarted();
366 * Flush the set of messages, which were previously stored with QueueMessage().
367 * Calls to this thread-safe method should be minimized, to avoid thread blocking.
369 * @return True if there are messages to process.
376 * Performs an Update traversal on the scene-graph.
377 * @param[in] elapsedSeconds The elapsed time that should be applied to animations.
378 * @param[in] lastVSyncTimeMilliseconds The last time, in milliseconds, that we had a VSync.
379 * @param[in] nextVSyncTimeMilliseconds The estimated time, in milliseconds, of the next VSync.
380 * @return True if further updates are required e.g. during animations.
382 unsigned int Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
385 * Set the background color i.e. the glClear color used at the beginning of each frame.
386 * @param[in] color The new background color.
388 void SetBackgroundColor(const Vector4& color);
391 * Set the default surface rect.
392 * @param[in] rect The rect value representing the surface.
394 void SetDefaultSurfaceRect( const Rect<int>& rect );
397 * @copydoc Dali::Stage::KeepRendering()
399 void KeepRendering( float durationSeconds );
402 * Sets the depths of all layers.
403 * @param layers The layers in depth order.
404 * @param[in] systemLevel True if using the system-level overlay.
406 void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
411 UpdateManager(const UpdateManager&);
414 UpdateManager& operator=(const UpdateManager& rhs);
417 * Helper to check whether the update-thread should keep going.
418 * @param[in] elapsedSeconds The time in seconds since the previous update.
419 * @return True if the update-thread should keep going.
421 unsigned int KeepUpdatingCheck( float elapsedSeconds ) const;
424 * Helper to calculate new camera setup when root node resizes.
425 * @param[in] updateBuffer The buffer to read the root node size from.
427 void UpdateProjectionAndViewMatrices(int updateBuffer);
430 * Post process resources that have been updated by renderer
432 void PostProcessResources();
435 * Helper to reset all Node properties
436 * @param[in] bufferIndex to use
438 void ResetProperties( BufferIndex bufferIndex );
441 * Perform gesture updates.
442 * @param[in] bufferIndex to use
443 * @param[in] lastVSyncTime The last VSync time in milliseconds.
444 * @param[in] nextVSyncTime The estimated time of the next VSync in milliseconds.
445 * @return true, if any properties were updated.
447 bool ProcessGestures( BufferIndex bufferIndex, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds );
450 * Perform animation updates
451 * @param[in] bufferIndex to use
452 * @param[in] elapsedSeconds time since last frame
454 void Animate( BufferIndex bufferIndex, float elapsedSeconds );
457 * Perform constraint updates.
458 * @note Applies constraints to nodes first (depth first search order).
459 * Then shader constraints second (construction order)
460 * @param[in] bufferIndex to use
462 void ApplyConstraints( BufferIndex bufferIndex );
465 * Perform property notification updates
466 * @param[in] bufferIndex to use
468 void ProcessPropertyNotifications( BufferIndex bufferIndex );
471 * Pass shader binaries queued here on to event thread.
473 void ForwardCompiledShadersToEventThread();
476 * Update the default camera.
477 * This must be altered to match the root Node for 2D layouting.
478 * @param[in] updateBuffer The buffer to read the root node size from.
480 void UpdateDefaultCamera( int updateBuffer );
483 * Update node shaders, opacity, geometry etc.
484 * @param[in] bufferIndex to use
486 void UpdateNodes( BufferIndex bufferIndex );
490 * @param[in] bufferIndex to use
492 void UpdateRenderers( BufferIndex bufferIndex );
496 // needs to be direct member so that getter for event buffer can be inlined
497 SceneGraphBuffers mSceneGraphBuffers;
504 // Messages for UpdateManager
506 inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
508 typedef MessageValue2< UpdateManager, Layer*, bool > LocalType;
510 // Reserve some memory inside the message queue
511 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
513 // Construct message in the message queue memory; note that delete should not be called on the return value
514 new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
517 inline void AddNodeMessage( UpdateManager& manager, Node& node )
519 typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
521 // Reserve some memory inside the message queue
522 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
524 // Construct message in the message queue memory; note that delete should not be called on the return value
525 new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
528 inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
530 // Update thread can edit the object
531 Node& parent = const_cast< Node& >( constParent );
532 Node& child = const_cast< Node& >( constChild );
534 typedef MessageValue2< UpdateManager, Node*, Node* > LocalType;
536 // Reserve some memory inside the message queue
537 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
539 // Construct message in the message queue memory; note that delete should not be called on the return value
540 new (slot) LocalType( &manager, &UpdateManager::ConnectNode, &parent, &child );
543 inline void DisconnectNodeMessage( UpdateManager& manager, const Node& constNode )
545 // Scene graph thread can modify this object.
546 Node& node = const_cast< Node& >( constNode );
548 typedef MessageValue1< UpdateManager, Node* > LocalType;
550 // Reserve some memory inside the message queue
551 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
553 // Construct message in the message queue memory; note that delete should not be called on the return value
554 new (slot) LocalType( &manager, &UpdateManager::DisconnectNode, &node );
557 inline void DestroyNodeMessage( UpdateManager& manager, const Node& constNode )
559 // Scene graph thread can destroy this object.
560 Node& node = const_cast< Node& >( constNode );
562 typedef MessageValue1< UpdateManager, Node* > LocalType;
564 // Reserve some memory inside the message queue
565 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
567 // Construct message in the message queue memory; note that delete should not be called on the return value
568 new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
571 inline void AttachToNodeMessage( UpdateManager& manager, const Node& constParent, NodeAttachment* attachment )
573 // Scene graph thread can modify this object.
574 Node& parent = const_cast< Node& >( constParent );
576 // @todo MESH_REWORK Don't pass by owner pointer after merge with SceneGraph::RenderableAttachment ? (not needed if we split RendererAttachment to 2 objects)
577 typedef MessageValue2< UpdateManager, Node*, NodeAttachmentOwner > LocalType;
579 // Reserve some memory inside the message queue
580 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
582 // Construct message in the message queue memory; note that delete should not be called on the return value
583 new (slot) LocalType( &manager, &UpdateManager::AttachToNode, &parent, attachment );
586 inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
588 typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
590 // Reserve some memory inside the message queue
591 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
593 // Construct message in the message queue memory; note that delete should not be called on the return value
594 new (slot) LocalType( &manager, &UpdateManager::AddObject, object );
597 inline void RemoveObjectMessage( UpdateManager& manager, PropertyOwner* object )
599 typedef MessageValue1< UpdateManager, PropertyOwner* > LocalType;
601 // Reserve some memory inside the message queue
602 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
604 // Construct message in the message queue memory; note that delete should not be called on the return value
605 new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
608 inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
610 typedef MessageValue1< UpdateManager, Animation* > LocalType;
612 // Reserve some memory inside the message queue
613 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
615 // Construct message in the message queue memory; note that delete should not be called on the return value
616 new (slot) LocalType( &manager, &UpdateManager::AddAnimation, animation );
619 inline void StopAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
621 // The scene-graph thread owns this object so it can safely edit it.
622 Animation& animation = const_cast< Animation& >( constAnimation );
624 typedef MessageValue1< UpdateManager, Animation* > LocalType;
626 // Reserve some memory inside the message queue
627 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
629 // Construct message in the message queue memory; note that delete should not be called on the return value
630 new (slot) LocalType( &manager, &UpdateManager::StopAnimation, &animation );
633 inline void RemoveAnimationMessage( UpdateManager& manager, const Animation& constAnimation )
635 // The scene-graph thread owns this object so it can safely edit it.
636 Animation& animation = const_cast< Animation& >( constAnimation );
638 typedef MessageValue1< UpdateManager, Animation* > LocalType;
640 // Reserve some memory inside the message queue
641 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
643 // Construct message in the message queue memory; note that delete should not be called on the return value
644 new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
647 inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
649 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
651 // Reserve some memory inside the message queue
652 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
654 // Construct message in the message queue memory; note that delete should not be called on the return value
655 new (slot) LocalType( &manager, &UpdateManager::AddPropertyNotification, propertyNotification );
658 inline void RemovePropertyNotificationMessage( UpdateManager& manager, const PropertyNotification& constPropertyNotification )
660 // The scene-graph thread owns this object so it can safely edit it.
661 PropertyNotification& propertyNotification = const_cast< PropertyNotification& >( constPropertyNotification );
663 typedef MessageValue1< UpdateManager, PropertyNotification* > LocalType;
665 // Reserve some memory inside the message queue
666 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
668 // Construct message in the message queue memory; note that delete should not be called on the return value
669 new (slot) LocalType( &manager, &UpdateManager::RemovePropertyNotification, &propertyNotification );
672 inline void PropertyNotificationSetNotifyModeMessage( UpdateManager& manager,
673 const PropertyNotification* constPropertyNotification,
674 PropertyNotification::NotifyMode notifyMode )
676 // The scene-graph thread owns this object so it can safely edit it.
677 PropertyNotification* propertyNotification = const_cast< PropertyNotification* >( constPropertyNotification );
679 typedef MessageValue2< UpdateManager, PropertyNotification*, PropertyNotification::NotifyMode > LocalType;
681 // Reserve some memory inside the message queue
682 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
684 // Construct message in the message queue memory; note that delete should not be called on the return value
685 new (slot) LocalType( &manager, &UpdateManager::PropertyNotificationSetNotify, propertyNotification, notifyMode );
688 // The render thread can safely change the Shader
689 inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
691 typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
693 // Reserve some memory inside the message queue
694 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
696 // Construct message in the message queue memory; note that delete should not be called on the return value
697 new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
700 // The render thread can safely change the Shader
701 inline void RemoveShaderMessage( UpdateManager& manager, Shader& shader )
703 typedef MessageValue1< UpdateManager, Shader* > LocalType;
705 // Reserve some memory inside the message queue
706 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
708 // Construct message in the message queue memory; note that delete should not be called on the return value
709 new (slot) LocalType( &manager, &UpdateManager::RemoveShader, &shader );
712 inline void SetShaderProgramMessage( UpdateManager& manager,
714 Internal::ShaderDataPtr shaderData,
715 bool modifiesGeometry )
717 typedef MessageValue3< UpdateManager, Shader*, Internal::ShaderDataPtr, bool > LocalType;
719 // Reserve some memory inside the message queue
720 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
722 // Construct message in the message queue memory; note that delete should not be called on the return value
723 new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, shaderData, modifiesGeometry );
726 inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
728 typedef MessageValue1< UpdateManager, Vector4 > LocalType;
730 // Reserve some memory inside the message queue
731 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
733 // Construct message in the message queue memory; note that delete should not be called on the return value
734 new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
737 inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int>& rect )
739 typedef MessageValue1< UpdateManager, Rect<int> > LocalType;
741 // Reserve some memory inside the message queue
742 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
744 // Construct message in the message queue memory; note that delete should not be called on the return value
745 new (slot) LocalType( &manager, &UpdateManager::SetDefaultSurfaceRect, rect );
748 inline void KeepRenderingMessage( UpdateManager& manager, float durationSeconds )
750 typedef MessageValue1< UpdateManager, float > LocalType;
752 // Reserve some memory inside the message queue
753 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
755 // Construct message in the message queue memory; note that delete should not be called on the return value
756 new (slot) LocalType( &manager, &UpdateManager::KeepRendering, durationSeconds );
760 * Create a message for setting the depth of a layer
761 * @param[in] manager The update manager
762 * @param[in] layers list of layers
763 * @param[in] systemLevel True if the layers are added via the SystemOverlay API
765 inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
767 typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
769 // Reserve some memory inside the message queue
770 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
772 // Construct message in the message queue memory; note that delete should not be called on the return value
773 new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
776 inline void AddGestureMessage( UpdateManager& manager, PanGesture* gesture )
778 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
780 // Reserve some memory inside the message queue
781 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
783 // Construct message in the message queue memory; note that delete should not be called on the return value
784 new (slot) LocalType( &manager, &UpdateManager::AddGesture, gesture );
787 inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture )
789 typedef MessageValue1< UpdateManager, PanGesture* > LocalType;
791 // Reserve some memory inside the message queue
792 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
794 // Construct message in the message queue memory; note that delete should not be called on the return value
795 new (slot) LocalType( &manager, &UpdateManager::RemoveGesture, gesture );
798 template< typename T >
799 inline void AddMessage( UpdateManager& manager, ObjectOwnerContainer<T>& owner, T& object )
801 typedef MessageValue1< ObjectOwnerContainer<T>, OwnerPointer< T > > LocalType;
803 // Reserve some memory inside the message queue
804 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
805 // Construct message in the message queue memory; note that delete should not be called on the return value
806 new (slot) LocalType( &owner, &ObjectOwnerContainer<T>::Add, &object );
809 template< typename T >
810 inline void RemoveMessage( UpdateManager& manager, ObjectOwnerContainer<T>& owner, T& object )
812 typedef MessageValue1< ObjectOwnerContainer<T>, T* > LocalType;
814 // Reserve some memory inside the message queue
815 unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
816 // Construct message in the message queue memory; note that delete should not be called on the return value
817 new (slot) LocalType( &owner, &ObjectOwnerContainer<T>::Remove, &object );
820 } // namespace SceneGraph
822 } // namespace Internal
826 #endif // __DALI_INTERNAL_SCENE_GRAPH_UPDATE_MANAGER_H__