X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali-toolkit%2Finternal%2Fvisuals%2Fcolor%2Fcolor-visual.cpp;h=31e0c55257e8f7c7ca4dba11022c26924349283f;hb=48000ec3ab1ca2d1f8001d192112e32357bb1dfc;hp=9863364499f51325be4ea2b672fa34399f1e61e9;hpb=f51ffaad996b84e52bd9b7120aad47a2ccf35cd4;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/color/color-visual.cpp b/dali-toolkit/internal/visuals/color/color-visual.cpp index 9863364..31e0c55 100644 --- a/dali-toolkit/internal/visuals/color/color-visual.cpp +++ b/dali-toolkit/internal/visuals/color/color-visual.cpp @@ -23,7 +23,7 @@ #include //INTERNAL INCLUDES -#include +#include #include #include #include @@ -72,7 +72,7 @@ ColorVisual::ColorVisual(VisualFactoryCache& factoryCache) : Visual::Base(factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::COLOR), mBlurRadius(0.0f), mBlurRadiusIndex(Property::INVALID_INDEX), - mNeedBlurRadius(false) + mAlwaysUsingBlurRadius(false) { } @@ -114,6 +114,27 @@ void ColorVisual::DoSetProperties(const Property::Map& propertyMap) { DALI_LOG_ERROR("ColorVisual:DoSetProperties:: BLUR_RADIUS property has incorrect type: %d\n", blurRadiusValue->GetType()); } + + if(mBlurRadiusIndex != Property::INVALID_INDEX) + { + mImpl->mRenderer.SetProperty(mBlurRadiusIndex, mBlurRadius); + } + else if(DALI_UNLIKELY(mImpl->mRenderer && (!EqualsZero(mBlurRadius) || mAlwaysUsingBlurRadius))) + { + // Unusual case. SetProperty called after OnInitialize(). + // Assume that DoAction call UPDATE_PROPERTY. + // We must regist properies into renderer, and update shader. + + // BlurRadius added by this action. Regist property to renderer. + mBlurRadiusIndex = mImpl->mRenderer.RegisterProperty(DevelColorVisual::Property::BLUR_RADIUS, BLUR_RADIUS_NAME, mBlurRadius); + mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON); + + // Change the shader must not be occured many times. we always have to use blur feature. + mAlwaysUsingBlurRadius = true; + + // Change shader + UpdateShader(); + } } } @@ -161,23 +182,6 @@ void ColorVisual::OnSetTransform() } } -void ColorVisual::OnDoAction(const Property::Index actionId, const Property::Value& attributes) -{ - // Check if action is valid for this visual type and perform action if possible - switch(actionId) - { - case DevelColorVisual::Action::UPDATE_PROPERTY: - { - const Property::Map* map = attributes.GetMap(); - if(map) - { - DoSetProperties(*map); - } - break; - } - } -} - void ColorVisual::UpdateShader() { if(mImpl->mRenderer) @@ -217,7 +221,7 @@ Shader ColorVisual::GenerateShader() const bool roundedCorner = IsRoundedCornerRequired(); bool borderline = IsBorderlineRequired(); - bool blur = !EqualsZero(mBlurRadius) || mNeedBlurRadius; + bool blur = !EqualsZero(mBlurRadius) || mAlwaysUsingBlurRadius; int shaderTypeFlag = ColorVisualRequireFlag::DEFAULT; if(roundedCorner) @@ -276,9 +280,10 @@ Dali::Property ColorVisual::OnGetPropertyObject(Dali::Property::Key key) { mBlurRadiusIndex = mImpl->mRenderer.RegisterProperty(DevelColorVisual::Property::BLUR_RADIUS, BLUR_RADIUS_NAME, mBlurRadius); - mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON); + // Blur is animated now. we always have to use blur feature. + mAlwaysUsingBlurRadius = true; - mNeedBlurRadius = true; + mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON); // Change shader UpdateShader();