Block the changeness of PreMultiplied for some visuals 68/274268/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 25 Apr 2022 10:54:04 +0000 (19:54 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Mon, 25 Apr 2022 11:38:11 +0000 (20:38 +0900)
Svg, AnimatedVector, Text, and Gradient Visuals always use
PreMultiplied texture.
But PreMultiplied option is Visual::Base property.

So it was possible to change premultiplied option as false
even It's visual type is not allow it

This patch make some kind of visual that should not change the
PreMultiplied alpha flags don't change it.

Change-Id: I22e8416796493b34d2907f8043f57d31039be587
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
12 files changed:
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.h
dali-toolkit/internal/visuals/color/color-visual.cpp
dali-toolkit/internal/visuals/color/color-visual.h
dali-toolkit/internal/visuals/gradient/gradient-visual.cpp
dali-toolkit/internal/visuals/gradient/gradient-visual.h
dali-toolkit/internal/visuals/svg/svg-visual.cpp
dali-toolkit/internal/visuals/svg/svg-visual.h
dali-toolkit/internal/visuals/text/text-visual.cpp
dali-toolkit/internal/visuals/text/text-visual.h
dali-toolkit/internal/visuals/visual-base-impl.h

index 79e5a34..c17567a 100644 (file)
@@ -3456,7 +3456,7 @@ int UtcDaliVisualPremultipliedAlpha(void)
     DALI_TEST_EQUALS(value->Get<bool>(), false, TEST_LOCATION);
   }
 
     DALI_TEST_EQUALS(value->Get<bool>(), false, TEST_LOCATION);
   }
 
