+ mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
+}
+
+Shader ColorVisual::GenerateShader() const
+{
+ Shader shader;
+ VisualFactoryCache::ShaderType shaderType;
+
+ bool roundedCorner = IsRoundedCornerRequired();
+ bool borderline = IsBorderlineRequired();
+ bool blur = IsBlurRequired();
+ int shaderTypeFlag = ColorVisualRequireFlag::DEFAULT;
+
+ if(roundedCorner)
+ {
+ shaderTypeFlag |= ColorVisualRequireFlag::ROUNDED_CORNER;
+ }
+ if(blur)
+ {
+ // If we use blur, just ignore borderline
+ borderline = false;
+ shaderTypeFlag |= ColorVisualRequireFlag::BLUR;
+ }
+ if(borderline)
+ {
+ shaderTypeFlag |= ColorVisualRequireFlag::BORDERLINE;
+ }
+
+ shaderType = SHADER_TYPE_TABLE[shaderTypeFlag];
+ shader = mFactoryCache.GetShader(shaderType);
+ if(!shader)
+ {
+ std::string vertexShaderPrefixList;
+ std::string fragmentShaderPrefixList;
+ if(roundedCorner)
+ {
+ vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
+ }
+ if(blur)
+ {
+ vertexShaderPrefixList += "#define IS_REQUIRED_BLUR\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_BLUR\n";
+ }
+ if(borderline)
+ {
+ vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
+ }
+ shader = Shader::New(Dali::Shader::GetVertexShaderPrefix() + vertexShaderPrefixList + SHADER_COLOR_VISUAL_SHADER_VERT.data(),
+ Dali::Shader::GetFragmentShaderPrefix() + fragmentShaderPrefixList + SHADER_COLOR_VISUAL_SHADER_FRAG.data());
+ mFactoryCache.SaveShader(shaderType, shader);
+ }
+
+ return shader;
+}
+
+Dali::Property ColorVisual::OnGetPropertyObject(Dali::Property::Key key)
+{
+ if(!mImpl->mRenderer)
+ {
+ Handle handle;
+ return Dali::Property(handle, Property::INVALID_INDEX);
+ }
+
+ if((key.type == Property::Key::INDEX && key.indexKey == DevelColorVisual::Property::BLUR_RADIUS) || (key.type == Property::Key::STRING && key.stringKey == BLUR_RADIUS_NAME))
+ {
+ const bool updateShader = !mImpl->mCustomShader && !IsBlurRequired();
+
+ // Blur is animated now. we always have to use blur feature.
+ mAlwaysUsingBlurRadius = true;
+
+ if(updateShader)
+ {
+ // Update each values to renderer
+ DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBlurRadiusUniform();
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BLUR_RADIUS, mBlurRadius);
+
+ // Change shader
+ UpdateShader();
+ }
+ mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+ return Dali::Property(mImpl->mRenderer, DecoratedVisualRenderer::Property::BLUR_RADIUS);
+ }
+
+ Handle handle;
+ return Dali::Property(handle, Property::INVALID_INDEX);
+}
+
+bool ColorVisual::IsBlurRequired() const
+{
+ float blurRadius = mBlurRadius;
+ if(mImpl->mRenderer)
+ {
+ // Update values from Renderer
+ blurRadius = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BLUR_RADIUS);
+ }
+ return mAlwaysUsingBlurRadius || !EqualsZero(blurRadius);