X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fnodes%2Fnode-messages.h;h=df7e62813c85cf09c377d8612c8949c7e8708203;hb=cd0ce6e412df8961b1a5e28b496369fa49fd72d7;hp=52050646150b7e81322252ff2a52c9a7c4175be1;hpb=5c66381841dd4dfd82c5a118d34104a00a2e0e1c;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 index 5205064..df7e628 100644 --- a/dali/internal/update/nodes/node-messages.h +++ b/dali/internal/update/nodes/node-messages.h @@ -1,21 +1,22 @@ #ifndef __DALI_INTERNAL_SCENE_GRAPH_NODE_MESSAGES_H__ #define __DALI_INTERNAL_SCENE_GRAPH_NODE_MESSAGES_H__ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2018 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // INTERNAL INCLUDES #include @@ -48,13 +49,6 @@ public: */ virtual ~NodePropertyMessageBase(); -protected: - - /** - * Inform UpdateManager that the Node is now active - */ - void NotifyUpdateManager( Node* node ); - private: // Undefined @@ -80,23 +74,23 @@ public: * 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] 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( UpdateManager& updateManager, + static void Send( EventThreadServices& eventThreadServices, const Node* node, const AnimatableProperty

* property, MemberFunction member, typename ParameterType< P >::PassingType value ) { // Reserve some memory inside the message queue - unsigned int* slot = updateManager.GetEventToUpdate().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( updateManager, node, property, member, value ); + new (slot) NodePropertyMessage( eventThreadServices.GetUpdateManager(), node, property, member, value ); } /** @@ -112,12 +106,6 @@ public: virtual void Process( BufferIndex updateBufferIndex ) { (mProperty->*mMemberFunction)( updateBufferIndex, mParam ); - - if( ! mNode->IsActive() ) - { - // Inform UpdateManager that the Node is now active - NotifyUpdateManager( mNode ); - } } private: @@ -167,23 +155,23 @@ public: * 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] updateManager The update-manager. + * @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( UpdateManager& updateManager, + static void Send( EventThreadServices& eventThreadServices, const Node* node, const AnimatableProperty

* property, MemberFunction member, float value ) { // Reserve some memory inside the message queue - unsigned int* slot = updateManager.GetEventToUpdate().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( updateManager, node, property, member, value ); + new (slot) NodePropertyComponentMessage( eventThreadServices.GetUpdateManager(), node, property, member, value ); } /** @@ -199,12 +187,6 @@ public: virtual void Process( BufferIndex updateBufferIndex ) { (mProperty->*mMemberFunction)( updateBufferIndex, mParam ); - - if( ! mNode->IsActive() ) - { - // Inform UpdateManager that the Node is now active - NotifyUpdateManager( mNode ); - } } private: @@ -240,6 +222,164 @@ 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 ) + { + (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 ) + { + (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