X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fcommon%2Fproperty-owner-messages.h;h=8668e4ead8257ea791df4152fda18944619ae016;hb=b43741a90b40ca9dfbd33d6a9d390d3c09230e89;hp=fe2045f946c4752e3331bfa834ffe1dfe352b467;hpb=89998c36c22a0db8f0fed888c6b250d36a868c32;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/common/property-owner-messages.h b/dali/internal/update/common/property-owner-messages.h old mode 100644 new mode 100755 index fe2045f..8668e4e --- a/dali/internal/update/common/property-owner-messages.h +++ b/dali/internal/update/common/property-owner-messages.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H__ -#define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H__ +#ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H +#define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_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. @@ -18,13 +18,14 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES +#include +// INTERNAL INCLUDES #include #include #include #include -#include namespace Dali { @@ -37,32 +38,36 @@ class PropertyOwner; // Property Messages for PropertyOwner -class PropertyMessageBase : public MessageBase +/** + * A base class for property owner property messages. + * (For future optimization - see NodeMessageBase & Node.SetActive()) + */ +class PropertyOwnerMessageBase : public MessageBase { public: /** * Create a message. */ - PropertyMessageBase(); + PropertyOwnerMessageBase(); /** * Virtual destructor */ - virtual ~PropertyMessageBase(); + virtual ~PropertyOwnerMessageBase(); private: // Undefined - PropertyMessageBase(const PropertyMessageBase&); - PropertyMessageBase& operator=(const PropertyMessageBase& rhs); + PropertyOwnerMessageBase(const PropertyOwnerMessageBase&); + PropertyOwnerMessageBase& operator=(const PropertyOwnerMessageBase& rhs); }; /** * Templated message which bakes a property. */ template< typename P > -class PropertyMessage : public PropertyMessageBase +class AnimatablePropertyMessage : public PropertyOwnerMessageBase { public: @@ -72,7 +77,7 @@ public: * Create a message. * @note The scene object 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] sceneObject The property owner scene object * @param[in] property The property to bake. * @param[in] member The member function of the object. @@ -85,16 +90,16 @@ public: typename ParameterType< P >::PassingType value ) { // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( PropertyMessage ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( AnimatablePropertyMessage ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) PropertyMessage( sceneObject, property, member, value ); + new (slot) AnimatablePropertyMessage( sceneObject, property, member, value ); } /** * Virtual destructor */ - virtual ~PropertyMessage() + virtual ~AnimatablePropertyMessage() { } @@ -103,6 +108,7 @@ public: */ virtual void Process( BufferIndex updateBufferIndex ) { + mSceneObject->SetPropertyDirty( true ); (mProperty->*mMemberFunction)( updateBufferIndex, mParam ); } @@ -117,11 +123,11 @@ private: * @param[in] member The member function of the object. * @param[in] value The new value of the property. */ - PropertyMessage( const PropertyOwner* sceneObject, - const AnimatableProperty

* property, - MemberFunction member, - typename ParameterType< P >::PassingType value ) - : PropertyMessageBase(), + AnimatablePropertyMessage( const PropertyOwner* sceneObject, + const AnimatableProperty

* property, + MemberFunction member, + typename ParameterType< P >::PassingType value ) + : PropertyOwnerMessageBase(), mSceneObject( const_cast< PropertyOwner* >( sceneObject ) ), mProperty( const_cast< AnimatableProperty

* >( property ) ), mMemberFunction( member ), @@ -141,7 +147,7 @@ private: * Templated message which bakes a property. */ template< typename P > -class PropertyComponentMessage : public PropertyMessageBase +class AnimatablePropertyComponentMessage : public PropertyOwnerMessageBase { public: @@ -164,16 +170,16 @@ public: float value ) { // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( PropertyComponentMessage ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( AnimatablePropertyComponentMessage ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) PropertyComponentMessage( sceneObject, property, member, value ); + new (slot) AnimatablePropertyComponentMessage( sceneObject, property, member, value ); } /** * Virtual destructor */ - virtual ~PropertyComponentMessage() + virtual ~AnimatablePropertyComponentMessage() { } @@ -182,6 +188,7 @@ public: */ virtual void Process( BufferIndex updateBufferIndex ) { + mSceneObject->SetPropertyDirty( true ); (mProperty->*mMemberFunction)( updateBufferIndex, mParam ); } @@ -196,11 +203,11 @@ private: * @param[in] member The member function of the object. * @param[in] value The new value of the X,Y,Z or W component. */ - PropertyComponentMessage( const PropertyOwner* sceneObject, - const AnimatableProperty

* property, - MemberFunction member, - float value ) - : PropertyMessageBase(), + AnimatablePropertyComponentMessage( const PropertyOwner* sceneObject, + const AnimatableProperty

* property, + MemberFunction member, + float value ) + : PropertyOwnerMessageBase(), mSceneObject( const_cast< PropertyOwner* >( sceneObject ) ), mProperty( const_cast< AnimatableProperty

* >( property ) ), mMemberFunction( member ), @@ -218,26 +225,26 @@ private: // Messages for PropertyOwner -inline void InstallCustomPropertyMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, PropertyBase* property ) +inline void InstallCustomPropertyMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, OwnerPointer& property ) { typedef MessageValue1< PropertyOwner, OwnerPointer > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value new (slot) LocalType( &owner, &PropertyOwner::InstallCustomProperty, property ); } -inline void ApplyConstraintMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, ConstraintBase& constraint ) +inline void ApplyConstraintMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, OwnerPointer& constraint ) { typedef MessageValue1< PropertyOwner, OwnerPointer > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &owner, &PropertyOwner::ApplyConstraint, &constraint ); + new (slot) LocalType( &owner, &PropertyOwner::ApplyConstraint, constraint ); } inline void RemoveConstraintMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, const ConstraintBase& constConstraint ) @@ -248,23 +255,29 @@ inline void RemoveConstraintMessage( EventThreadServices& eventThreadServices, c typedef MessageValue1< PropertyOwner, ConstraintBase* > LocalType; // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value new (slot) LocalType( &owner, &PropertyOwner::RemoveConstraint, &constraint ); } -inline void AddUniformMapMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, UniformPropertyMapping* map ) +inline void AddUniformMapMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, OwnerPointer< UniformPropertyMapping >& map ) { typedef MessageValue1< PropertyOwner, OwnerPointer< UniformPropertyMapping > > LocalType; - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + new (slot) LocalType( &owner, &PropertyOwner::AddUniformMapping, map ); } inline void RemoveUniformMapMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, const std::string& uniformName ) { typedef MessageValue1< PropertyOwner, std::string > LocalType; - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); + new (slot) LocalType( &owner, &PropertyOwner::RemoveUniformMapping, uniformName ); } @@ -275,4 +288,4 @@ inline void RemoveUniformMapMessage( EventThreadServices& eventThreadServices, c } // namespace Dali -#endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H__ +#endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H