Revert "[Tizen] Fix text visual issue"
authorTaehyub Kim <taehyub.kim@samsung.com>
Tue, 9 Nov 2021 03:21:21 +0000 (12:21 +0900)
committerTaehyub Kim <taehyub.kim@samsung.com>
Tue, 9 Nov 2021 03:21:21 +0000 (12:21 +0900)
This reverts commit ac48c2f2032599e2edbb4743abc160bc406b601f.

dali-toolkit/internal/visuals/text/text-visual.cpp
dali-toolkit/internal/visuals/text/text-visual.h

index a4903c5..ee31d1f 100644 (file)
@@ -239,7 +239,6 @@ TextVisual::TextVisual(VisualFactoryCache& factoryCache)
   mController(Text::Controller::New()),
   mTypesetter(Text::Typesetter::New(mController->GetTextModel())),
   mAnimatableTextColorPropertyIndex(Property::INVALID_INDEX),
-  mTextColorAnimatableIndex(Property::INVALID_INDEX),
   mRendererUpdateNeeded(false)
 {
 }
@@ -291,36 +290,29 @@ void TextVisual::DoSetOnScene(Actor& actor)
   // Enable the pre-multiplied alpha to improve the text quality
   EnablePreMultipliedAlpha(true);
 
-  const Vector4& defaultColor = mController->GetTextModel()->GetDefaultColor();
-  if(mTextColorAnimatableIndex == Property::INVALID_INDEX)
-  {
-    mTextColorAnimatableIndex = mImpl->mRenderer.RegisterProperty("uTextColorAnimatable", defaultColor);
-  }
-  else
-  {
-    mImpl->mRenderer.SetProperty(mTextColorAnimatableIndex, 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(mTextColorAnimatableIndex != Property::INVALID_INDEX)
+    if(shaderTextColorIndex != Property::INVALID_INDEX)
     {
       if(!mColorConstraint)
       {
-        mColorConstraint = Constraint::New<Vector4>(mImpl->mRenderer, mTextColorAnimatableIndex, TextColorConstraint);
+        mColorConstraint = Constraint::New<Vector4>(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
-    if(!mOpacityConstraint)
-    {
-      mOpacityConstraint = Constraint::New<float>(mImpl->mRenderer, Dali::DevelRenderer::Property::OPACITY, OpacityConstraint);
-      mOpacityConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex));
+      // Make zero if the alpha value of text color is zero to skip rendering text
+      if(!mOpacityConstraint)
+      {
+        mOpacityConstraint = Constraint::New<float>(mImpl->mRenderer, Dali::DevelRenderer::Property::OPACITY, OpacityConstraint);
+        mOpacityConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex));
+      }
+      mOpacityConstraint.Apply();
     }
-    mOpacityConstraint.Apply();
   }
 
   // Renderer needs textures and to be added to control
index f9d6c79..7304f0f 100644 (file)
@@ -336,7 +336,6 @@ private:
   Constraint          mColorConstraint{};                ///< Color constraint
   Constraint          mOpacityConstraint{};              ///< Opacity constraint
   Property::Index     mAnimatableTextColorPropertyIndex; ///< The index of animatable text color property registered by the control.
-  Property::Index     mTextColorAnimatableIndex;         ///< The index of uTextColorAnimatable property.
   bool                mRendererUpdateNeeded : 1;         ///< The flag to indicate whether the renderer needs to be updated.
   RendererContainer   mRendererList;
 };