-  // svg visual ( premultiplied alpha by default is true )
+  // svg visual ( premultiplied alpha by default is true, and cannot change value )
   {
     Visual::Base imageVisual = factory.CreateVisual(
       Property::Map()
   {
     Visual::Base imageVisual = factory.CreateVisual(
       Property::Map()
@@ -3471,6 +3471,149 @@ int UtcDaliVisualPremultipliedAlpha(void)
     DALI_TEST_CHECK(value);
     DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
   }
     DALI_TEST_CHECK(value);
     DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
   }
+  {
+    Visual::Base imageVisual = factory.CreateVisual(
+      Property::Map()
+        .Add(Toolkit::Visual::Property::TYPE, Visual::IMAGE)
+        .Add(ImageVisual::Property::URL, TEST_SVG_FILE_NAME)
+        .Add(Visual::Property::PREMULTIPLIED_ALPHA, false));
+
+    Dali::Property::Map visualMap;
+    imageVisual.CreatePropertyMap(visualMap);
+    Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+    // test values
+    DALI_TEST_CHECK(value);
+    DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+  }
+
+  // animated vector visual ( premultiplied alpha by default is true, and cannot change value )
+  {
+    Visual::Base imageVisual = factory.CreateVisual(
+      Property::Map()
+        .Add(Toolkit::Visual::Property::TYPE, Visual::IMAGE)
+        .Add(ImageVisual::Property::URL, "something.json"));
+
+    Dali::Property::Map visualMap;
+    imageVisual.CreatePropertyMap(visualMap);
+    Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+    // test values
+    DALI_TEST_CHECK(value);
+    DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+  }
+  {
+    Visual::Base imageVisual = factory.CreateVisual(
+      Property::Map()
+        .Add(Toolkit::Visual::Property::TYPE, Visual::IMAGE)
+        .Add(ImageVisual::Property::URL, "something.json")
+        .Add(Visual::Property::PREMULTIPLIED_ALPHA, false));
+
+    Dali::Property::Map visualMap;
+    imageVisual.CreatePropertyMap(visualMap);
+    Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+    // test values
+    DALI_TEST_CHECK(value);
+    DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+  }
+
+  // text visual ( premultiplied alpha by default is true, and cannot change value )
+  {
+    Visual::Base textVisual = factory.CreateVisual(
+      Property::Map()
+        .Add(Toolkit::Visual::Property::TYPE, Visual::TEXT)
+        .Add(TextVisual::Property::TEXT, "Text"));
+
+    Dali::Property::Map visualMap;
+    textVisual.CreatePropertyMap(visualMap);
+    Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+    // test values
+    DALI_TEST_CHECK(value);
+    DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+  }
+  {
+    Visual::Base textVisual = factory.CreateVisual(
+      Property::Map()
+        .Add(Toolkit::Visual::Property::TYPE, Visual::TEXT)
+        .Add(TextVisual::Property::TEXT, "Text")
+        .Add(Visual::Property::PREMULTIPLIED_ALPHA, false));
+
+    Dali::Property::Map visualMap;
+    textVisual.CreatePropertyMap(visualMap);
+    Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+    // test values
+    DALI_TEST_CHECK(value);
+    DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+  }
+
+  // gradient visual ( premultiplied alpha by default is true, and cannot change value )
+  {
+    Visual::Base gradientVisual = factory.CreateVisual(
+      Property::Map()
+        .Add(Toolkit::Visual::Property::TYPE, Visual::GRADIENT)
+        .Add(GradientVisual::Property::START_POSITION, Vector2(-0.5f, -0.5f))
+        .Add(GradientVisual::Property::END_POSITION, Vector2(0.5f, 0.5f))
+        .Add(GradientVisual::Property::STOP_COLOR, Property::Array().Add(Color::RED).Add(Vector4(1.0f, 1.0f, 1.0f, 0.5f))));
+
+    Dali::Property::Map visualMap;
+    gradientVisual.CreatePropertyMap(visualMap);
+    Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+    // test values
+    DALI_TEST_CHECK(value);
+    DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+  }
+  {
+    Visual::Base gradientVisual = factory.CreateVisual(
+      Property::Map()
+        .Add(Toolkit::Visual::Property::TYPE, Visual::GRADIENT)
+        .Add(GradientVisual::Property::START_POSITION, Vector2(-0.5f, -0.5f))
+        .Add(GradientVisual::Property::END_POSITION, Vector2(0.5f, 0.5f))
+        .Add(GradientVisual::Property::STOP_COLOR, Property::Array().Add(Color::RED).Add(Vector4(1.0f, 1.0f, 1.0f, 0.5f)))
+        .Add(Visual::Property::PREMULTIPLIED_ALPHA, false));
+
+    Dali::Property::Map visualMap;
+    gradientVisual.CreatePropertyMap(visualMap);
+    Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+    // test values
+    DALI_TEST_CHECK(value);
+    DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+  }
+
+  // color visual ( premultiplied alpha by default is false, and cannot change value )
+  {
+    Visual::Base colorVisual = factory.CreateVisual(
+      Property::Map()
+        .Add(Toolkit::Visual::Property::TYPE, Visual::COLOR)
+        .Add(ColorVisual::Property::MIX_COLOR, Color::AQUA));
+
+    Dali::Property::Map visualMap;
+    colorVisual.CreatePropertyMap(visualMap);
+    Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+    // test values
+    DALI_TEST_CHECK(value);
+    DALI_TEST_EQUALS(value->Get<bool>(), false, TEST_LOCATION);
+  }
+  {
+    Visual::Base colorVisual = factory.CreateVisual(
+      Property::Map()
+        .Add(Toolkit::Visual::Property::TYPE, Visual::COLOR)
+        .Add(ColorVisual::Property::MIX_COLOR, Color::AQUA)
+        .Add(Visual::Property::PREMULTIPLIED_ALPHA, true));
+
+    Dali::Property::Map visualMap;
+    colorVisual.CreatePropertyMap(visualMap);
+    Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+    // test values
+    DALI_TEST_CHECK(value);
+    DALI_TEST_EQUALS(value->Get<bool>(), false, TEST_LOCATION);
+  }
 
   END_TEST;
 }
 
   END_TEST;
 }
@@ -4735,8 +4878,7 @@ int UtcDaliVisualGetVisualProperty01(void)
       UniformData("blurRadius", Property::Type::FLOAT),
       UniformData("borderlineWidth", Property::Type::FLOAT),
       UniformData("borderlineColor", Property::Type::VECTOR4),
       UniformData("blurRadius", Property::Type::FLOAT),
       UniformData("borderlineWidth", Property::Type::FLOAT),
       UniformData("borderlineColor", Property::Type::VECTOR4),
-      UniformData("borderlineOffset", Property::Type::FLOAT),
-      UniformData("preMultipliedAlpha", Property::Type::FLOAT)};
+      UniformData("borderlineOffset", Property::Type::FLOAT)};
 
   TestGraphicsController& graphics = application.GetGraphicsController();
   graphics.AddCustomUniforms(customUniforms);
 
   TestGraphicsController& graphics = application.GetGraphicsController();
   graphics.AddCustomUniforms(customUniforms);
