Corner Radius become Vector4
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / visual-base-impl.cpp
index 331eaf5..528bc14 100644 (file)
@@ -219,10 +219,26 @@ void Visual::Base::SetProperties(const Property::Map& propertyMap)
       }
       case Toolkit::DevelVisual::Property::CORNER_RADIUS:
       {
-        float radius;
-        if(value.Get(radius))
+        if(value.GetType() == Property::VECTOR4)
         {
-          mImpl->mCornerRadius = radius;
+          // If CORNER_RADIUS Property is Vector4,
+          // Each values mean the radius of
+          // (top-left, top-right, bottom-right, bottom-left)
+          Vector4 radius;
+          if(value.Get(radius))
+          {
+            mImpl->mCornerRadius = radius;
+          }
+        }
+        else
+        {
+          // If CORNER_RADIUS Property is float,
+          // Every corner radius have same value
+          float radius;
+          if(value.Get(radius))
+          {
+            mImpl->mCornerRadius = Vector4(radius, radius, radius, radius);
+          }
         }
         break;
       }
@@ -370,7 +386,7 @@ void Visual::Base::CreatePropertyMap(Property::Map& map) const
     }
     if(mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
     {
-      mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<float>(mImpl->mCornerRadiusIndex);
+      mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<Vector4>(mImpl->mCornerRadiusIndex);
     }
   }
 
@@ -449,9 +465,9 @@ bool Visual::Base::IsRoundedCornerRequired() const
   if(mImpl->mRenderer && mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
   {
     // Update values from Renderer
-    mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<float>(mImpl->mCornerRadiusIndex);
+    mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<Vector4>(mImpl->mCornerRadiusIndex);
   }
-  return !EqualsZero(mImpl->mCornerRadius) || mImpl->mNeedCornerRadius;
+  return !(mImpl->mCornerRadius == Vector4::ZERO) || mImpl->mNeedCornerRadius;
 }
 
 void Visual::Base::OnDoAction(const Property::Index actionId, const Property::Value& attributes)