Remove Geometry::QUAD() usage in Toolkit
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / renderers / control-renderer-impl.cpp
index 7ac2490..4155a9c 100644 (file)
@@ -56,24 +56,30 @@ ControlRenderer::~ControlRenderer()
   delete mImpl;
 }
 
-void ControlRenderer::Initialize( Actor& actor, const Property::Map& propertyMap )
+void ControlRenderer::SetCustomShader( const Property::Map& shaderMap )
 {
   if( mImpl->mCustomShader )
   {
-    mImpl->mCustomShader->SetPropertyMap( propertyMap );
+    mImpl->mCustomShader->SetPropertyMap( shaderMap );
   }
   else
   {
-    Property::Value* customShaderValue = propertyMap.Find( CUSTOM_SHADER );
-    if( customShaderValue )
+   mImpl->mCustomShader = new Impl::CustomShader( shaderMap );
+  }
+}
+
+void ControlRenderer::Initialize( Actor& actor, const Property::Map& propertyMap )
+{
+  Property::Value* customShaderValue = propertyMap.Find( CUSTOM_SHADER );
+  if( customShaderValue )
+  {
+    Property::Map shaderMap;
+    if( customShaderValue->Get( shaderMap ) )
     {
-      Property::Map customShader;
-      if( customShaderValue->Get( customShader ) )
-      {
-        mImpl->mCustomShader = new Impl::CustomShader( propertyMap );
-      }
+      SetCustomShader( shaderMap );
     }
   }
+
   DoInitialize( actor, propertyMap );
 }
 
@@ -94,7 +100,6 @@ void ControlRenderer::GetNaturalSize( Vector2& naturalSize ) const
 
 void ControlRenderer::SetClipRect( const Rect<int>& clipRect )
 {
-  mImpl->mClipRect = clipRect;
 }
 
 void ControlRenderer::SetOffset( const Vector2& offset )
@@ -107,7 +112,7 @@ void ControlRenderer::SetDepthIndex( float index )
   mImpl->mDepthIndex = index;
   if( mImpl->mRenderer )
   {
-    mImpl->mRenderer.SetDepthIndex( mImpl->mDepthIndex );
+    mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex );
   }
 }
 
@@ -120,7 +125,8 @@ void ControlRenderer::SetOnStage( Actor& actor )
 {
   DoSetOnStage( actor );
 
-  mImpl->mRenderer.SetDepthIndex( mImpl->mDepthIndex );
+  mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled());
+  mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex );
   actor.AddRenderer( mImpl->mRenderer );
   mImpl->mFlags |= Impl::IS_ON_STAGE;
 }
@@ -135,6 +141,28 @@ void ControlRenderer::SetOffStage( Actor& actor )
   }
 }
 
+void ControlRenderer::EnablePreMultipliedAlpha( bool preMultipled )
+{
+  if(preMultipled)
+  {
+    mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
+  }
+  else
+  {
+    mImpl->mFlags &= ~Impl::IS_PREMULTIPLIED_ALPHA;
+  }
+
+  if( mImpl->mRenderer )
+  {
+    mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, preMultipled);
+  }
+}
+
+bool ControlRenderer::IsPreMultipliedAlphaEnabled() const
+{
+  return mImpl->mFlags & Impl::IS_PREMULTIPLIED_ALPHA;
+}
+
 void ControlRenderer::DoSetOnStage( Actor& actor )
 {
 }