X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Ftext%2Ftext-visual.cpp;h=ee31d1f99fac57f23a1ab65039287a8aff9ebc07;hp=870ac092a2a1b8f378605fa6d0a62b196d0cc533;hb=37cb9a8e7c94ea7153434d6b0b87a6f08bb9191f;hpb=ac501f02feab8e2fb7e613f936d3d5a511603001 diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index 870ac09..ee31d1f 100644 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -20,11 +20,9 @@ // EXTERNAL INCLUDES #include -#include #include #include #include -#include #include // INTERNAL HEADER @@ -292,22 +290,28 @@ void TextVisual::DoSetOnScene(Actor& actor) // Enable the pre-multiplied alpha to improve the text quality EnablePreMultipliedAlpha(true); - const Vector4& defaultColor = mController->GetTextModel()->GetDefaultColor(); - Dali::Property::Index shaderTextColorIndex = mImpl->mRenderer.RegisterProperty("uTextColorAnimatable", defaultColor); - if(mAnimatableTextColorPropertyIndex != Property::INVALID_INDEX) { + const Vector4& defaultColor = mController->GetTextModel()->GetDefaultColor(); + Dali::Property::Index shaderTextColorIndex = mImpl->mRenderer.RegisterProperty("uTextColorAnimatable", defaultColor); + // Create constraint for the animatable text's color Property with uTextColorAnimatable in the renderer. if(shaderTextColorIndex != Property::INVALID_INDEX) { - Constraint colorConstraint = Constraint::New(mImpl->mRenderer, shaderTextColorIndex, TextColorConstraint); - colorConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex)); - colorConstraint.Apply(); + if(!mColorConstraint) + { + mColorConstraint = Constraint::New(mImpl->mRenderer, shaderTextColorIndex, TextColorConstraint); + mColorConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex)); + } + mColorConstraint.Apply(); // Make zero if the alpha value of text color is zero to skip rendering text - Constraint opacityConstraint = Constraint::New(mImpl->mRenderer, Dali::DevelRenderer::Property::OPACITY, OpacityConstraint); - opacityConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex)); - opacityConstraint.Apply(); + if(!mOpacityConstraint) + { + mOpacityConstraint = Constraint::New(mImpl->mRenderer, Dali::DevelRenderer::Property::OPACITY, OpacityConstraint); + mOpacityConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex)); + } + mOpacityConstraint.Apply(); } } @@ -336,6 +340,15 @@ void TextVisual::RemoveRenderer(Actor& actor) void TextVisual::DoSetOffScene(Actor& actor) { + if(mColorConstraint) + { + mColorConstraint.Remove(); + } + if(mOpacityConstraint) + { + mOpacityConstraint.Remove(); + } + RemoveRenderer(actor); // Resets the control handle. @@ -474,15 +487,7 @@ void TextVisual::UpdateRenderer() return; } - Dali::LayoutDirection::Type layoutDirection; - if(mController->IsMatchSystemLanguageDirection()) - { - layoutDirection = static_cast(DevelWindow::Get(control).GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); - } - else - { - layoutDirection = static_cast(control.GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); - } + Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(control); const Text::Controller::UpdateTextType updateTextType = mController->Relayout(relayoutSize, layoutDirection);