X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fnodes%2Fnode-messages.h;h=a005dd348b36efb56e98fd68fdce0760c76065f3;hb=b43741a90b40ca9dfbd33d6a9d390d3c09230e89;hp=c11cc6c1d38bf04bcd808b89c40deb29e864f4f1;hpb=4c7778a7923dd5a76d664bd6f4d474a991727628;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/nodes/node-messages.h b/dali/internal/update/nodes/node-messages.h old mode 100644 new mode 100755 index c11cc6c..a005dd3 --- a/dali/internal/update/nodes/node-messages.h +++ b/dali/internal/update/nodes/node-messages.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_SCENE_GRAPH_NODE_MESSAGES_H__ -#define __DALI_INTERNAL_SCENE_GRAPH_NODE_MESSAGES_H__ +#ifndef DALI_INTERNAL_SCENE_GRAPH_NODE_MESSAGES_H +#define DALI_INTERNAL_SCENE_GRAPH_NODE_MESSAGES_H /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,7 +87,7 @@ public: typename ParameterType< P >::PassingType value ) { // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodePropertyMessage ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodePropertyMessage ) ); // Construct message in the message queue memory; note that delete should not be called on the return value new (slot) NodePropertyMessage( eventThreadServices.GetUpdateManager(), node, property, member, value ); @@ -105,6 +105,7 @@ public: */ virtual void Process( BufferIndex updateBufferIndex ) { + mNode->SetPropertyDirty( true ); (mProperty->*mMemberFunction)( updateBufferIndex, mParam ); } @@ -168,7 +169,7 @@ public: float value ) { // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodePropertyComponentMessage ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodePropertyComponentMessage ) ); // Construct message in the message queue memory; note that delete should not be called on the return value new (slot) NodePropertyComponentMessage( eventThreadServices.GetUpdateManager(), node, property, member, value ); @@ -186,6 +187,7 @@ public: */ virtual void Process( BufferIndex updateBufferIndex ) { + mNode->SetPropertyDirty( true ); (mProperty->*mMemberFunction)( updateBufferIndex, mParam ); } @@ -222,10 +224,170 @@ private: float mParam; }; + +template +class NodeTransformPropertyMessage : public NodePropertyMessageBase +{ +public: + + typedef void(TransformManagerPropertyHandler

::*MemberFunction)( BufferIndex, const P& ); + + /** + * Create a message. + * @note The node is expected to be const in the thread which sends this message. + * However it can be modified when Process() is called in a different thread. + * @param[in] eventThreadServices The object used to send messages to the scene graph + * @param[in] node The node. + * @param[in] property The property to bake. + * @param[in] member The member function of the object. + * @param[in] value The new value of the property. + */ + static void Send( EventThreadServices& eventThreadServices, + const Node* node, + const TransformManagerPropertyHandler

* property, + MemberFunction member, + const P& value ) + { + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodeTransformPropertyMessage ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) NodeTransformPropertyMessage( eventThreadServices.GetUpdateManager(), node, property, member, value ); + } + + /** + * Virtual destructor + */ + virtual ~NodeTransformPropertyMessage() + { + } + + /** + * @copydoc MessageBase::Process + */ + virtual void Process( BufferIndex updateBufferIndex ) + { + mNode->SetPropertyDirty( true ); + (mProperty->*mMemberFunction)( updateBufferIndex, mParam ); + } + +private: + + /** + * Create a message. + * @note The node is expected to be const in the thread which sends this message. + * However it can be modified when Process() is called in a different thread. + * @param[in] updateManager The update-manager. + * @param[in] node The node. + * @param[in] property The property to bake. + * @param[in] member The member function of the object. + * @param[in] value The new value of the property. + */ + NodeTransformPropertyMessage( UpdateManager& updateManager, + const Node* node, + const TransformManagerPropertyHandler

* property, + MemberFunction member, + const P& value ) + : NodePropertyMessageBase( updateManager ), + mNode( const_cast< Node* >( node ) ), + mProperty( const_cast< TransformManagerPropertyHandler

* >( property ) ), + mMemberFunction( member ), + mParam( value ) + { + } + +private: + + Node* mNode; + TransformManagerPropertyHandler

* mProperty; + MemberFunction mMemberFunction; + P mParam; +}; + + +template +class NodeTransformComponentMessage : public NodePropertyMessageBase +{ +public: + + typedef void(TransformManagerPropertyHandler

::*MemberFunction)( BufferIndex, float ); + + /** + * Send a message. + * @note The node is expected to be const in the thread which sends this message. + * However it can be modified when Process() is called in a different thread. + * @param[in] eventThreadServices The object used to send messages to the scene graph + * @param[in] node The node. + * @param[in] property The property to bake. + * @param[in] member The member function of the object. + * @param[in] value The new value of the X,Y,Z or W component. + */ + static void Send( EventThreadServices& eventThreadServices, + const Node* node, + const TransformManagerPropertyHandler

* property, + MemberFunction member, + float value ) + { + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( NodeTransformComponentMessage ) ); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) NodeTransformComponentMessage( eventThreadServices.GetUpdateManager(), node, property, member, value ); + } + + /** + * Virtual destructor + */ + virtual ~NodeTransformComponentMessage() + { + } + + /** + * @copydoc MessageBase::Process + */ + virtual void Process( BufferIndex updateBufferIndex ) + { + mNode->SetPropertyDirty( true ); + (mProperty->*mMemberFunction)( updateBufferIndex, mParam ); + } + +private: + + /** + * Create a message. + * @note The node is expected to be const in the thread which sends this message. + * However it can be modified when Process() is called in a different thread. + * @param[in] updateManager The update-manager. + * @param[in] node The node. + * @param[in] property The property to bake. + * @param[in] member The member function of the object. + * @param[in] value The new value of the X,Y,Z or W component. + */ + NodeTransformComponentMessage( UpdateManager& updateManager, + const Node* node, + const TransformManagerPropertyHandler

* property, + MemberFunction member, + float value ) + : NodePropertyMessageBase( updateManager ), + mNode( const_cast< Node* >( node ) ), + mProperty( const_cast< TransformManagerPropertyHandler

* >( property ) ), + mMemberFunction( member ), + mParam( value ) + { + } + +private: + + Node* mNode; + TransformManagerPropertyHandler

* mProperty; + MemberFunction mMemberFunction; + float mParam; +}; + } // namespace SceneGraph } // namespace Internal } // namespace Dali -#endif // __DALI_INTERNAL_SCENE_GRAPH_NODE_MESSAGES_H__ +#endif // DALI_INTERNAL_SCENE_GRAPH_NODE_MESSAGES_H