[Tizen] Implement partial update
[platform/core/uifw/dali-core.git] / dali / internal / event / common / property-metadata.cpp
index d233e7e..aa4d607 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * 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.
 #include <dali/public-api/math/vector3.h>
 #include <dali/public-api/math/vector4.h>
 #include <dali/public-api/object/property.h>
+#include <dali/public-api/common/extents.h>
+#include <dali/public-api/math/matrix3.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/rect.h>
+#include <dali/public-api/object/property-map.h>
+#include <dali/public-api/object/property-array.h>
 
 namespace Dali
 {
@@ -53,18 +59,118 @@ void PropertyMetadata::SetPropertyValue( const Property::Value& propertyValue )
   switch ( GetType() )
   {
     case Property::NONE:
+    {
+      // NOOP
+      break;
+    }
+
     case Property::RECTANGLE:
+    {
+      Rect<int32_t> convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::STRING:
+    {
+      std::string convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::ARRAY:
+    {
+      Property::Array* array = propertyValue.GetArray();
+      if( array )
+      {
+        value = *array;
+      }
+      break;
+    }
+
     case Property::MAP:
+    {
+      Property::Map* map = propertyValue.GetMap();
+      if( map )
+      {
+        value = *map;
+      }
+      break;
+    }
+
+    case Property::EXTENTS:
+    {
+      Extents convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::BOOLEAN:
+    {
+      bool convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::INTEGER:
+    {
+      int32_t convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::FLOAT:
+    {
+      float convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::ROTATION:
+    {
+      Quaternion convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::MATRIX:
+    {
+      Matrix convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
+      break;
+    }
+
     case Property::MATRIX3:
     {
-      value = propertyValue;
+      Matrix3 convertedValue;
+      if( propertyValue.Get( convertedValue ) )
+      {
+        value = convertedValue;
+      }
       break;
     }
 
@@ -165,6 +271,7 @@ Property::Value PropertyMetadata::GetPropertyValue() const
       case Property::STRING:
       case Property::ARRAY:
       case Property::MAP:
+      case Property::EXTENTS:
       case Property::BOOLEAN:
       case Property::INTEGER:
       case Property::FLOAT:
@@ -262,6 +369,7 @@ void PropertyMetadata::AdjustPropertyValueBy( const Property::Value& relativePro
     case Property::STRING:
     case Property::ARRAY:
     case Property::MAP:
+    case Property::EXTENTS:
     case Property::MATRIX:
     case Property::MATRIX3:
     {
@@ -371,19 +479,19 @@ void PropertyMetadata::AdjustPropertyValueBy( const Property::Value& relativePro
 
         if( componentIndex == 0 )
         {
-          vector4Value.x = relativePropertyValue.Get< float >();
+          vector4Value.x += relativePropertyValue.Get< float >();
         }
         else if( componentIndex == 1 )
         {
-          vector4Value.y = relativePropertyValue.Get< float >();
+          vector4Value.y += relativePropertyValue.Get< float >();
         }
         else if( componentIndex == 2 )
         {
-          vector4Value.z = relativePropertyValue.Get< float >();
+          vector4Value.z += relativePropertyValue.Get< float >();
         }
         else if( componentIndex == 3 )
         {
-          vector4Value.w = relativePropertyValue.Get< float >();
+          vector4Value.w += relativePropertyValue.Get< float >();
         }
 
         value = vector4Value;