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

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

index ee31d1f..19ecb5c 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/devel-api/images/pixel-data-devel.h>
 #include <dali/devel-api/rendering/renderer-devel.h>
 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
+#include <dali/public-api/animation/constraints.h>
 #include <string.h>
 
 // INTERNAL HEADER
@@ -290,28 +291,22 @@ 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)
     {
-      if(!mColorConstraint)
-      {
-        mColorConstraint = Constraint::New<Vector4>(mImpl->mRenderer, shaderTextColorIndex, TextColorConstraint);
-        mColorConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex));
-      }
-      mColorConstraint.Apply();
+      Constraint colorConstraint = Constraint::New<Vector4>(mImpl->mRenderer, shaderTextColorIndex, TextColorConstraint);
+      colorConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex));
+      colorConstraint.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));
-      }
-      mOpacityConstraint.Apply();
+      Constraint opacityConstraint = Constraint::New<float>(mImpl->mRenderer, Dali::DevelRenderer::Property::OPACITY, OpacityConstraint);
+      opacityConstraint.AddSource(Source(actor, mAnimatableTextColorPropertyIndex));
+      opacityConstraint.Apply();
     }
   }
 
@@ -340,15 +335,6 @@ void TextVisual::RemoveRenderer(Actor& actor)
 
 void TextVisual::DoSetOffScene(Actor& actor)
 {
-  if(mColorConstraint)
-  {
-    mColorConstraint.Remove();
-  }
-  if(mOpacityConstraint)
-  {
-    mOpacityConstraint.Remove();
-  }
-
   RemoveRenderer(actor);
 
   // Resets the control handle.
index 7304f0f..7ae5e4e 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/animation/constraint.h>
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/object/weak-handle.h>
 
@@ -333,8 +332,6 @@ private:
   Text::ControllerPtr mController;                       ///< The text's controller.
   Text::TypesetterPtr mTypesetter;                       ///< The text's typesetter.
   WeakHandle<Actor>   mControl;                          ///< The control where the renderer is added.
-  Constraint          mColorConstraint{};                ///< Color constraint
-  Constraint          mOpacityConstraint{};              ///< Opacity constraint
   Property::Index     mAnimatableTextColorPropertyIndex; ///< The index of animatable text color property registered by the control.
   bool                mRendererUpdateNeeded : 1;         ///< The flag to indicate whether the renderer needs to be updated.
   RendererContainer   mRendererList;