Fix to avoid copy of non basic types. 63/38663/2
authorFrancisco Santos <f1.santos@samsung.com>
Thu, 23 Apr 2015 18:45:50 +0000 (19:45 +0100)
committerFrancisco Santos <f1.santos@samsung.com>
Tue, 28 Apr 2015 09:32:31 +0000 (10:32 +0100)
Change-Id: I73f32a433f4b8884d49bb248ea55b28285c37cb8

dali/internal/update/common/double-buffered-property.h
dali/internal/update/common/property-owner-messages.h

index 66662d1..857a0db 100644 (file)
@@ -27,6 +27,7 @@
 #include <dali/public-api/object/property-input.h>
 #include <dali/public-api/object/property-types.h>
 #include <dali/internal/common/message.h>
+#include <dali/internal/common/type-abstraction.h>
 #include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/event/common/property-input-impl.h>
 #include <dali/internal/update/common/double-buffered.h>
@@ -125,7 +126,7 @@ public:
    * Create an doubleBuffered property.
    * @param [in] initialValue The initial value of the property.
    */
-  DoubleBufferedPropertyImpl( T initialValue )
+  DoubleBufferedPropertyImpl( typename ParameterType<T>::PassingType initialValue )
   : mValue( initialValue )
   {
   }
@@ -163,7 +164,7 @@ public:
    * @param[in] bufferIndex The buffer to write.
    * @param[in] value The new property value.
    */
-  void Set(BufferIndex bufferIndex, T value)
+  void Set(BufferIndex bufferIndex, typename ParameterType<T>::PassingType value )
   {
     // check if the value actually changed to avoid dirtying nodes unnecessarily
     if( mValue[bufferIndex] != value )
@@ -283,7 +284,7 @@ public:
   /**
    * Constructor
    */
-  DoubleBufferedProperty( Vector2 value ) : DoubleBufferedPropertyImpl( value ) {};
+  DoubleBufferedProperty( const Vector2& value ) : DoubleBufferedPropertyImpl( value ) {};
 
   /**
    * copydoc PropertyInputImpl::GetVector2
@@ -301,7 +302,7 @@ public:
   /**
    * Constructor
    */
-  DoubleBufferedProperty( Vector3 value ) : DoubleBufferedPropertyImpl( value ) {};
+  DoubleBufferedProperty( const Vector3& value ) : DoubleBufferedPropertyImpl( value ) {};
 
   /**
    * copydoc PropertyInputImpl::GetVector3
@@ -319,7 +320,7 @@ public:
   /**
    * Constructor
    */
-  DoubleBufferedProperty( Vector4 value ) : DoubleBufferedPropertyImpl( value ) {};
+  DoubleBufferedProperty( const Vector4& value ) : DoubleBufferedPropertyImpl( value ) {};
 
   /**
    * copydoc PropertyInputImpl::GetVector4
@@ -337,7 +338,7 @@ public:
   /**
    * Constructor
    */
-  DoubleBufferedProperty( Quaternion value ) : DoubleBufferedPropertyImpl( value ) {};
+  DoubleBufferedProperty( const Quaternion& value ) : DoubleBufferedPropertyImpl( value ) {};
 
   /**
    * copydoc PropertyInputImpl::GetQuaternion
@@ -355,7 +356,7 @@ public:
   /**
    * Constructor
    */
-  DoubleBufferedProperty( Matrix3 value ) : DoubleBufferedPropertyImpl( value ) {};
+  DoubleBufferedProperty( const Matrix3& value ) : DoubleBufferedPropertyImpl( value ) {};
 
   /**
    * copydoc PropertyInputImpl::GetMatrix3
@@ -373,7 +374,7 @@ public:
   /**
    * Constructor
    */
-  DoubleBufferedProperty( Matrix value ) : DoubleBufferedPropertyImpl( value ) {};
+  DoubleBufferedProperty( const Matrix& value ) : DoubleBufferedPropertyImpl( value ) {};
 
   /**
    * copydoc PropertyInputImpl::GetMatrix
index 238f223..0b4e23b 100644 (file)
@@ -266,7 +266,9 @@ public:
    */
   virtual void Process( BufferIndex updateBufferIndex )
   {
-    (mProperty->*mMemberFunction)( updateBufferIndex, mParam );
+    DALI_ASSERT_DEBUG( mProperty && "Message does not have an object" );
+    (mProperty->*mMemberFunction)( updateBufferIndex,
+                                   ParameterType< P >::PassObject( mParam ) );
   }
 
 private: