X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fanimated-vector-image%2Fanimated-vector-image-visual.cpp;h=75b71f265e095fdcd61c1d5bc643a15c473f6dd9;hp=c6604ada6704ec901b67fa8e4c39df40e841083e;hb=e0c063be9e7ecde0e5665079289489d456828abf;hpb=bed9d1fafb2def9ec59d67277a4935a9f7fcbdd1 diff --git a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp index c6604ad..75b71f2 100644 --- a/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp @@ -25,6 +25,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -283,20 +284,7 @@ void AnimatedVectorImageVisual::DoSetProperty(Property::Index index, const Prope void AnimatedVectorImageVisual::OnInitialize(void) { - Shader shader; - - if(mImpl->mCustomShader) - { - shader = Shader::New(mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource().data() : mImpl->mCustomShader->mVertexShader, - mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource().data() : mImpl->mCustomShader->mFragmentShader, - mImpl->mCustomShader->mHints); - - shader.RegisterProperty(PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT); - } - else - { - shader = mImageVisualShaderFactory.GetShader(mFactoryCache, false, true, IsRoundedCornerRequired()); - } + Shader shader = GenerateShader(); Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY); @@ -318,14 +306,10 @@ void AnimatedVectorImageVisual::DoSetOnScene(Actor& actor) if(mLoadFailed) { - TextureSet textureSet = TextureSet::New(); - mImpl->mRenderer.SetTextures(textureSet); - - Texture brokenImage = mFactoryCache.GetBrokenVisualImage(); - textureSet.SetTexture(0u, brokenImage); - + Vector2 imageSize = Vector2::ZERO; + imageSize = actor.GetProperty(Actor::Property::SIZE).Get(); + mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize); actor.AddRenderer(mImpl->mRenderer); - ResourceReady(Toolkit::Visual::ResourceStatus::FAILED); } else @@ -405,6 +389,15 @@ void AnimatedVectorImageVisual::OnSetTransform() } } +void AnimatedVectorImageVisual::UpdateShader() +{ + if(mImpl->mRenderer) + { + Shader shader = GenerateShader(); + mImpl->mRenderer.SetShader(shader); + } +} + void AnimatedVectorImageVisual::OnDoAction(const Property::Index actionId, const Property::Value& attributes) { // Check if action is valid for this visual type and perform action if possible @@ -453,15 +446,6 @@ void AnimatedVectorImageVisual::OnDoAction(const Property::Index actionId, const } break; } - case DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY: - { - const Property::Map* map = attributes.GetMap(); - if(map) - { - DoSetProperties(*map); - } - break; - } } TriggerVectorRasterization(); @@ -627,6 +611,30 @@ void AnimatedVectorImageVisual::OnProcessEvents() mEventCallback = nullptr; // The callback will be deleted in the VectorAnimationManager } +Shader AnimatedVectorImageVisual::GenerateShader() const +{ + Shader shader; + if(mImpl->mCustomShader) + { + shader = Shader::New(mImpl->mCustomShader->mVertexShader.empty() ? mImageVisualShaderFactory.GetVertexShaderSource().data() : mImpl->mCustomShader->mVertexShader, + mImpl->mCustomShader->mFragmentShader.empty() ? mImageVisualShaderFactory.GetFragmentShaderSource().data() : mImpl->mCustomShader->mFragmentShader, + mImpl->mCustomShader->mHints); + + shader.RegisterProperty(PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT); + } + else + { + shader = mImageVisualShaderFactory.GetShader( + mFactoryCache, + ImageVisualShaderFeature::FeatureBuilder() + .EnableRoundedCorner(IsRoundedCornerRequired()) + .EnableBorderline(IsBorderlineRequired()) + ); + } + return shader; +} + + } // namespace Internal } // namespace Toolkit