@@ -4751,7 +4893,6 @@ int UtcDaliVisualGetVisualProperty01(void)
   propertyMap.Insert(DevelVisual::Property::BORDERLINE_WIDTH, 20.0f);
   propertyMap.Insert(DevelVisual::Property::BORDERLINE_COLOR, Color::RED);
   propertyMap.Insert(DevelVisual::Property::BORDERLINE_OFFSET, 1.0f);
   propertyMap.Insert(DevelVisual::Property::BORDERLINE_WIDTH, 20.0f);
   propertyMap.Insert(DevelVisual::Property::BORDERLINE_COLOR, Color::RED);
   propertyMap.Insert(DevelVisual::Property::BORDERLINE_OFFSET, 1.0f);
-  propertyMap.Insert(Visual::Property::PREMULTIPLIED_ALPHA, true);
   Visual::Base colorVisual = factory.CreateVisual(propertyMap);
 
   DummyControl        dummyControl = DummyControl::New(true);
   Visual::Base colorVisual = factory.CreateVisual(propertyMap);
 
   DummyControl        dummyControl = DummyControl::New(true);
@@ -4771,8 +4912,7 @@ int UtcDaliVisualGetVisualProperty01(void)
   float   targetBlurRadius      = 10.0f;
   float   targetBorderlineWidth = 25.0f;
   Vector4 targetBorderlineColor(1.0f, 1.0f, 1.0f, 1.0f);
   float   targetBlurRadius      = 10.0f;
   float   targetBorderlineWidth = 25.0f;
   Vector4 targetBorderlineColor(1.0f, 1.0f, 1.0f, 1.0f);
-  float   targetBorderlineOffset   = -1.0f;
-  float   targetPreMultipliedAlpha = 1.0f;
+  float   targetBorderlineOffset = -1.0f;
 
   Animation animation = Animation::New(1.0f);
   animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, Visual::Property::MIX_COLOR), targetColor);
 
   Animation animation = Animation::New(1.0f);
   animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, Visual::Property::MIX_COLOR), targetColor);
@@ -4830,10 +4970,6 @@ int UtcDaliVisualGetVisualProperty01(void)
   DALI_TEST_CHECK(borderlineOffsetValue);
   DALI_TEST_EQUALS(borderlineOffsetValue->Get<float>(), targetBorderlineOffset, TEST_LOCATION);
 
   DALI_TEST_CHECK(borderlineOffsetValue);
   DALI_TEST_EQUALS(borderlineOffsetValue->Get<float>(), targetBorderlineOffset, TEST_LOCATION);
 
-  Property::Value* preMultAlphaValue = resultMap.Find(Visual::Property::PREMULTIPLIED_ALPHA, Property::BOOLEAN);
-  DALI_TEST_CHECK(preMultAlphaValue);
-  DALI_TEST_EQUALS(preMultAlphaValue->Get<bool>(), bool(targetPreMultipliedAlpha), TEST_LOCATION);
-
   // Test uniform values
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", targetColor), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector2>("offset", targetOffset), true, TEST_LOCATION);
   // Test uniform values
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", targetColor), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector2>("offset", targetOffset), true, TEST_LOCATION);
@@ -4843,7 +4979,6 @@ int UtcDaliVisualGetVisualProperty01(void)
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("borderlineWidth", targetBorderlineWidth), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("borderlineColor", targetBorderlineColor), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("borderlineOffset", targetBorderlineOffset), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("borderlineWidth", targetBorderlineWidth), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("borderlineColor", targetBorderlineColor), true, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("borderlineOffset", targetBorderlineOffset), true, TEST_LOCATION);
-  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("preMultipliedAlpha", targetPreMultipliedAlpha), true, TEST_LOCATION);
 
   // Test unregistered visual
   Property property3 = DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL2, Visual::Property::MIX_COLOR);
 
   // Test unregistered visual
   Property property3 = DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL2, Visual::Property::MIX_COLOR);
index 440dbd4..a7d1f76 100644 (file)
@@ -190,6 +190,15 @@ void AnimatedVectorImageVisual::DoCreateInstancePropertyMap(Property::Map& map)
   // Do nothing
 }
 
   // Do nothing
 }
 
+void AnimatedVectorImageVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+  // Make always enable pre multiplied alpha whether preMultiplied value is false.
+  if(!preMultiplied)
+  {
+    DALI_LOG_WARNING("Note : AnimatedVectorVisual cannot disable PreMultipliedAlpha\n");
+  }
+}
+
 void AnimatedVectorImageVisual::DoSetProperties(const Property::Map& propertyMap)
 {
   // url already passed in from constructor
 void AnimatedVectorImageVisual::DoSetProperties(const Property::Map& propertyMap)
 {
   // url already passed in from constructor
index 4f1a859..4b14fc3 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_ANIMATED_VECTOR_IMAGE_VISUAL_H
 
 /*
 #define DALI_TOOLKIT_INTERNAL_ANIMATED_VECTOR_IMAGE_VISUAL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -93,6 +93,11 @@ public: // from Visual
    */
   void DoCreateInstancePropertyMap(Property::Map& map) const override;
 
    */
   void DoCreateInstancePropertyMap(Property::Map& map) const override;
 
+  /**
+   * @copydoc Visual::Base::EnablePreMultipliedAlpha
+   */
+  void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
 protected: // From VectorAnimationManager::LifecycleObserver:
   /**
    * @copydoc VectorAnimationManager::LifecycleObserver::VectorAnimationManagerDestroyed()
 protected: // From VectorAnimationManager::LifecycleObserver:
   /**
    * @copydoc VectorAnimationManager::LifecycleObserver::VectorAnimationManagerDestroyed()
index 60899bd..8dfc168 100644 (file)
@@ -176,6 +176,15 @@ void ColorVisual::DoCreateInstancePropertyMap(Property::Map& map) const
   // Do nothing
 }
 
   // Do nothing
 }
 
+void ColorVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+  // Make always disable pre multiplied alpha whether preMultiplied value is true.
+  if(preMultiplied)
+  {
+    DALI_LOG_WARNING("Note : ColorVisual cannot enable PreMultipliedAlpha\n");
+  }
+}
+
 void ColorVisual::OnSetTransform()
 {
   if(mImpl->mRenderer)
 void ColorVisual::OnSetTransform()
 {
   if(mImpl->mRenderer)
index 5edf2ba..bb8bc95 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H
 
 /*
 #define DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -65,6 +65,11 @@ public: // from Visual
    */
   void DoCreateInstancePropertyMap(Property::Map& map) const override;
 
    */
   void DoCreateInstancePropertyMap(Property::Map& map) const override;
 
+  /**
+   * @copydoc Visual::Base::EnablePreMultipliedAlpha
+   */
+  void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
 protected:
   /**
    * @brief Constructor.
 protected:
   /**
    * @brief Constructor.
index 648ffcc..cef1ef4 100644 (file)
@@ -238,6 +238,15 @@ void GradientVisual::DoCreateInstancePropertyMap(Property::Map& map) const
   // Do nothing
 }
 
   // Do nothing
 }
 
+void GradientVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+  // Make always enable pre multiplied alpha whether preMultiplied value is false.
+  if(!preMultiplied)
+  {
+    DALI_LOG_WARNING("Note : GradientVisual cannot disable PreMultipliedAlpha\n");
+  }
+}
+
 void GradientVisual::OnInitialize()
 {
   Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
 void GradientVisual::OnInitialize()
 {
   Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
index 40223b8..9a471d4 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_GRADIENT_VISUAL_H
 
 /*
 #define DALI_TOOLKIT_INTERNAL_GRADIENT_VISUAL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -101,6 +101,11 @@ public: // from Visual
    */
   void DoCreateInstancePropertyMap(Property::Map& map) const override;
 
    */
   void DoCreateInstancePropertyMap(Property::Map& map) const override;
 
+  /**
+   * @copydoc Visual::Base::EnablePreMultipliedAlpha
+   */
+  void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
 protected:
   /**
    * @brief Constructor.
 protected:
   /**
    * @brief Constructor.
index 80c6958..9a47462 100644 (file)
@@ -208,6 +208,15 @@ void SvgVisual::DoCreateInstancePropertyMap(Property::Map& map) const
   // Do nothing
 }
 
   // Do nothing
 }
 
+void SvgVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+  // Make always enable pre multiplied alpha whether preMultiplied value is false.
+  if(!preMultiplied)
+  {
+    DALI_LOG_WARNING("Note : SvgVisual cannot disable PreMultipliedAlpha\n");
+  }
+}
+
 void SvgVisual::Load()
 {
   // load remote resource on svg rasterize thread.
 void SvgVisual::Load()
 {
   // load remote resource on svg rasterize thread.
index 2f49e16..c005691 100644 (file)
@@ -92,6 +92,11 @@ public: // from Visual
    */
   void DoCreateInstancePropertyMap(Property::Map& map) const override;
 
    */
   void DoCreateInstancePropertyMap(Property::Map& map) const override;
 
+  /**
+   * @copydoc Visual::Base::EnablePreMultipliedAlpha
+   */
+  void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
 protected:
   /**
    * @brief Constructor.
 protected:
   /**
    * @brief Constructor.
index a7d6ae7..9b0e811 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/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/integration-api/debug.h>
 #include <string.h>
 
 // INTERNAL HEADER
 #include <string.h>
 
 // INTERNAL HEADER
@@ -239,6 +240,15 @@ void TextVisual::DoCreateInstancePropertyMap(Property::Map& map) const
   map.Insert(Toolkit::TextVisual::Property::TEXT, text);
 }
 
   map.Insert(Toolkit::TextVisual::Property::TEXT, text);
 }
 
+void TextVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+  // Make always enable pre multiplied alpha whether preMultiplied value is false.
+  if(!preMultiplied)
+  {
+    DALI_LOG_WARNING("Note : TextVisual cannot disable PreMultipliedAlpha\n");
+  }
+}
+
 TextVisual::TextVisual(VisualFactoryCache& factoryCache)
 : Visual::Base(factoryCache, Visual::FittingMode::FIT_KEEP_ASPECT_RATIO, Toolkit::Visual::TEXT),
   mController(Text::Controller::New()),
 TextVisual::TextVisual(VisualFactoryCache& factoryCache)
 : Visual::Base(factoryCache, Visual::FittingMode::FIT_KEEP_ASPECT_RATIO, Toolkit::Visual::TEXT),
   mController(Text::Controller::New()),
@@ -247,6 +257,8 @@ TextVisual::TextVisual(VisualFactoryCache& factoryCache)
   mTextColorAnimatableIndex(Property::INVALID_INDEX),
   mRendererUpdateNeeded(false)
 {
   mTextColorAnimatableIndex(Property::INVALID_INDEX),
   mRendererUpdateNeeded(false)
 {
+  // Enable the pre-multiplied alpha to improve the text quality
+  mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
 }
 
 TextVisual::~TextVisual()
 }
 
 TextVisual::~TextVisual()
@@ -294,9 +306,6 @@ void TextVisual::DoSetOnScene(Actor& actor)
 
   mImpl->mRenderer.SetProperty(Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::CONTENT);
 
 
   mImpl->mRenderer.SetProperty(Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::CONTENT);
 
-  // Enable the pre-multiplied alpha to improve the text quality
-  EnablePreMultipliedAlpha(true);
-
   const Vector4& defaultColor = mController->GetTextModel()->GetDefaultColor();
   if(mTextColorAnimatableIndex == Property::INVALID_INDEX)
   {
   const Vector4& defaultColor = mController->GetTextModel()->GetDefaultColor();
   if(mTextColorAnimatableIndex == Property::INVALID_INDEX)
   {
index 8474441..fa7ca4e 100644 (file)
@@ -143,6 +143,11 @@ public: // from Visual::Base
    */
   void DoCreateInstancePropertyMap(Property::Map& map) const override;
 
    */
   void DoCreateInstancePropertyMap(Property::Map& map) const override;
 
+  /**
+   * @copydoc Visual::Base::EnablePreMultipliedAlpha
+   */
+  void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
 protected:
   /**
    * @brief Constructor.
 protected:
   /**
    * @brief Constructor.
index 336a62d..20b0bd9 100644 (file)
@@ -155,7 +155,7 @@ public:
    *
    * @param[in] preMultiplied whether alpha is pre-multiplied.
    */
    *
    * @param[in] preMultiplied whether alpha is pre-multiplied.
    */
-  void EnablePreMultipliedAlpha(bool preMultiplied);
+  virtual void EnablePreMultipliedAlpha(bool preMultiplied);
 
   /**
    * @brief Query whether alpha is pre-multiplied.
 
   /**
    * @brief Query whether alpha is pre-multiplied.