Merge "Resolve incorrect position for Ellipsis when mixed LTR & RTL languages and...
authorBowon Ryu <bowon.ryu@samsung.com>
Thu, 9 Jun 2022 09:49:27 +0000 (09:49 +0000)
committerGerrit Code Review <gerrit@review>
Thu, 9 Jun 2022 09:49:27 +0000 (09:49 +0000)
47 files changed:
automated-tests/src/dali-toolkit/utc-Dali-Transition.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
build/tizen/dali-scene-loader/CMakeLists.txt
dali-toolkit/devel-api/styling/style-manager-devel.cpp
dali-toolkit/devel-api/styling/style-manager-devel.h
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/graphics/shaders/animated-gradient-visual-shader.vert
dali-toolkit/internal/graphics/shaders/arc-visual-shader.vert
dali-toolkit/internal/graphics/shaders/border-visual-shader.vert
dali-toolkit/internal/graphics/shaders/color-visual-shader.frag
dali-toolkit/internal/graphics/shaders/color-visual-shader.vert
dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag
dali-toolkit/internal/graphics/shaders/gradient-visual-shader.vert
dali-toolkit/internal/graphics/shaders/image-visual-shader.frag
dali-toolkit/internal/graphics/shaders/image-visual-shader.vert
dali-toolkit/internal/graphics/shaders/mesh-visual-normal-map-shader.vert
dali-toolkit/internal/graphics/shaders/mesh-visual-shader.vert
dali-toolkit/internal/graphics/shaders/mesh-visual-simple-shader.vert
dali-toolkit/internal/graphics/shaders/npatch-visual-3x3-shader.vert
dali-toolkit/internal/graphics/shaders/npatch-visual-shader.vert
dali-toolkit/internal/graphics/shaders/primitive-visual-shader.vert
dali-toolkit/internal/graphics/shaders/text-scroller-shader.vert
dali-toolkit/internal/graphics/shaders/text-visual-shader.vert
dali-toolkit/internal/graphics/shaders/wireframe-visual-shader.vert
dali-toolkit/internal/styling/style-manager-impl.cpp
dali-toolkit/internal/styling/style-manager-impl.h
dali-toolkit/internal/text/markup-processor.cpp
dali-toolkit/internal/text/multi-language-support-impl.cpp
dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp
dali-toolkit/internal/text/rendering/text-typesetter.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller-relayouter.cpp
dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp
dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp
dali-toolkit/internal/visuals/animated-vector-image/animated-vector-image-visual.cpp
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/image-visual-shader-factory.cpp
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/svg/svg-visual.cpp
dali-toolkit/internal/visuals/visual-base-data-impl.cpp
dali-toolkit/internal/visuals/visual-base-data-impl.h
dali-toolkit/internal/visuals/visual-base-impl.cpp
dali-toolkit/internal/visuals/visual-base-impl.h
dali-toolkit/internal/visuals/visual-factory-impl.cpp

index 332e771..784af73 100644 (file)
@@ -24,6 +24,7 @@
 #include <dali-toolkit/public-api/transition/transition-set.h>
 #include <dali-toolkit/public-api/transition/transition.h>
 #include <dali/devel-api/actors/actor-devel.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h> // for Renderer Property Index.
 #include <stdlib.h>
 #include <iostream>
 
@@ -287,18 +288,14 @@ int UtcDaliTransitionBetweenControlPair(void)
 
   DALI_TEST_NOT_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
   DALI_TEST_EQUALS(1, control2.GetRendererCount(), TEST_LOCATION);
-  Dali::Renderer  renderer = control2.GetRendererAt(0);
-  Property::Index index    = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
-  cornerRadius             = renderer.GetCurrentProperty<Vector4>(index);
+  Dali::Renderer renderer = control2.GetRendererAt(0);
+  cornerRadius            = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
   DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
-  index           = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
-  borderlineWidth = renderer.GetCurrentProperty<float>(index);
+  borderlineWidth = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
   DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
-  index           = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
-  borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+  borderlineColor = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
   DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
-  index            = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
-  borderlineOffset = renderer.GetCurrentProperty<float>(index);
+  borderlineOffset = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
   DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
 
   application.SendNotification();
@@ -318,17 +315,13 @@ int UtcDaliTransitionBetweenControlPair(void)
   DALI_TEST_EQUALS(destinationOpacity, control2.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
   DALI_TEST_EQUALS(1, control2.GetRendererCount(), TEST_LOCATION);
   renderer     = control2.GetRendererAt(0);
-  index        = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
-  cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+  cornerRadius = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
   DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
-  index           = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
-  borderlineWidth = renderer.GetCurrentProperty<float>(index);
+  borderlineWidth = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
   DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
-  index           = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
-  borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+  borderlineColor = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
   DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
-  index            = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
-  borderlineOffset = renderer.GetCurrentProperty<float>(index);
+  borderlineOffset = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
   DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
 
   END_TEST;
@@ -431,21 +424,17 @@ int UtcDaliTransitionBetweenControlPair2(void)
   DALI_TEST_NOT_EQUALS(destinationPosition, control1.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
   DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
 
-  Dali::Renderer  renderer = control1.GetRendererAt(0);
-  Property::Index index    = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
-  cornerRadius             = renderer.GetCurrentProperty<Vector4>(index);
+  Dali::Renderer renderer = control1.GetRendererAt(0);
+  cornerRadius            = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
   DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
 
-  index           = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
-  borderlineWidth = renderer.GetCurrentProperty<float>(index);
+  borderlineWidth = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
   DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
 
-  index           = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
-  borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+  borderlineColor = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
   DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
 
-  index            = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
-  borderlineOffset = renderer.GetCurrentProperty<float>(index);
+  borderlineOffset = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
   DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
 
   application.SendNotification();
@@ -465,20 +454,16 @@ int UtcDaliTransitionBetweenControlPair2(void)
 
   DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
   renderer     = control1.GetRendererAt(0);
-  index        = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
-  cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+  cornerRadius = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
   DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
 
-  index           = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
-  borderlineWidth = renderer.GetCurrentProperty<float>(index);
+  borderlineWidth = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
   DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
 
-  index           = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
-  borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+  borderlineColor = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
   DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
 
-  index            = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
-  borderlineOffset = renderer.GetCurrentProperty<float>(index);
+  borderlineOffset = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
   DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
 
   // every actor properties of control1 are returned to the source properties.
@@ -494,20 +479,16 @@ int UtcDaliTransitionBetweenControlPair2(void)
   // after next update, renderer properties are returned to the source properties.
   DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
   renderer     = control1.GetRendererAt(0);
-  index        = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
-  cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+  cornerRadius = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
   DALI_TEST_EQUALS(sourceRadiusV4, cornerRadius, TEST_LOCATION);
 
-  index           = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
-  borderlineWidth = renderer.GetCurrentProperty<float>(index);
+  borderlineWidth = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
   DALI_TEST_EQUALS(sourceBorderlineWidth, borderlineWidth, TEST_LOCATION);
 
-  index           = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
-  borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+  borderlineColor = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
   DALI_TEST_EQUALS(sourceBorderlineColor, borderlineColor, TEST_LOCATION);
 
-  index            = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
-  borderlineOffset = renderer.GetCurrentProperty<float>(index);
+  borderlineOffset = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
   DALI_TEST_EQUALS(sourceBorderlineOffset, borderlineOffset, TEST_LOCATION);
 
   END_TEST;
index 175e834..7c13fc1 100644 (file)
@@ -141,6 +141,38 @@ bool DaliTestCheckMaps(const Property::Map& fontStyleMapGet, const Property::Map
   return true;
 }
 
+void TestShaderCodeContainSubstrings(Control control, std::vector<std::pair<std::string, bool>> substringCheckList, const char* location)
+{
+  Renderer        renderer = control.GetRendererAt(0);
+  Shader          shader   = renderer.GetShader();
+  Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
+  Property::Map*  map      = value.GetMap();
+  DALI_TEST_CHECK(map);
+
+  Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
+  DALI_TEST_CHECK(fragment);
+  std::string fragmentShader;
+  DALI_TEST_CHECK(fragment->Get(fragmentShader));
+  for(const auto& checkPair : substringCheckList)
+  {
+    const auto& keyword = checkPair.first;
+    const auto& expect  = checkPair.second;
+    tet_printf("check [%s] %s exist in fragment shader\n", keyword.c_str(), expect ? "is" : "is not");
+    DALI_TEST_EQUALS((fragmentShader.find(keyword.c_str()) != std::string::npos), expect, location);
+  }
+
+  Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
+  std::string      vertexShader;
+  DALI_TEST_CHECK(vertex->Get(vertexShader));
+  for(const auto& checkPair : substringCheckList)
+  {
+    const auto& keyword = checkPair.first;
+    const auto& expect  = checkPair.second;
+    tet_printf("check [%s] %s exist in vertex shader\n", keyword.c_str(), expect ? "is" : "is not");
+    DALI_TEST_EQUALS((vertexShader.find(keyword.c_str()) != std::string::npos), expect, location);
+  }
+}
+
 } //namespace
 
 void dali_visual_startup(void)
@@ -906,7 +938,7 @@ int UtcDaliVisualGetPropertyMap6(void)
 
   value = resultMap.Find(ImageVisual::Property::BORDER, Property::RECTANGLE);
   DALI_TEST_CHECK(value);
-  DALI_TEST_CHECK(value->Get<Rect<int> >() == border);
+  DALI_TEST_CHECK(value->Get<Rect<int>>() == border);
 
   value = resultMap.Find(DevelImageVisual::Property::AUXILIARY_IMAGE, Property::STRING);
   DALI_TEST_CHECK(value);
@@ -947,7 +979,7 @@ int UtcDaliVisualGetPropertyMap6(void)
 
   value = resultMap.Find(ImageVisual::Property::BORDER, Property::RECTANGLE);
   DALI_TEST_CHECK(value);
-  DALI_TEST_CHECK(value->Get<Rect<int> >() == border);
+  DALI_TEST_CHECK(value->Get<Rect<int>>() == border);
 
   END_TEST;
 }
@@ -5671,27 +5703,14 @@ int UtcDaliVisualUpdatePropertyChangeShader01(void)
   application.SendNotification();
   application.Render();
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BORDERLINE", false},
+      {"#define IS_REQUIRED_ROUNDED_CORNER", false},
+    },
+    TEST_LOCATION);
+
   callStack.Reset();
   callStack.Enable(true);
 
@@ -5716,27 +5735,13 @@ int UtcDaliVisualUpdatePropertyChangeShader01(void)
   DALI_TEST_CHECK(cornerRadiusPolicyValue);
   DALI_TEST_EQUALS(cornerRadiusPolicyValue->Get<int>(), static_cast<int>(Toolkit::Visual::Transform::Policy::RELATIVE), TEST_LOCATION);
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BORDERLINE", false},
+      {"#define IS_REQUIRED_ROUNDED_CORNER", true},
+    },
+    TEST_LOCATION);
 
   // Send shader compile signal
   application.SendNotification();
@@ -5786,29 +5791,13 @@ int UtcDaliVisualUpdatePropertyChangeShader01(void)
   DALI_TEST_CHECK(borderlineOffsetValue);
   DALI_TEST_EQUALS(borderlineOffsetValue->Get<float>(), targetBorderlineOffset, TEST_LOCATION);
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
-    // Note : mAlwaysUsingCornerRadius is true.
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
-    // Note : mAlwaysUsingCornerRadius is true.
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BORDERLINE", true},
+      {"#define IS_REQUIRED_ROUNDED_CORNER", true}, // Note : mAlwaysUsingCornerRadius is true.
+    },
+    TEST_LOCATION);
 
   // Send shader compile signal
   application.SendNotification();
@@ -5854,29 +5843,13 @@ int UtcDaliVisualUpdatePropertyChangeShader01(void)
   DALI_TEST_CHECK(borderlineOffsetValue);
   DALI_TEST_EQUALS(borderlineOffsetValue->Get<float>(), 0.0f, TEST_LOCATION);
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    // Note : mAlwaysUsingBorderline and mAlwaysUsingCornerRadius is true.
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    // Note : mAlwaysUsingBorderline and mAlwaysUsingCornerRadius is true.
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BORDERLINE", true},     // Note : mAlwaysUsingBorderline is true.
+      {"#define IS_REQUIRED_ROUNDED_CORNER", true}, // Note : mAlwaysUsingCornerRadius is true.
+    },
+    TEST_LOCATION);
 
   // Send shader compile signal
   application.SendNotification();
@@ -5919,27 +5892,13 @@ int UtcDaliVisualUpdatePropertyChangeShader02(void)
   application.SendNotification();
   application.Render();
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BORDERLINE", false},
+      {"#define IS_REQUIRED_ROUNDED_CORNER", false},
+    },
+    TEST_LOCATION);
 
   Vector4 targetCornerRadius = Vector4(0.0f, 0.0f, 0.0f, 0.0f);
 
@@ -5960,29 +5919,13 @@ int UtcDaliVisualUpdatePropertyChangeShader02(void)
   DALI_TEST_CHECK(cornerRadiusValue);
   DALI_TEST_EQUALS(cornerRadiusValue->Get<Vector4>(), targetCornerRadius, TEST_LOCATION);
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    // Note : corner radius is zero. so we don't change shader!
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    // Note : corner radius is zero. so we don't change shader!
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BORDERLINE", false},
+      {"#define IS_REQUIRED_ROUNDED_CORNER", false}, // Note : corner radius is zero. so we don't change shader!
+    },
+    TEST_LOCATION);
 
   // Send shader compile signal
   application.SendNotification();
@@ -6023,29 +5966,13 @@ int UtcDaliVisualUpdatePropertyChangeShader02(void)
   DALI_TEST_CHECK(borderlineOffsetValue);
   DALI_TEST_EQUALS(borderlineOffsetValue->Get<float>(), targetBorderlineOffset, TEST_LOCATION);
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    // Note : borderline width is zero. so we don't change shader!
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    // Note : borderline width is zero. so we don't change shader!
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BORDERLINE", false}, // Note : borderline width is zero. so we don't change shader!
+      {"#define IS_REQUIRED_ROUNDED_CORNER", false},
+    },
+    TEST_LOCATION);
 
   // Send shader compile signal
   application.SendNotification();
@@ -6086,29 +6013,14 @@ int UtcDaliVisualUpdatePropertyChangeShader03(void)
   application.SendNotification();
   application.Render();
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BLUR 1") == std::string::npos);
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BLUR 1") == std::string::npos);
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BLUR", false},
+      {"#define IS_REQUIRED_BORDERLINE", false},
+      {"#define IS_REQUIRED_ROUNDED_CORNER", false},
+    },
+    TEST_LOCATION);
 
   float   targetBlurRadius   = 15.0f;
   Vector4 targetCornerRadius = Vector4(1.0f, 0.1f, 1.1f, 0.0f);
@@ -6136,31 +6048,14 @@ int UtcDaliVisualUpdatePropertyChangeShader03(void)
   DALI_TEST_CHECK(cornerRadiusValue);
   DALI_TEST_EQUALS(cornerRadiusValue->Get<Vector4>(), targetCornerRadius, TEST_LOCATION);
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BLUR 1") != std::string::npos);
-    // Note : We ignore borderline when blur radius occured
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BLUR 1") != std::string::npos);
-    // Note : We ignore borderline when blur radius occured
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BLUR", true},
+      {"#define IS_REQUIRED_BORDERLINE", false}, // Note : We ignore borderline when blur radius occured
+      {"#define IS_REQUIRED_ROUNDED_CORNER", true},
+    },
+    TEST_LOCATION);
 
   // Send shader compile signal
   application.SendNotification();
@@ -6193,33 +6088,14 @@ int UtcDaliVisualUpdatePropertyChangeShader03(void)
   DALI_TEST_CHECK(cornerRadiusValue);
   DALI_TEST_EQUALS(cornerRadiusValue->Get<Vector4>(), Vector4::ZERO, TEST_LOCATION);
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    // Note : mAlwaysUsingBlurRadius and mAlwaysUsingCornerRadius is true.
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BLUR 1") != std::string::npos);
-    // Note : We ignore borderline when blur radius occured
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    // Note : mAlwaysUsingBlurRadius and mAlwaysUsingCornerRadius is true.
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BLUR 1") != std::string::npos);
-    // Note : We ignore borderline when blur radius occured
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BLUR", true},           // Note : mAlwaysUsingBlurRadius is true.
+      {"#define IS_REQUIRED_BORDERLINE", false},    // Note : We ignore borderline when blur radius occured
+      {"#define IS_REQUIRED_ROUNDED_CORNER", true}, // Note : mAlwaysUsingCornerRadius is true.
+    },
+    TEST_LOCATION);
 
   // Send shader compile signal
   application.SendNotification();
@@ -6264,27 +6140,14 @@ int UtcDaliVisualUpdatePropertyChangeShader04(void)
   application.SendNotification();
   application.Render();
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BORDERLINE", false},
+      {"#define IS_REQUIRED_ROUNDED_CORNER", true},
+    },
+    TEST_LOCATION);
+
   callStack.Reset();
   callStack.Enable(true);
 
@@ -6298,29 +6161,14 @@ int UtcDaliVisualUpdatePropertyChangeShader04(void)
   application.Render();
   application.Render(1001u); // End of animation
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    // Note : mAlwaysUsingCornerRadius is true.
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
-    // Note : mAlwaysUsingCornerRadius is true.
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BORDERLINE", false},
+      {"#define IS_REQUIRED_ROUNDED_CORNER", true}, // Note : mAlwaysUsingCornerRadius is true.
+    },
+    TEST_LOCATION);
+
   callStack.Enable(false);
   // Shader not changed
   DALI_TEST_CHECK(!callStack.FindMethod("CreateShader"));
@@ -6350,29 +6198,13 @@ int UtcDaliVisualUpdatePropertyChangeShader04(void)
   DALI_TEST_CHECK(borderlineWidthValue);
   DALI_TEST_EQUALS(borderlineWidthValue->Get<float>(), targetBorderlineWidth, TEST_LOCATION);
 
-  // Get shader
-  {
-    Renderer        renderer = dummyControl.GetRendererAt(0);
-    Shader          shader   = renderer.GetShader();
-    Property::Value value    = shader.GetProperty(Shader::Property::PROGRAM);
-    Property::Map*  map      = value.GetMap();
-    DALI_TEST_CHECK(map);
-
-    Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
-    DALI_TEST_CHECK(fragment);
-    std::string fragmentShader;
-    DALI_TEST_CHECK(fragment->Get(fragmentShader));
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
-    // Note : mAlwaysUsingCornerRadius is true.
-    DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
-    Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
-    std::string      vertexShader;
-    DALI_TEST_CHECK(vertex->Get(vertexShader));
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
-    // Note : mAlwaysUsingCornerRadius is true.
-    DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-  }
+  TestShaderCodeContainSubstrings(
+    dummyControl,
+    {
+      {"#define IS_REQUIRED_BORDERLINE", true},
+      {"#define IS_REQUIRED_ROUNDED_CORNER", true}, // Note : mAlwaysUsingCornerRadius is true.
+    },
+    TEST_LOCATION);
 
   // Send shader compile signal
   application.SendNotification();
index 8891e9d..f900b5a 100644 (file)
@@ -64,7 +64,7 @@ if (ENABLE_PKG_CONFIGURE)
 
        set(PREFIX ${prefix})
        set(EXEC_PREFIX ${CMAKE_INSTALL_PREFIX})
-       set(DEV_INCLUDE_PATH ${repo_root_dir})
+       set(DEV_INCLUDE_PATH ${INCLUDE_DIR})
 
        set(core_pkg_cfg_file dali2-scene-loader.pc)
        configure_file(${CMAKE_CURRENT_LIST_DIR}/${core_pkg_cfg_file}.in ${core_pkg_cfg_file} @ONLY)
index cc96d45..d7778d8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 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.
@@ -25,7 +25,7 @@ namespace Toolkit
 {
 namespace DevelStyleManager
 {
-const Property::Map GetConfigurations(StyleManager styleManager)
+const Property::Map& GetConfigurations(StyleManager styleManager)
 {
   return GetImpl(styleManager).GetConfigurations();
 }
index f1e05d7..23c7999 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_STYLE_MANAGER_DEVEL_H
 
 /*
- * Copyright (c) 2020 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.
@@ -46,7 +46,7 @@ using BrokenImageChangedSignalType = Signal<void(StyleManager)>;
  * @param[in] styleManager The instance of StyleManager
  * @return A property map to the currently defined configurations
 **/
-DALI_TOOLKIT_API const Property::Map GetConfigurations(StyleManager styleManager);
+DALI_TOOLKIT_API const Property::Map& GetConfigurations(StyleManager styleManager);
 
 /**
    * @brief Sets an image to be used when a visual has failed to correctly render
index 4383c1a..20186ef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -183,8 +183,10 @@ void KeyboardFocusManager::GetConfigurationFromStyleManger()
   Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
   if(styleManager)
   {
-    Property::Map config   = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
-    mAlwaysShowIndicator   = config["alwaysShowFocus"].Get<bool>() ? ALWAYS_SHOW : NONE;
+    const Property::Map& config               = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
+    const auto           alwaysShowFocusValue = config.Find("alwaysShowFocus", Property::Type::BOOLEAN);
+
+    mAlwaysShowIndicator   = (alwaysShowFocusValue && alwaysShowFocusValue->Get<bool>()) ? ALWAYS_SHOW : NONE;
     mIsFocusIndicatorShown = (mAlwaysShowIndicator == ALWAYS_SHOW) ? SHOW : HIDE;
     mClearFocusOnTouch     = (mIsFocusIndicatorShown == SHOW) ? false : true;
   }
@@ -520,16 +522,16 @@ bool KeyboardFocusManager::MoveFocus(Toolkit::Control::KeyboardFocus::Direction
         nextFocusableActor                  = mPreFocusChangeSignal.Emit(currentFocusActor, Actor(), direction);
         mIsWaitingKeyboardFocusChangeCommit = false;
       }
-      else if (mEnableDefaultAlgorithm)
+      else if(mEnableDefaultAlgorithm)
       {
         Actor rootActor = mFocusFinderRootActor.GetHandle();
         if(!rootActor)
         {
-          if (currentFocusActor)
+          if(currentFocusActor)
           {
             // Find the window of the focused actor.
             Integration::SceneHolder window = Integration::SceneHolder::Get(currentFocusActor);
-            if (window)
+            if(window)
             {
               rootActor = window.GetRootLayer();
             }
@@ -799,7 +801,7 @@ Actor KeyboardFocusManager::GetFocusIndicatorActor()
 
 void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
 {
-  const std::string& keyName = event.GetKeyName();
+  const std::string& keyName    = event.GetKeyName();
   const std::string& deviceName = event.GetDeviceName();
 
   if(mIsFocusIndicatorShown == UNKNOWN)
@@ -1045,8 +1047,8 @@ void KeyboardFocusManager::OnWheelEvent(const WheelEvent& event)
 
 bool KeyboardFocusManager::OnCustomWheelEvent(const WheelEvent& event)
 {
-  bool consumed = false;
-  Actor actor = GetCurrentFocusActor();
+  bool  consumed = false;
+  Actor actor    = GetCurrentFocusActor();
   if(actor)
   {
     // Notify the actor about the wheel event
index e5cbaa7..5faf423 100644 (file)
@@ -36,9 +36,9 @@ uniform mediump vec2 anchorPoint;
 
 vec4 ComputeVertexPosition()
 {
-  vec2 visualSize = mix( uSize.xy*size, size, offsetSizeMode.zw );
-  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy );
-  return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+  vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy );
+  return vec4( (aPosition + anchorPoint)*visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0 );
 }
 
 void main()
index e063d81..4f6dab5 100644 (file)
@@ -13,10 +13,10 @@ uniform mediump vec2 anchorPoint;
 
 vec4 ComputeVertexPosition()
 {
-  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
-  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+  vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
   vPosition = aPosition* visualSize;
-  return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
+  return vec4( vPosition + anchorPoint*visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0 );
 }
 
 void main()
index 6dc0721..6bf08fa 100644 (file)
@@ -14,9 +14,9 @@ uniform mediump vec2 anchorPoint;
 
 vec2 ComputeVertexPosition()
 {
-  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
-  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
-  return (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy;
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+  vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
+  return (aPosition + anchorPoint)*visualSize + visualOffset + origin * uSize.xy;
 }
 
 void main()
index 33202a2..db23361 100644 (file)
@@ -1,36 +1,26 @@
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef IS_REQUIRED_BLUR
-#define IS_REQUIRED_BLUR 0
-#endif
-
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE || IS_REQUIRED_BLUR
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE) || defined(IS_REQUIRED_BLUR)
 INPUT mediump vec2 vPosition;
 INPUT mediump vec2 vRectSize;
 INPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 INPUT mediump vec4 vCornerRadius;
 #endif
 #endif
 
 uniform lowp vec4 uColor;
 uniform lowp vec3 mixColor;
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
 uniform mediump float borderlineWidth;
 uniform mediump float borderlineOffset;
 uniform lowp vec4 borderlineColor;
 uniform lowp vec4 uActorColor;
 #endif
-#if IS_REQUIRED_BLUR
+#ifdef IS_REQUIRED_BLUR
 uniform mediump float blurRadius;
 #endif
 
 
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE || IS_REQUIRED_BLUR
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE) || defined(IS_REQUIRED_BLUR)
 // Global values both rounded corner and borderline use
 
 // radius of rounded corner on this quadrant
@@ -54,7 +44,7 @@ mediump float gMinInlinePotential = 0.0;
 
 void calculateCornerRadius()
 {
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
   gRadius =
   mix(
     mix(vCornerRadius.x, vCornerRadius.y, sign(vPosition.x) * 0.5 + 0.5),
@@ -68,7 +58,7 @@ void calculatePosition()
 {
   gFragmentPosition = abs(vPosition) - vRectSize;
   gCenterPosition = -gRadius;
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
   gCenterPosition += borderlineWidth * (clamp(borderlineOffset, -1.0, 1.0) + 1.0) * 0.5;
 #endif
   gDiff = gFragmentPosition - gCenterPosition;
@@ -86,7 +76,7 @@ void setupMinMaxPotential()
   gMaxOutlinePotential = gRadius + gPotentialRange;
   gMinOutlinePotential = gRadius - gPotentialRange;
 
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
   gMaxInlinePotential = gMaxOutlinePotential - borderlineWidth;
   gMinInlinePotential = gMinOutlinePotential - borderlineWidth;
 #else
@@ -109,7 +99,7 @@ void PreprocessPotential()
 }
 #endif
 
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
 lowp vec4 convertBorderlineColor(lowp vec4 textureColor)
 {
   mediump float potential = gPotential;
@@ -173,7 +163,7 @@ lowp vec4 convertBorderlineColor(lowp vec4 textureColor)
 }
 #endif
 
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_ROUNDED_CORNER
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_ROUNDED_CORNER)
 mediump float calculateCornerOpacity()
 {
   mediump float potential = gPotential;
@@ -195,7 +185,7 @@ mediump float calculateCornerOpacity()
 }
 #endif
 
-#if IS_REQUIRED_BLUR
+#ifdef IS_REQUIRED_BLUR
 mediump float calculateBlurOpacity()
 {
 // Don't use borderline!
@@ -203,7 +193,7 @@ mediump float calculateBlurOpacity()
   mediump float cy = gRadius + blurRadius;
   mediump float cr = gRadius + blurRadius;
 
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
   // This routine make perfect circle. If corner radius is not exist, we don't consider prefect circle.
   cy = min(cy, min(vRectSize.x, vRectSize.y) - gRadius);
 #endif
@@ -240,7 +230,7 @@ mediump float calculateBlurOpacity()
     // highest point of that circle is (x, x + r) and potential is x + r
 
     // solve (v.x - x)^2 + (v.y - x)^2 = (cr / cy * x)^2
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
     // Note : lowspec HW cannot calculate here. need to reduce numeric error
     highp float A = (cr * cr - 2.0 * cy * cy);
     highp float B = cy * (v.x + v.y);
@@ -268,7 +258,7 @@ void main()
 {
   lowp vec4 targetColor = vec4(mixColor, 1.0) * uColor;
 
-#if IS_REQUIRED_BLUR || IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_BLUR) || defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
   // skip most potential calculate for performance
   if(abs(vPosition.x) < vOptRectSize.x && abs(vPosition.y) < vOptRectSize.y)
   {
@@ -279,20 +269,20 @@ void main()
     PreprocessPotential();
 #endif
 
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
     targetColor = convertBorderlineColor(targetColor);
 #endif
     OUT_COLOR = targetColor;
 
-#if IS_REQUIRED_BLUR
+#ifdef IS_REQUIRED_BLUR
     mediump float opacity = calculateBlurOpacity();
     OUT_COLOR.a *= opacity;
-#elif IS_REQUIRED_ROUNDED_CORNER
+#elif defined(IS_REQUIRED_ROUNDED_CORNER)
     mediump float opacity = calculateCornerOpacity();
     OUT_COLOR.a *= opacity;
 #endif
 
-#if IS_REQUIRED_BLUR || IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_BLUR) || defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
   }
 #endif
 }
index 2798185..f1688da 100644 (file)
@@ -1,19 +1,9 @@
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef IS_REQUIRED_BLUR
-#define IS_REQUIRED_BLUR 0
-#endif
-
 INPUT mediump vec2 aPosition;
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE || IS_REQUIRED_BLUR
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE) || defined(IS_REQUIRED_BLUR)
 OUTPUT mediump vec2 vPosition;
 OUTPUT mediump vec2 vRectSize;
 OUTPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 OUTPUT mediump vec4 vCornerRadius;
 #endif
 #endif
@@ -27,14 +17,14 @@ uniform highp vec2 size;
 uniform mediump vec4 offsetSizeMode;
 uniform mediump vec2 origin;
 uniform mediump vec2 anchorPoint;
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
 uniform mediump float borderlineWidth;
 uniform mediump float borderlineOffset;
 #endif
-#if IS_REQUIRED_BLUR
+#ifdef IS_REQUIRED_BLUR
 uniform mediump float blurRadius;
 #endif
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 uniform mediump vec4 cornerRadius;
 uniform mediump float cornerRadiusPolicy;
 #endif
@@ -42,16 +32,16 @@ uniform mediump vec2 extraSize;
 
 vec4 ComputeVertexPosition()
 {
-  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;
-  vec2 visualOffset = mix(offset, offset/uSize.xy, offsetSizeMode.xy);
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw ) + extraSize;
+  vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
 
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE || IS_REQUIRED_BLUR
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE) || defined(IS_REQUIRED_BLUR)
   vRectSize = visualSize * 0.5;
   vOptRectSize = vRectSize;
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_ROUNDED_CORNER
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
   mediump float minSize = min(visualSize.x, visualSize.y) + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth;
 #else
   mediump float minSize = min(visualSize.x, visualSize.y);
@@ -63,18 +53,18 @@ vec4 ComputeVertexPosition()
   vOptRectSize -= 0.2929 * maxRadius + 1.0;
 #endif
 
-#if IS_REQUIRED_BLUR
+#ifdef IS_REQUIRED_BLUR
   vPosition = aPosition * (visualSize + 2.0 * blurRadius);
   vOptRectSize -= blurRadius + 1.0;
-#elif IS_REQUIRED_BORDERLINE
+#elif defined(IS_REQUIRED_BORDERLINE)
   vPosition = aPosition * (visualSize + (1.0 + clamp(borderlineOffset, -1.0, 1.0))* borderlineWidth);
   vOptRectSize -= (1.0 - clamp(borderlineOffset, -1.0, 1.0)) * 0.5 * borderlineWidth + 1.0;
-#elif IS_REQUIRED_ROUNDED_CORNER
+#elif defined(IS_REQUIRED_ROUNDED_CORNER)
   vPosition = aPosition * visualSize;
 #else
   mediump vec2 vPosition = aPosition * visualSize;
 #endif
-  return vec4(vPosition + anchorPoint * visualSize + (visualOffset + origin) * uSize.xy, 0.0, 1.0);
+  return vec4(vPosition + anchorPoint * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0);
 }
 
 void main()
index a30bf5e..febc776 100644 (file)
@@ -1,19 +1,9 @@
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef RADIAL
-#define RADIAL 0
-#endif
-
 INPUT mediump vec2 vTexCoord;
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
 INPUT mediump vec2 vPosition;
 INPUT mediump vec2 vRectSize;
 INPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 INPUT mediump vec4 vCornerRadius;
 #endif
 #endif
@@ -21,14 +11,14 @@ INPUT mediump vec4 vCornerRadius;
 uniform sampler2D sTexture; // sampler1D?
 uniform lowp vec4 uColor;
 uniform lowp vec3 mixColor;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
 uniform mediump float borderlineWidth;
 uniform mediump float borderlineOffset;
 uniform lowp vec4 borderlineColor;
 uniform lowp vec4 uActorColor;
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
 // Global values both rounded corner and borderline use
 
 // radius of rounded corner on this quadrant
@@ -52,7 +42,7 @@ mediump float gMinInlinePotential = 0.0;
 
 void calculateCornerRadius()
 {
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
   gRadius =
   mix(
     mix(vCornerRadius.x, vCornerRadius.y, sign(vPosition.x) * 0.5 + 0.5),
@@ -66,7 +56,7 @@ void calculatePosition()
 {
   gFragmentPosition = abs(vPosition) - vRectSize;
   gCenterPosition = -gRadius;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
   gCenterPosition += borderlineWidth * (clamp(borderlineOffset, -1.0, 1.0) + 1.0) * 0.5;
 #endif
   gDiff = gFragmentPosition - gCenterPosition;
@@ -84,7 +74,7 @@ void setupMinMaxPotential()
   gMaxOutlinePotential = gRadius + gPotentialRange;
   gMinOutlinePotential = gRadius - gPotentialRange;
 
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
   gMaxInlinePotential = gMaxOutlinePotential - borderlineWidth;
   gMinInlinePotential = gMinOutlinePotential - borderlineWidth;
 #else
@@ -108,7 +98,7 @@ void PreprocessPotential()
 #endif
 
 
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
 lowp vec4 convertBorderlineColor(lowp vec4 textureColor)
 {
   mediump float potential = gPotential;
@@ -172,7 +162,7 @@ lowp vec4 convertBorderlineColor(lowp vec4 textureColor)
 }
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 mediump float calculateCornerOpacity()
 {
   mediump float potential = gPotential;
@@ -196,13 +186,13 @@ mediump float calculateCornerOpacity()
 
 void main()
 {
-#if RADIAL
+#ifdef RADIAL
   lowp vec4 textureColor = TEXTURE(sTexture, vec2(length(vTexCoord), 0.5)) * vec4(mixColor, 1.0) * uColor;
 #else
   lowp vec4 textureColor = TEXTURE(sTexture, vec2(vTexCoord.y, 0.5)) * vec4(mixColor, 1.0) * uColor;
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
   // skip most potential calculate for performance
   if(abs(vPosition.x) < vOptRectSize.x && abs(vPosition.y) < vOptRectSize.y)
   {
@@ -213,17 +203,17 @@ void main()
     PreprocessPotential();
 #endif
 
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
     textureColor = convertBorderlineColor(textureColor);
 #endif
     OUT_COLOR = textureColor;
 
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
     mediump float opacity = calculateCornerOpacity();
     OUT_COLOR *= opacity;
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
   }
 #endif
 }
index edaf643..68179ab 100644 (file)
@@ -1,20 +1,10 @@
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef USER_SPACE
-#define USER_SPACE 0
-#endif
-
 INPUT mediump vec2 aPosition;
 OUTPUT mediump vec2 vTexCoord;
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
 OUTPUT mediump vec2 vPosition;
 OUTPUT mediump vec2 vRectSize;
 OUTPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 OUTPUT mediump vec4 vCornerRadius;
 #endif
 #endif
@@ -29,27 +19,27 @@ uniform highp vec2 size;
 uniform mediump vec4 offsetSizeMode;
 uniform mediump vec2 origin;
 uniform mediump vec2 anchorPoint;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
 uniform mediump float borderlineWidth;
 uniform mediump float borderlineOffset;
 #endif
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 uniform mediump vec4 cornerRadius;
 uniform mediump float cornerRadiusPolicy;
 #endif
 
 vec4 ComputeVertexPosition()
 {
-  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
-  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+  vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
 
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
   vRectSize = visualSize * 0.5;
   vOptRectSize = vRectSize;
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_BORDERLINE
   mediump float minSize = min(visualSize.x, visualSize.y) + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth;
 #else
   mediump float minSize = min(visualSize.x, visualSize.y);
@@ -62,23 +52,23 @@ vec4 ComputeVertexPosition()
 #endif
 
   mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
   vPosition = aPosition * (visualSize + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth);
   vertexPosition.xy *= (1.0 + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth / visualSize);
   vOptRectSize -= (1.0 - clamp(borderlineOffset, -1.0, 1.0)) * 0.5 * borderlineWidth + 1.0;
-#elif IS_REQUIRED_ROUNDED_CORNER
+#elif defined(IS_REQUIRED_ROUNDED_CORNER)
   vPosition = aPosition * visualSize;
 #else
   mediump vec2 vPosition = aPosition * visualSize;
 #endif
 
-#if USER_SPACE
+#ifdef USER_SPACE
   vertexPosition.xyz *= uSize;
 #endif
 
   vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;
 
-  return vec4(vPosition + anchorPoint * visualSize + (visualOffset + origin) * uSize.xy, 0.0, 1.0);
+  return vec4(vPosition + anchorPoint * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0);
 }
 
 void main()
index c2324e7..3694280 100644 (file)
@@ -1,39 +1,23 @@
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef IS_REQUIRED_ALPHA_MASKING
-#define IS_REQUIRED_ALPHA_MASKING 0
-#endif
-#ifndef ATLAS_DEFAULT_WARP
-#define ATLAS_DEFAULT_WARP 0
-#endif
-#ifndef ATLAS_CUSTOM_WARP
-#define ATLAS_CUSTOM_WARP 0
-#endif
-
 INPUT mediump vec2 vTexCoord;
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
 INPUT mediump vec2 vPosition;
 INPUT mediump vec2 vRectSize;
 INPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 INPUT mediump vec4 vCornerRadius;
 #endif
 #endif
 
 uniform sampler2D sTexture;
 
-#if IS_REQUIRED_ALPHA_MASKING
+#ifdef IS_REQUIRED_ALPHA_MASKING
 uniform sampler2D sMaskTexture;
 INPUT mediump vec2 vMaskTexCoord;
 #endif
 
-#if ATLAS_DEFAULT_WARP
+#ifdef ATLAS_DEFAULT_WARP
 uniform mediump vec4 uAtlasRect;
-#elif ATLAS_CUSTOM_WARP
+#elif defined(ATLAS_CUSTOM_WARP)
 // WrapMode -- 0: CLAMP; 1: REPEAT; 2: REFLECT;
 uniform lowp vec2 wrapMode;
 #endif
@@ -41,14 +25,14 @@ uniform lowp vec2 wrapMode;
 uniform lowp vec4 uColor;
 uniform lowp vec3 mixColor;
 uniform lowp float preMultipliedAlpha;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
 uniform mediump float borderlineWidth;
 uniform mediump float borderlineOffset;
 uniform lowp vec4 borderlineColor;
 uniform lowp vec4 uActorColor;
 #endif
 
-#if ATLAS_CUSTOM_WARP
+#ifdef ATLAS_CUSTOM_WARP
 mediump float wrapCoordinate( mediump vec2 range, mediump float coordinate, lowp float wrap )
 {
   mediump float coord;
@@ -60,7 +44,7 @@ mediump float wrapCoordinate( mediump vec2 range, mediump float coordinate, lowp
 }
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
 // Global values both rounded corner and borderline use
 
 // radius of rounded corner on this quadrant
@@ -84,7 +68,7 @@ mediump float gMinInlinePotential = 0.0;
 
 void calculateCornerRadius()
 {
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
   gRadius =
   mix(
     mix(vCornerRadius.x, vCornerRadius.y, sign(vPosition.x) * 0.5 + 0.5),
@@ -98,7 +82,7 @@ void calculatePosition()
 {
   gFragmentPosition = abs(vPosition) - vRectSize;
   gCenterPosition = -gRadius;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
   gCenterPosition += borderlineWidth * (clamp(borderlineOffset, -1.0, 1.0) + 1.0) * 0.5;
 #endif
   gDiff = gFragmentPosition - gCenterPosition;
@@ -116,7 +100,7 @@ void setupMinMaxPotential()
   gMaxOutlinePotential = gRadius + gPotentialRange;
   gMinOutlinePotential = gRadius - gPotentialRange;
 
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
   gMaxInlinePotential = gMaxOutlinePotential - borderlineWidth;
   gMinInlinePotential = gMinOutlinePotential - borderlineWidth;
 #else
@@ -139,7 +123,7 @@ void PreprocessPotential()
 }
 #endif
 
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
 lowp vec4 convertBorderlineColor(lowp vec4 textureColor)
 {
   mediump float potential = gPotential;
@@ -202,7 +186,7 @@ lowp vec4 convertBorderlineColor(lowp vec4 textureColor)
 }
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 mediump float calculateCornerOpacity()
 {
   mediump float potential = gPotential;
@@ -226,9 +210,9 @@ mediump float calculateCornerOpacity()
 
 void main()
 {
-#if ATLAS_DEFAULT_WARP
+#ifdef ATLAS_DEFAULT_WARP
   mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );
-#elif ATLAS_CUSTOM_WARP
+#elif defined(ATLAS_CUSTOM_WARP)
   mediump vec2 texCoord = vec2( wrapCoordinate( uAtlasRect.xz, vTexCoord.x, wrapMode.x ),
                                 wrapCoordinate( uAtlasRect.yw, vTexCoord.y, wrapMode.y ) );
 #else
@@ -237,13 +221,13 @@ void main()
 
   lowp vec4 textureColor = TEXTURE( sTexture, texCoord ) * vec4( mixColor, 1.0 ) * uColor;
 
-#if IS_REQUIRED_ALPHA_MASKING
+#ifdef IS_REQUIRED_ALPHA_MASKING
   mediump float maskAlpha = TEXTURE(sMaskTexture, vMaskTexCoord).a;
   textureColor.a *= maskAlpha;
   textureColor.rgb *= mix(1.0, maskAlpha, preMultipliedAlpha);
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
   // skip most potential calculate for performance
   if(abs(vPosition.x) < vOptRectSize.x && abs(vPosition.y) < vOptRectSize.y)
   {
@@ -254,18 +238,18 @@ void main()
     PreprocessPotential();
 #endif
 
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
     textureColor = convertBorderlineColor(textureColor);
 #endif
     OUT_COLOR = textureColor;
 
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
     mediump float opacity = calculateCornerOpacity();
     OUT_COLOR.a *= opacity;
     OUT_COLOR.rgb *= mix(1.0, opacity, preMultipliedAlpha);
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
   }
 #endif
 }
index d563c78..7443aa1 100644 (file)
@@ -1,20 +1,10 @@
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef IS_REQUIRED_ALPHA_MASKING
-#define IS_REQUIRED_ALPHA_MASKING 0
-#endif
-
 INPUT mediump vec2 aPosition;
 OUTPUT mediump vec2 vTexCoord;
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
 OUTPUT mediump vec2 vPosition;
 OUTPUT mediump vec2 vRectSize;
 OUTPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 OUTPUT mediump vec4 vCornerRadius;
 #endif
 #endif
@@ -29,15 +19,15 @@ uniform highp vec2 size;
 uniform mediump vec4 offsetSizeMode;
 uniform mediump vec2 origin;
 uniform mediump vec2 anchorPoint;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
 uniform mediump float borderlineWidth;
 uniform mediump float borderlineOffset;
 #endif
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
 uniform mediump vec4 cornerRadius;
 uniform mediump float cornerRadiusPolicy;
 #endif
-#if IS_REQUIRED_ALPHA_MASKING
+#ifdef IS_REQUIRED_ALPHA_MASKING
 OUTPUT  mediump vec2  vMaskTexCoord;
 uniform lowp    float cropToMask;
 uniform mediump vec2  maskTextureRatio;
@@ -46,16 +36,16 @@ uniform mediump vec2 extraSize;
 
 vec4 ComputeVertexPosition()
 {
-  vec2 visualSize = mix(uSize.xy * size, size, offsetSizeMode.zw) + extraSize;
-  vec2 visualOffset = mix(offset, offset/uSize.xy, offsetSizeMode.xy);
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw) + extraSize;
+  vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
 
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
   vRectSize = visualSize * 0.5;
   vOptRectSize = vRectSize;
 #endif
 
-#if IS_REQUIRED_ROUNDED_CORNER
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_BORDERLINE
   mediump float minSize = min(visualSize.x, visualSize.y) + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth;
 #else
   mediump float minSize = min(visualSize.x, visualSize.y);
@@ -67,17 +57,17 @@ vec4 ComputeVertexPosition()
   vOptRectSize -= 0.2929 * maxRadius + 1.0;
 #endif
 
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
   vPosition = aPosition * (visualSize + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth);
   vOptRectSize -= (1.0 - clamp(borderlineOffset, -1.0, 1.0)) * 0.5 * borderlineWidth + 1.0;
-#elif IS_REQUIRED_ROUNDED_CORNER
+#elif defined(IS_REQUIRED_ROUNDED_CORNER)
   vPosition = aPosition * visualSize;
 #else
   mediump vec2 vPosition = aPosition * visualSize;
 #endif
 
   vec4 finalPixelArea = pixelArea;
-#if IS_REQUIRED_ALPHA_MASKING
+#ifdef IS_REQUIRED_ALPHA_MASKING
   finalPixelArea = mix(pixelArea,
                        vec4(
                             vec2(0.5) + (pixelArea.xy - vec2(0.5)) * maskTextureRatio,
@@ -88,7 +78,7 @@ vec4 ComputeVertexPosition()
 #endif
   vTexCoord = finalPixelArea.xy + finalPixelArea.zw * (vPosition.xy / max(vec2(1.0), visualSize) + vec2(0.5));
 
-  return vec4(vPosition + anchorPoint * visualSize + (visualOffset + origin) * uSize.xy, 0.0, 1.0);
+  return vec4(vPosition + anchorPoint * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0);
 }
 
 void main()
index c25a1bb..bc9ac8a 100644 (file)
@@ -24,12 +24,12 @@ uniform mediump vec2 anchorPoint;
 
 vec4 ComputeVertexPosition()
 {
-  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
   float scaleFactor = min( visualSize.x, visualSize.y );
   vec3 originFlipY =vec3(origin.x, -origin.y, 0.0);
   vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
-  vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
-  return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );
+  vec3 visualOffset = vec3( offset * offsetSizeMode.xy + offset * uSize.xy * (1.0 - offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
+  return vec4( (aPosition + anchorPointFlipY)*scaleFactor + visualOffset + originFlipY * uSize, 1.0 );
 }
 
 void main()
index 05b90ce..858c92d 100644 (file)
@@ -26,8 +26,8 @@ vec4 ComputeVertexPosition()
   float scaleFactor = min( visualSize.x, visualSize.y );
   vec3 originFlipY =vec3(origin.x, -origin.y, 0.0);
   vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
-  vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
-  return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );
+  vec3 visualOffset = vec3( offset * offsetSizeMode.xy + offset * uSize.xy * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
+  return vec4( (aPosition + anchorPointFlipY)*scaleFactor + visualOffset + originFlipY * uSize, 1.0 );
 }
 
 void main()
index 2a4b704..0541a16 100644 (file)
@@ -23,8 +23,8 @@ vec4 ComputeVertexPosition()
   float scaleFactor = min( visualSize.x, visualSize.y );
   vec3 originFlipY =vec3(origin.x, -origin.y, 0.0);
   vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
-  vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
-  return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );
+  vec3 visualOffset = vec3( offset * offsetSizeMode.xy + offset * uSize.xy * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
+  return vec4( (aPosition + anchorPointFlipY)*scaleFactor + visualOffset + originFlipY * uSize, 1.0 );
 }
 
 void main()
index c7b8a9f..4625b3c 100644 (file)
@@ -16,8 +16,8 @@ uniform mediump vec2 extraSize;
 
 void main()
 {
-  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;
-  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw ) + extraSize;
+  vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
 
   mediump vec2 size = visualSize.xy;
 
@@ -31,7 +31,7 @@ void main()
   mediump vec4 gridPosition = vec4( fixedFactor * fixedScaleDownRate + ( size - fixedTotal * fixedScaleDownRate ) * stretch, 0.0, 1.0 );
   mediump vec4 vertexPosition = gridPosition;
   vertexPosition.xy -= size * vec2( 0.5, 0.5 );
-  vertexPosition.xy += anchorPoint*size + (visualOffset + origin)*uSize.xy;
+  vertexPosition.xy += anchorPoint*size + visualOffset + origin * uSize.xy;
 
   vertexPosition = uMvpMatrix * vertexPosition;
 
index 4cd84bc..01f6138 100644 (file)
@@ -22,8 +22,8 @@ void main()
   mediump vec2 fixedTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].x, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].x );
   mediump vec2 stretchTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].y, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].y );
 
-  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;
-  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw ) + extraSize;
+  vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
 
   // Scale down if fixedTotal is bigger than visualSize
   mediump float fixedScaleDownRate = min(1.0, min(visualSize.x / fixedTotal.x, visualSize.y / fixedTotal.y));
@@ -31,7 +31,7 @@ void main()
   mediump vec4 gridPosition = vec4( fixedFactor * fixedScaleDownRate + ( visualSize.xy - fixedTotal * fixedScaleDownRate ) * stretch / stretchTotal, 0.0, 1.0 );
   mediump vec4 vertexPosition = gridPosition;
   vertexPosition.xy -= visualSize.xy * vec2( 0.5, 0.5 );
-  vertexPosition.xy += anchorPoint*visualSize + (visualOffset + origin)*uSize.xy;
+  vertexPosition.xy += anchorPoint*visualSize + visualOffset + origin * uSize.xy;
   vertexPosition = uMvpMatrix * vertexPosition;
 
   vTexCoord = ( fixedFactor + stretch ) / ( fixedTotal + stretchTotal );
index 6a1b758..1200294 100644 (file)
@@ -27,9 +27,9 @@ vec4 ComputeVertexPosition()
   float scaleFactor = min( visualSize.x / uObjectDimensions.x, visualSize.y / uObjectDimensions.y );
   vec3 originFlipY =vec3(origin.x, -origin.y, 0.0);
   vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
-  vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
+  vec3 visualOffset = vec3( offset * offsetSizeMode.xy + offset * uSize.xy * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
 
-  return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );
+  return vec4( (aPosition + anchorPointFlipY)*scaleFactor + visualOffset + originFlipY * uSize, 1.0 );
 }
 
 void main()
index 6ea160a..c152b5e 100644 (file)
@@ -18,13 +18,13 @@ uniform mediump vec2 anchorPoint;
 
 void main()
 {
-  highp vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy );
-  highp vec2 visualSize = mix( uSize.xy * size, size, offsetSizeMode.zw );
+  highp vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw);
+  highp vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
 
   vTexCoord.x = ( uDelta + uHorizontalAlign * ( uTextureSize.x - visualSize.x - uGap ) + aPosition.x * visualSize.x - uGap * 0.5 ) / uTextureSize.x + 0.5;
   vTexCoord.y = ( uVerticalAlign * ( uTextureSize.y - visualSize.y ) + aPosition.y * visualSize.y ) / ( uTextureSize.y ) + 0.5;
 
-  highp vec4 vertexPosition = vec4( ( aPosition + anchorPoint ) * visualSize + ( visualOffset + origin ) * uSize.xy, 0.0, 1.0 );
+  highp vec4 vertexPosition = vec4( ( aPosition + anchorPoint ) * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0 );
 
   gl_Position = uMvpMatrix * vertexPosition;
 }
\ No newline at end of file
index 893d075..4cc1212 100644 (file)
@@ -14,9 +14,9 @@ uniform mediump vec2 anchorPoint;
 
 vec4 ComputeVertexPosition()
 {
-  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
-  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
-  return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+  vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
+  return vec4( (aPosition + anchorPoint) * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0 );
 }
 
 void main()
index 5e0bfb0..9a9975c 100644 (file)
@@ -11,9 +11,9 @@ uniform mediump vec2 anchorPoint;
 
 vec4 ComputeVertexPosition()
 {
-  vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
-  vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
-  return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
+  vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+  vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
+  return vec4( (aPosition + anchorPoint)*visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0 );
 }
 
 void main()
index 959724b..e6ad82f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -285,44 +285,40 @@ void StyleManager::SetTheme(const std::string& themeFile)
   }
 }
 
-const Property::Map StyleManager::GetConfigurations()
+const Property::Map& StyleManager::GetConfigurations()
 {
   DALI_LOG_STREAM(gLogFilter, Debug::Concise, "GetConfigurations()\n On entry, mThemeBuilder: " << (bool(mThemeBuilder) ? "Created" : "Empty") << "  mThemeFile: " << mThemeFile);
 
-  Property::Map result;
-  if(mThemeBuilder)
-  {
-    result = mThemeBuilder.GetConfigurations();
-  }
-  else
+  if(!mThemeBuilder)
   {
     DALI_LOG_STREAM(gLogFilter, Debug::Concise, "GetConfigurations()  Loading default theme");
 
-    bool themeLoaded = false;
-
     mThemeBuilder = CreateBuilder(mThemeBuilderConstants);
 
     // Load default theme because this is first try to load stylesheet.
-    themeLoaded = LoadJSON(mThemeBuilder, mDefaultThemeFilePath);
-    mThemeFile  = mDefaultThemeFilePath;
-
-    if(themeLoaded)
-    {
-      result = mThemeBuilder.GetConfigurations();
-    }
+#if defined(DEBUG_ENABLED)
+    bool themeLoaded = LoadJSON(mThemeBuilder, mDefaultThemeFilePath);
     DALI_LOG_STREAM(gLogFilter, Debug::Concise, "  themeLoaded" << (themeLoaded ? "success" : "failure"));
+#else
+    LoadJSON(mThemeBuilder, mDefaultThemeFilePath);
+#endif
+
+    mThemeFile = mDefaultThemeFilePath;
   }
 
+#if defined(DEBUG_ENABLED)
+  Property::Map result = mThemeBuilder.GetConfigurations();
   DALI_LOG_STREAM(gLogFilter, Debug::Concise, "GetConfigurations()\n On exit, result Count: " << (result.Count() != 0));
   DALI_LOG_STREAM(gLogFilter, Debug::Verbose, "          result: " << result);
+#endif
 
-  return result;
+  return mThemeBuilder.GetConfigurations();
 }
 
 void StyleManager::SetBrokenImageUrl(DevelStyleManager::BrokenImageType brokenImageType, const std::string& brokenImageUrl)
 {
-  int brokenType = static_cast<int>(brokenImageType);
-  mBrokenImageUrls[brokenType] = brokenImageUrl;
+  int brokenType                     = static_cast<int>(brokenImageType);
+  mBrokenImageUrls[brokenType]       = brokenImageUrl;
   Toolkit::StyleManager styleManager = StyleManager::Get();
   mBrokenImageChangedSignal.Emit(styleManager);
 }
index 56e61f0..3aacf79 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_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.
@@ -28,9 +28,9 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/builder/builder.h>
+#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
 #include <dali-toolkit/internal/builder/style.h>
 #include <dali-toolkit/public-api/styling/style-manager.h>
-#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
 
 namespace Dali
 {
@@ -93,7 +93,7 @@ public: // Public API
   /**
    * @copydoc Toolkit::StyleManager::GetConfigurations
    */
-  const Property::Map GetConfigurations();
+  const Property::Map& GetConfigurations();
 
   /**
    * @copydoc Toolkit::DevelStyleManager::SetBrokenImageUrl
@@ -255,7 +255,7 @@ private:
 
   Toolkit::Internal::FeedbackStyle* mFeedbackStyle; ///< Feedback style
 
-  std::vector<std::string> mBrokenImageUrls;    ///< Broken Image Urls received from user
+  std::vector<std::string> mBrokenImageUrls; ///< Broken Image Urls received from user
 
   // Signals
   Toolkit::StyleManager::StyleChangedSignalType            mControlStyleChangeSignal; ///< Emitted when the style( theme/font ) changes for the controls to style themselves
index 60eb03b..1047411 100644 (file)
@@ -941,7 +941,7 @@ void ResizeModelVectors(MarkupProcessData& markupProcessData,
   markupProcessData.characterSpacingCharacterRuns.Resize(characterSpacingCharacterRunIndex);
 
 #ifdef DEBUG_ENABLED
-  for(unsigned int i = 0; i < colorRunIndex; ++i)
+  for(uint32_t i = 0; gLogFilter->IsEnabledFor(Debug::Verbose) && i < colorRunIndex; ++i)
   {
     ColorRun& run = markupProcessData.colorRuns[i];
     DALI_LOG_INFO(gLogFilter, Debug::Verbose, "run[%d] index: %d, length: %d, color %f,%f,%f,%f\n", i, run.characterRun.characterIndex, run.characterRun.numberOfCharacters, run.color.r, run.color.g, run.color.b, run.color.a);
index dbd110b..52f2b18 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -500,6 +500,7 @@ void MultilanguageSupport::ValidateFonts(const Vector<Character>&
                               scriptRunEndIt);
 
 #ifdef DEBUG_ENABLED
+    if(gLogFilter->IsEnabledFor(Debug::Verbose))
     {
       Dali::TextAbstraction::FontDescription description;
       fontClient.GetDescription(fontId, description);
@@ -716,6 +717,7 @@ void MultilanguageSupport::ValidateFonts(const Vector<Character>&
     }
 
 #ifdef DEBUG_ENABLED
+    if(gLogFilter->IsEnabledFor(Debug::Verbose))
     {
       Dali::TextAbstraction::FontDescription description;
       fontClient.GetDescription(fontId, description);
index e30564e..847954f 100644 (file)
@@ -221,7 +221,7 @@ struct AtlasRenderer::Impl
                                 glyphBufferData.width,
                                 glyphBufferData.height,
                                 glyphBufferData.format,
-                                PixelData::DELETE_ARRAY);
+                                PixelData::FREE);
 
         if(bitmap)
         {
@@ -782,7 +782,7 @@ struct AtlasRenderer::Impl
 
     DALI_LOG_INFO(gLogFilter, Debug::Verbose, "%s\n", metrics.mVerboseGlyphCounts.c_str());
 
-    for(uint32_t i = 0; i < metrics.mAtlasMetrics.mAtlasCount; ++i)
+    for(uint32_t i = 0; gLogFilter->IsEnabledFor(Debug::Verbose) && i < metrics.mAtlasMetrics.mAtlasCount; ++i)
     {
       DALI_LOG_INFO(gLogFilter, Debug::Verbose, "   Atlas [%i] %sPixels: %s Size: %ix%i, BlockSize: %ix%i, BlocksUsed: %i/%i\n", i + 1, i > 8 ? "" : " ", metrics.mAtlasMetrics.mAtlasMetrics[i].mPixelFormat == Pixel::L8 ? "L8  " : "BGRA", metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mWidth, metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mHeight, metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mBlockWidth, metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mBlockHeight, metrics.mAtlasMetrics.mAtlasMetrics[i].mBlocksUsed, metrics.mAtlasMetrics.mAtlasMetrics[i].mTotalBlocks);
     }
index b1502a9..da397ac 100644 (file)
@@ -96,9 +96,9 @@ void TypesetGlyph(GlyphData&           data,
   const int32_t xOffset = data.horizontalOffset + position->x;
 
   // Whether the given glyph is a color one.
-  const bool     isColorGlyph   = data.glyphBitmap.isColorEmoji || data.glyphBitmap.isColorBitmap;
-  const uint32_t glyphPixelSize = Pixel::GetBytesPerPixel(data.glyphBitmap.format);
-  const uint32_t alphaIndex     = glyphPixelSize - 1u;
+  const bool     isColorGlyph    = data.glyphBitmap.isColorEmoji || data.glyphBitmap.isColorBitmap;
+  const uint32_t glyphPixelSize  = Pixel::GetBytesPerPixel(data.glyphBitmap.format);
+  const uint32_t glyphAlphaIndex = glyphPixelSize - 1u;
 
   // Determinate iterator range.
   const int32_t lineIndexRangeMin = std::max(0, -yOffset);
@@ -114,9 +114,9 @@ void TypesetGlyph(GlyphData&           data,
 
   if(Pixel::RGBA8888 == pixelFormat)
   {
-    const bool swapChannelsBR = Pixel::BGRA8888 == data.glyphBitmap.format;
-
     uint32_t* bitmapBuffer = reinterpret_cast<uint32_t*>(data.bitmapBuffer.GetBuffer());
+    // Skip basic line.
+    bitmapBuffer += (lineIndexRangeMin + yOffset) * static_cast<int32_t>(data.width);
 
     // Fast-cut if style is MASK or OUTLINE. Outline not shown for color glyph.
     // Just overwrite transparent color and return.
@@ -124,17 +124,17 @@ void TypesetGlyph(GlyphData&           data,
     {
       for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
       {
-        const int32_t yOffsetIndex   = yOffset + lineIndex;
-        const int32_t verticalOffset = yOffsetIndex * data.width;
-
         // We can use memset here.
-        memset(bitmapBuffer + verticalOffset + xOffset + indexRangeMin, 0, (indexRangeMax - indexRangeMin) * sizeof(uint32_t));
+        memset(bitmapBuffer + xOffset + indexRangeMin, 0, (indexRangeMax - indexRangeMin) * sizeof(uint32_t));
+        bitmapBuffer += data.width;
       }
       return;
     }
 
+    const bool swapChannelsBR = Pixel::BGRA8888 == data.glyphBitmap.format;
+
     // Pointer to the color glyph if there is one.
-    const uint32_t* const colorGlyphBuffer = isColorGlyph ? reinterpret_cast<uint32_t*>(data.glyphBitmap.buffer) : NULL;
+    const uint8_t* glyphBuffer = data.glyphBitmap.buffer;
 
     // Precalculate input color's packed result.
     uint32_t packedInputColor       = 0u;
@@ -145,21 +145,20 @@ void TypesetGlyph(GlyphData&           data,
     *(packedInputColorBuffer + 1u) = static_cast<uint8_t>(color->g * 255);
     *(packedInputColorBuffer)      = static_cast<uint8_t>(color->r * 255);
 
+    // Skip basic line of glyph.
+    glyphBuffer += (lineIndexRangeMin) * static_cast<int32_t>(data.glyphBitmap.width) * glyphPixelSize;
+
     // Traverse the pixels of the glyph line per line.
-    for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
+    if(isColorGlyph)
     {
-      const int32_t yOffsetIndex = yOffset + lineIndex;
-
-      const int32_t verticalOffset    = yOffsetIndex * data.width;
-      const int32_t glyphBufferOffset = lineIndex * static_cast<int32_t>(data.glyphBitmap.width);
-      for(int32_t index = indexRangeMin; index < indexRangeMax; ++index)
+      for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
       {
-        const int32_t xOffsetIndex = xOffset + index;
-
-        if(isColorGlyph)
+        for(int32_t index = indexRangeMin; index < indexRangeMax; ++index)
         {
+          const int32_t xOffsetIndex = xOffset + index;
+
           // Retrieves the color from the color glyph.
-          uint32_t packedColorGlyph       = *(colorGlyphBuffer + glyphBufferOffset + index);
+          uint32_t packedColorGlyph       = *(reinterpret_cast<const uint32_t*>(glyphBuffer + (index << 2)));
           uint8_t* packedColorGlyphBuffer = reinterpret_cast<uint8_t*>(&packedColorGlyph);
 
           // Update the alpha channel.
@@ -193,23 +192,28 @@ void TypesetGlyph(GlyphData&           data,
           }
 
           // Set the color into the final pixel buffer.
-          *(bitmapBuffer + verticalOffset + xOffsetIndex) = packedColorGlyph;
+          *(bitmapBuffer + xOffsetIndex) = packedColorGlyph;
         }
-        else
+        bitmapBuffer += data.width;
+        glyphBuffer += data.glyphBitmap.width * glyphPixelSize;
+      }
+    }
+    else
+    {
+      for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
+      {
+        for(int32_t index = indexRangeMin; index < indexRangeMax; ++index)
         {
-          // Pack the given color into a 32bit buffer. The alpha channel will be updated later for each pixel.
-          // The format is RGBA8888.
-          uint32_t packedColor       = 0u;
-          uint8_t* packedColorBuffer = reinterpret_cast<uint8_t*>(&packedColor);
-
           // Update the alpha channel.
-          const uint8_t alpha = *(data.glyphBitmap.buffer + glyphPixelSize * (glyphBufferOffset + index) + alphaIndex);
+          const uint8_t alpha = *(glyphBuffer + index * glyphPixelSize + glyphAlphaIndex);
 
           // Copy non-transparent pixels only
           if(alpha > 0u)
           {
+            const int32_t xOffsetIndex = xOffset + index;
+
             // Check alpha of overlapped pixels
-            uint32_t& currentColor             = *(bitmapBuffer + verticalOffset + xOffsetIndex);
+            uint32_t& currentColor             = *(bitmapBuffer + xOffsetIndex);
             uint8_t*  packedCurrentColorBuffer = reinterpret_cast<uint8_t*>(&currentColor);
 
             // For any pixel overlapped with the pixel in previous glyphs, make sure we don't
@@ -225,6 +229,11 @@ void TypesetGlyph(GlyphData&           data,
             }
             else
             {
+              // Pack the given color into a 32bit buffer. The alpha channel will be updated later for each pixel.
+              // The format is RGBA8888.
+              uint32_t packedColor       = 0u;
+              uint8_t* packedColorBuffer = reinterpret_cast<uint8_t*>(&packedColor);
+
               // Color is pre-muliplied with its alpha.
               *(packedColorBuffer + 3u) = MultiplyAndNormalizeColor(*(packedInputColorBuffer + 3u), currentAlpha);
               *(packedColorBuffer + 2u) = MultiplyAndNormalizeColor(*(packedInputColorBuffer + 2u), currentAlpha);
@@ -236,35 +245,38 @@ void TypesetGlyph(GlyphData&           data,
             }
           }
         }
+        bitmapBuffer += data.width;
+        glyphBuffer += data.glyphBitmap.width * glyphPixelSize;
       }
     }
   }
-  else
+  else // Pixel::L8
   {
     // Below codes required only if not color glyph.
     if(!isColorGlyph)
     {
-      uint8_t* bitmapBuffer = reinterpret_cast<uint8_t*>(data.bitmapBuffer.GetBuffer());
+      uint8_t*       bitmapBuffer = data.bitmapBuffer.GetBuffer();
+      const uint8_t* glyphBuffer  = data.glyphBitmap.buffer;
+
+      // Skip basic line.
+      bitmapBuffer += (lineIndexRangeMin + yOffset) * static_cast<int32_t>(data.width);
+      glyphBuffer += (lineIndexRangeMin) * static_cast<int32_t>(data.glyphBitmap.width) * glyphPixelSize;
 
       // Traverse the pixels of the glyph line per line.
       for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
       {
-        const int32_t yOffsetIndex = yOffset + lineIndex;
-
-        const int32_t verticalOffset    = yOffsetIndex * data.width;
-        const int32_t glyphBufferOffset = lineIndex * static_cast<int32_t>(data.glyphBitmap.width);
         for(int32_t index = indexRangeMin; index < indexRangeMax; ++index)
         {
           const int32_t xOffsetIndex = xOffset + index;
 
           // Update the alpha channel.
-          const uint8_t alpha = *(data.glyphBitmap.buffer + glyphPixelSize * (glyphBufferOffset + index) + alphaIndex);
+          const uint8_t alpha = *(glyphBuffer + index * glyphPixelSize + glyphAlphaIndex);
 
           // Copy non-transparent pixels only
           if(alpha > 0u)
           {
             // Check alpha of overlapped pixels
-            uint8_t& currentAlpha = *(bitmapBuffer + verticalOffset + xOffsetIndex);
+            uint8_t& currentAlpha = *(bitmapBuffer + xOffsetIndex);
 
             // For any pixel overlapped with the pixel in previous glyphs, make sure we don't
             // overwrite a previous bigger alpha with a smaller alpha (in order to avoid
@@ -273,6 +285,9 @@ void TypesetGlyph(GlyphData&           data,
             currentAlpha = std::max(currentAlpha, alpha);
           }
         }
+
+        bitmapBuffer += data.width;
+        glyphBuffer += data.glyphBitmap.width * glyphPixelSize;
       }
     }
   }
@@ -1292,8 +1307,8 @@ Devel::PixelBuffer Typesetter::CreateImageBuffer(const uint32_t& bufferWidth, co
           glyphData.verticalOffset += glyphData.glyphBitmap.outlineOffsetY;
         }
 
-        // delete the glyphBitmap.buffer as it is now copied into glyphData.bitmapBuffer
-        delete[] glyphData.glyphBitmap.buffer;
+        // free the glyphBitmap.buffer as it is now copied into glyphData.bitmapBuffer
+        free(glyphData.glyphBitmap.buffer);
         glyphData.glyphBitmap.buffer = NULL;
       }
 
index 5944039..5e28f9c 100644 (file)
@@ -37,10 +37,10 @@ namespace Toolkit
 {
 namespace Text
 {
-const float DEFAULT_TEXTFIT_MIN     = 10.f;
-const float DEFAULT_TEXTFIT_MAX     = 100.f;
-const float DEFAULT_TEXTFIT_STEP    = 1.f;
-const float DEFAULT_FONT_SIZE_SCALE = 1.f;
+const float DEFAULT_TEXTFIT_MIN            = 10.f;
+const float DEFAULT_TEXTFIT_MAX            = 100.f;
+const float DEFAULT_TEXTFIT_STEP           = 1.f;
+const float DEFAULT_FONT_SIZE_SCALE        = 1.f;
 const float DEFAULT_DISABLED_COLOR_OPACITY = 0.3f;
 
 //Forward declarations
@@ -385,12 +385,11 @@ struct Controller::Impl
     Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
     if(styleManager)
     {
-      bool          temp;
-      Property::Map config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
-      if(config["clearFocusOnEscape"].Get(temp))
-      {
-        mShouldClearFocusOnEscape = temp;
-      }
+      const Property::Map& config                  = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
+      const auto           clearFocusOnEscapeValue = config.Find("clearFocusOnEscape", Property::Type::BOOLEAN);
+
+      // Default is true. If config don't have "clearFocusOnEscape" property, make it true.
+      mShouldClearFocusOnEscape = (!clearFocusOnEscapeValue || clearFocusOnEscapeValue->Get<bool>());
     }
   }
 
index 42199ad..3e4c9c8 100644 (file)
@@ -67,7 +67,7 @@ Size Controller::Relayouter::CalculateLayoutSizeOnRequiredControllerSize(Control
                                                                         SHAPE_TEXT |
                                                                         GET_GLYPH_METRICS);
 
-  const OperationsMask sizeOperations     = static_cast<OperationsMask>(LAYOUT | ALIGN | REORDER);
+  const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT | ALIGN | REORDER);
 
   // Set the update info to relayout the whole text.
   TextUpdateInfo& textUpdateInfo = impl.mTextUpdateInfo;
@@ -798,13 +798,13 @@ void Controller::Relayouter::DoRelayoutHorizontalAlignment(Controller::Impl&
 
 void Controller::Relayouter::CalculateVerticalOffset(Controller::Impl& impl, const Size& controlSize)
 {
-  ModelPtr&         model                 = impl.mModel;
-  VisualModelPtr&   visualModel           = model->mVisualModel;
-  Size              layoutSize            = model->mVisualModel->GetLayoutSize();
-  Size              oldLayoutSize         = layoutSize;
-  float             offsetY               = 0.f;
-  bool              needRecalc            = false;
-  float             defaultFontLineHeight = impl.GetDefaultFontLineHeight();
+  ModelPtr&       model                 = impl.mModel;
+  VisualModelPtr& visualModel           = model->mVisualModel;
+  Size            layoutSize            = model->mVisualModel->GetLayoutSize();
+  Size            oldLayoutSize         = layoutSize;
+  float           offsetY               = 0.f;
+  bool            needRecalc            = false;
+  float           defaultFontLineHeight = impl.GetDefaultFontLineHeight();
 
   if(fabsf(layoutSize.height) < Math::MACHINE_EPSILON_1000)
   {
index a334e2f..382d52b 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/image-loading.h>
 #include <dali/integration-api/debug.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
 #include <memory>
 
 // INTERNAL INCLUDES
@@ -46,7 +47,7 @@ namespace Internal
 {
 namespace
 {
-const int CUSTOM_PROPERTY_COUNT(10); // ltr, wrap, pixel area, crop to mask, mask texture ratio + border/corner
+const int CUSTOM_PROPERTY_COUNT(5); // ltr, wrap, pixel area, crop to mask, mask texture ratio
 
 // stop behavior
 DALI_ENUM_TO_STRING_TABLE_BEGIN(STOP_BEHAVIOR)
@@ -177,7 +178,7 @@ void AnimatedImageVisual::CreateImageCache()
 
   if(mAnimatedImageLoading)
   {
-    mImageCache = new RollingAnimatedImageCache(textureManager, mAnimatedImageLoading, mMaskingData, *this, mCacheSize, mBatchSize, IsSynchronousLoadingRequired(),mFactoryCache.GetPreMultiplyOnLoad());
+    mImageCache = new RollingAnimatedImageCache(textureManager, mAnimatedImageLoading, mMaskingData, *this, mCacheSize, mBatchSize, IsSynchronousLoadingRequired(), mFactoryCache.GetPreMultiplyOnLoad());
   }
   else if(mImageUrls)
   {
@@ -730,7 +731,7 @@ void AnimatedImageVisual::OnInitialize()
 
   Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
 
-  mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+  mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
   mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
 
   // Register transform properties
@@ -979,8 +980,8 @@ void AnimatedImageVisual::CheckMaskTexture()
 {
   if(mMaskingData && !mMaskingData->mPreappliedMasking)
   {
-    bool maskLoadFailed = true;
-    TextureSet textures = mImpl->mRenderer.GetTextures();
+    bool       maskLoadFailed = true;
+    TextureSet textures       = mImpl->mRenderer.GetTextures();
     if(textures && textures.GetTextureCount() >= TEXTURE_COUNT_FOR_GPU_ALPHA_MASK)
     {
       maskLoadFailed = false;
index c430320..74ec088 100644 (file)
@@ -28,6 +28,7 @@ namespace
 Debug::Filter* gAnimImgLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ANIMATED_IMAGE");
 
 #define LOG_CACHE                                                                                                       \
+  if(gAnimImgLogFilter->IsEnabledFor(Debug::Concise))                                                                   \
   {                                                                                                                     \
     std::ostringstream oss;                                                                                             \
     oss << "Size:" << mQueue.Count() << " [ ";                                                                          \
@@ -194,7 +195,7 @@ TextureSet RollingAnimatedImageCache::RequestFrameLoading(uint32_t frameIndex, b
   mLoadState = TextureManager::LoadState::LOADING;
 
   auto preMultiplyOnLoading = mPreMultiplyOnLoad ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
-                                                  : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+                                                 : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
 
   TextureManager::TextureId loadTextureId = TextureManager::INVALID_TEXTURE_ID;
   TextureSet                textureSet    = mTextureManager.LoadAnimatedImageTexture(mImageUrl,
index f78d74a..7a84f5b 100644 (file)
@@ -29,6 +29,7 @@ namespace
 Debug::Filter* gAnimImgLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ANIMATED_IMAGE");
 
 #define LOG_CACHE                                                                                                                                                        \
+  if(gAnimImgLogFilter->IsEnabledFor(Debug::Concise))                                                                                                                    \
   {                                                                                                                                                                      \
     std::ostringstream oss;                                                                                                                                              \
     oss << "Size:" << mQueue.Count() << " [ ";                                                                                                                           \
index f4e3059..1017ae0 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/devel-api/common/stage.h>
 #include <dali/devel-api/rendering/renderer-devel.h>
 #include <dali/integration-api/debug.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-signals-devel.h>
@@ -44,7 +45,7 @@ namespace Internal
 {
 namespace
 {
-const int CUSTOM_PROPERTY_COUNT(6); // 5 transform properties + pixel area,
+const int CUSTOM_PROPERTY_COUNT(1); // pixel area,
 
 const Dali::Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
 
@@ -299,7 +300,7 @@ void AnimatedVectorImageVisual::OnInitialize(void)
 
   Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
 
-  mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+  mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
   mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
 
   TextureSet textureSet = TextureSet::New();
index 8dfc168..09fd60e 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/devel-api/rendering/renderer-devel.h>
 #include <dali/integration-api/debug.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
 
 //INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/visuals/color-visual-properties-devel.h>
@@ -41,7 +42,7 @@ namespace Internal
 {
 namespace
 {
-const int CUSTOM_PROPERTY_COUNT(6); // Blur Radius + border/corner
+const int CUSTOM_PROPERTY_COUNT(0);
 
 VisualFactoryCache::ShaderType SHADER_TYPE_TABLE[6] =
   {
@@ -73,7 +74,6 @@ ColorVisualPtr ColorVisual::New(VisualFactoryCache& factoryCache, const Property
 ColorVisual::ColorVisual(VisualFactoryCache& factoryCache)
 : Visual::Base(factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::COLOR),
   mBlurRadius(0.0f),
-  mBlurRadiusIndex(Property::INVALID_INDEX),
   mAlwaysUsingBlurRadius(false)
 {
 }
@@ -117,25 +117,26 @@ void ColorVisual::DoSetProperties(const Property::Map& propertyMap)
       DALI_LOG_ERROR("ColorVisual:DoSetProperties:: BLUR_RADIUS property has incorrect type: %d\n", blurRadiusValue->GetType());
     }
 
-    if(mBlurRadiusIndex != Property::INVALID_INDEX)
-    {
-      mImpl->mRenderer.SetProperty(mBlurRadiusIndex, mBlurRadius);
-    }
-    else if(DALI_UNLIKELY(mImpl->mRenderer && (!EqualsZero(mBlurRadius) || mAlwaysUsingBlurRadius)))
+    if(DALI_UNLIKELY(mImpl->mRenderer))
     {
       // Unusual case. SetProperty called after OnInitialize().
       // Assume that DoAction call UPDATE_PROPERTY.
-      // We must regist properies into renderer, and update shader.
-
-      // BlurRadius added by this action. Regist property to renderer.
-      mBlurRadiusIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelColorVisual::Property::BLUR_RADIUS, BLUR_RADIUS_NAME, mBlurRadius);
-      mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+      DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBlurRadiusUniform();
+      mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BLUR_RADIUS, mBlurRadius);
 
-      // Change the shader must not be occured many times. we always have to use blur feature.
-      mAlwaysUsingBlurRadius = true;
-
-      // Change shader
-      UpdateShader();
+      // Check whether we must update shader.
+      if(!mAlwaysUsingBlurRadius && IsBlurRequired())
+      {
+        // Change the shader must not be occured many times. we always have to use blur feature.
+        mAlwaysUsingBlurRadius = true;
+
+        mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+        // Change shader
+        if(!mImpl->mCustomShader)
+        {
+          UpdateShader();
+        }
+      }
     }
   }
 }
@@ -159,10 +160,10 @@ void ColorVisual::DoCreatePropertyMap(Property::Map& map) const
   map.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
   map.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, mImpl->mMixColor);
 
-  if(mImpl->mRenderer && mBlurRadiusIndex != Property::INVALID_INDEX)
+  if(mImpl->mRenderer)
   {
     // Update values from Renderer
-    float blurRadius = mImpl->mRenderer.GetProperty<float>(mBlurRadiusIndex);
+    float blurRadius = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BLUR_RADIUS);
     map.Insert(Toolkit::DevelColorVisual::Property::BLUR_RADIUS, blurRadius);
   }
   else
@@ -208,14 +209,15 @@ void ColorVisual::OnInitialize()
 
   Shader shader = GenerateShader();
 
-  mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+  mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
   mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
 
   mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, Vector3(mImpl->mMixColor));
 
-  if(!EqualsZero(mBlurRadius))
+  if(mAlwaysUsingBlurRadius || !EqualsZero(mBlurRadius))
   {
-    mBlurRadiusIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelColorVisual::Property::BLUR_RADIUS, BLUR_RADIUS_NAME, mBlurRadius);
+    DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBlurRadiusUniform();
+    mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BLUR_RADIUS, mBlurRadius);
     mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
   }
 
@@ -230,7 +232,7 @@ Shader ColorVisual::GenerateShader() const
 
   bool roundedCorner  = IsRoundedCornerRequired();
   bool borderline     = IsBorderlineRequired();
-  bool blur           = !EqualsZero(mBlurRadius) || mAlwaysUsingBlurRadius;
+  bool blur           = IsBlurRequired();
   int  shaderTypeFlag = ColorVisualRequireFlag::DEFAULT;
 
   if(roundedCorner)
@@ -256,18 +258,18 @@ Shader ColorVisual::GenerateShader() const
     std::string fragmentShaderPrefixList;
     if(roundedCorner)
     {
-      vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
-      fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
+      vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
+      fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
     }
     if(blur)
     {
-      vertexShaderPrefixList += "#define IS_REQUIRED_BLUR 1\n";
-      fragmentShaderPrefixList += "#define IS_REQUIRED_BLUR 1\n";
+      vertexShaderPrefixList += "#define IS_REQUIRED_BLUR\n";
+      fragmentShaderPrefixList += "#define IS_REQUIRED_BLUR\n";
     }
     if(borderline)
     {
-      vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
-      fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
+      vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
+      fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
     }
     shader = Shader::New(Dali::Shader::GetVertexShaderPrefix() + vertexShaderPrefixList + SHADER_COLOR_VISUAL_SHADER_VERT.data(),
                          Dali::Shader::GetFragmentShaderPrefix() + fragmentShaderPrefixList + SHADER_COLOR_VISUAL_SHADER_FRAG.data());
@@ -287,23 +289,39 @@ Dali::Property ColorVisual::OnGetPropertyObject(Dali::Property::Key key)
 
   if((key.type == Property::Key::INDEX && key.indexKey == DevelColorVisual::Property::BLUR_RADIUS) || (key.type == Property::Key::STRING && key.stringKey == BLUR_RADIUS_NAME))
   {
-    mBlurRadiusIndex = mImpl->mRenderer.RegisterProperty(DevelColorVisual::Property::BLUR_RADIUS, BLUR_RADIUS_NAME, mBlurRadius);
+    const bool updateShader = !mImpl->mCustomShader && !IsBlurRequired();
 
     // Blur is animated now. we always have to use blur feature.
     mAlwaysUsingBlurRadius = true;
 
-    mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
-
-    // Change shader
-    UpdateShader();
+    if(updateShader)
+    {
+      // Update each values to renderer
+      DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBlurRadiusUniform();
+      mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BLUR_RADIUS, mBlurRadius);
 
-    return Dali::Property(mImpl->mRenderer, mBlurRadiusIndex);
+      // Change shader
+      UpdateShader();
+    }
+    mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+    return Dali::Property(mImpl->mRenderer, DecoratedVisualRenderer::Property::BLUR_RADIUS);
   }
 
   Handle handle;
   return Dali::Property(handle, Property::INVALID_INDEX);
 }
 
+bool ColorVisual::IsBlurRequired() const
+{
+  float blurRadius = mBlurRadius;
+  if(mImpl->mRenderer)
+  {
+    // Update values from Renderer
+    blurRadius = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BLUR_RADIUS);
+  }
+  return mAlwaysUsingBlurRadius || !EqualsZero(blurRadius);
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
index bb8bc95..0a8a8b2 100644 (file)
@@ -123,6 +123,14 @@ protected:
    */
   Dali::Property OnGetPropertyObject(Dali::Property::Key key) override;
 
+protected:
+  /**
+   * @brief Query whether the visual requires to be blur.
+   *
+   * @return Returns true if the blur is required, false otherwise.
+   */
+  bool IsBlurRequired() const;
+
 private:
   // Undefined
   ColorVisual(const ColorVisual& colorRenderer);
@@ -131,9 +139,8 @@ private:
   ColorVisual& operator=(const ColorVisual& colorRenderer);
 
 private:
-  float           mBlurRadius;                ///< The blur radius
-  Property::Index mBlurRadiusIndex;           ///< The blur radius property index
-  bool            mAlwaysUsingBlurRadius : 1; ///< Whether we need the blur radius in shader always.
+  float mBlurRadius;                ///< The blur radius
+  bool  mAlwaysUsingBlurRadius : 1; ///< Whether we need the blur radius in shader always.
 };
 
 } // namespace Internal
index cef1ef4..ea84e5e 100644 (file)
@@ -25,6 +25,7 @@
 #include <dali/integration-api/debug.h>
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/object/property-array.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
 #include <typeinfo>
 
 // INTERNAL INCLUDES
@@ -46,7 +47,7 @@ namespace Internal
 {
 namespace
 {
-const int CUSTOM_PROPERTY_COUNT(6); // alignment + corner/border
+const int CUSTOM_PROPERTY_COUNT(1); // alignment
 
 DALI_ENUM_TO_STRING_TABLE_BEGIN(UNITS)
   DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::GradientVisual::Units, OBJECT_BOUNDING_BOX)
@@ -261,7 +262,7 @@ void GradientVisual::OnInitialize()
   sampler.SetWrapMode(wrap, wrap);
   textureSet.SetSampler(0u, sampler);
 
-  mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+  mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
   mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
   mImpl->mRenderer.SetTextures(textureSet);
 
@@ -391,21 +392,21 @@ Shader GradientVisual::GenerateShader() const
 
     if(roundedCorner)
     {
-      vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
-      fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
+      vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
+      fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
     }
     if(borderline)
     {
-      vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
-      fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
+      vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
+      fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
     }
     if(radialGradient)
     {
-      fragmentShaderPrefixList += "#define RADIAL 1\n";
+      fragmentShaderPrefixList += "#define RADIAL\n";
     }
     if(userspaceUnit)
     {
-      vertexShaderPrefixList += "#define USER_SPACE 1\n";
+      vertexShaderPrefixList += "#define USER_SPACE\n";
     }
 
     shader = Shader::New(Dali::Shader::GetVertexShaderPrefix() + vertexShaderPrefixList + SHADER_GRADIENT_VISUAL_SHADER_VERT.data(),
index 16ba9ca..ceb5848 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -52,18 +52,17 @@ enum class ImageVisualRequireFlag : uint32_t
   ALPHA_MASKING  = 1 << 2,
 };
 
-static constexpr auto SHADER_TYPE_COUNT = 8u;
+static constexpr auto          SHADER_TYPE_COUNT = 8u;
 VisualFactoryCache::ShaderType SHADER_TYPE_TABLE[SHADER_TYPE_COUNT] =
-{
-  VisualFactoryCache::IMAGE_SHADER,
-  VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER,
-  VisualFactoryCache::IMAGE_SHADER_BORDERLINE,
-  VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE,
-  VisualFactoryCache::IMAGE_SHADER_MASKING,
-  VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER_MASKING,
-  VisualFactoryCache::IMAGE_SHADER_BORDERLINE_MASKING,
-  VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE_MASKING
-};
+  {
+    VisualFactoryCache::IMAGE_SHADER,
+    VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER,
+    VisualFactoryCache::IMAGE_SHADER_BORDERLINE,
+    VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE,
+    VisualFactoryCache::IMAGE_SHADER_MASKING,
+    VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER_MASKING,
+    VisualFactoryCache::IMAGE_SHADER_BORDERLINE_MASKING,
+    VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE_MASKING};
 
 } // unnamed namespace
 
@@ -112,7 +111,7 @@ ImageVisualShaderFactory::~ImageVisualShaderFactory()
 
 Shader ImageVisualShaderFactory::GetShader(VisualFactoryCache& factoryCache, const ImageVisualShaderFeature::FeatureBuilder& featureBuilder)
 {
-  Shader shader;
+  Shader                         shader;
   VisualFactoryCache::ShaderType shaderType = VisualFactoryCache::IMAGE_SHADER;
 
   const auto& atlasing                = featureBuilder.mTextureAtlas;
@@ -121,8 +120,8 @@ Shader ImageVisualShaderFactory::GetShader(VisualFactoryCache& factoryCache, con
   const auto& borderline              = featureBuilder.mBorderline;
   const auto& alphaMaskingOnRendering = featureBuilder.mAlphaMaskingOnRendering;
   const auto& changeFragmentShader    = (featureBuilder.mTexture && DevelTexture::IsNative(featureBuilder.mTexture))
-                                          ? ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE
-                                          : ImageVisualShaderFeature::ChangeFragmentShader::DONT_CHANGE;
+                                       ? ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE
+                                       : ImageVisualShaderFeature::ChangeFragmentShader::DONT_CHANGE;
 
   if(atlasing == ImageVisualShaderFeature::TextureAtlas::ENABLED)
   {
@@ -169,33 +168,33 @@ Shader ImageVisualShaderFactory::GetShader(VisualFactoryCache& factoryCache, con
     {
       if(defaultTextureWrapping == ImageVisualShaderFeature::DefaultTextureWrapMode::APPLY)
       {
-        fragmentShaderPrefixList += "#define ATLAS_DEFAULT_WARP 1\n";
+        fragmentShaderPrefixList += "#define ATLAS_DEFAULT_WARP\n";
       }
       else
       {
-        fragmentShaderPrefixList += "#define ATLAS_CUSTOM_WARP 1\n";
+        fragmentShaderPrefixList += "#define ATLAS_CUSTOM_WARP\n";
       }
     }
     else
     {
       if(roundedCorner == ImageVisualShaderFeature::RoundedCorner::ENABLED)
       {
-        vertexShaderPrefixList   += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
-        fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
+        vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
+        fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
       }
       if(borderline == ImageVisualShaderFeature::Borderline::ENABLED)
       {
-        vertexShaderPrefixList   += "#define IS_REQUIRED_BORDERLINE 1\n";
-        fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
+        vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
+        fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
       }
       if(alphaMaskingOnRendering == ImageVisualShaderFeature::AlphaMaskingOnRendering::ENABLED)
       {
-        vertexShaderPrefixList   += "#define IS_REQUIRED_ALPHA_MASKING 1\n";
-        fragmentShaderPrefixList += "#define IS_REQUIRED_ALPHA_MASKING 1\n";
+        vertexShaderPrefixList += "#define IS_REQUIRED_ALPHA_MASKING\n";
+        fragmentShaderPrefixList += "#define IS_REQUIRED_ALPHA_MASKING\n";
       }
     }
 
-    std::string vertexShader   = std::string(Dali::Shader::GetVertexShaderPrefix()   + vertexShaderPrefixList   + SHADER_IMAGE_VISUAL_SHADER_VERT.data());
+    std::string vertexShader   = std::string(Dali::Shader::GetVertexShaderPrefix() + vertexShaderPrefixList + SHADER_IMAGE_VISUAL_SHADER_VERT.data());
     std::string fragmentShader = std::string(Dali::Shader::GetFragmentShaderPrefix() + fragmentShaderPrefixList + SHADER_IMAGE_VISUAL_SHADER_FRAG.data());
 
     if(changeFragmentShader == ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE)
index 44c9fac..ef71786 100644 (file)
@@ -27,6 +27,7 @@
 #include <dali/devel-api/scripting/scripting.h>
 #include <dali/integration-api/debug.h>
 #include <dali/public-api/actors/layer.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
 #include <cstring> // for strlen()
 
 // INTERNAL HEADERS
@@ -51,7 +52,7 @@ namespace Internal
 {
 namespace
 {
-const int CUSTOM_PROPERTY_COUNT(12); // ltr, wrap, pixel area, atlas, pixalign, crop to mask, mask texture ratio + border/corner
+const int CUSTOM_PROPERTY_COUNT(7); // ltr, wrap, pixel area, atlas, pixalign, crop to mask, mask texture ratio
 
 // fitting modes
 DALI_ENUM_TO_STRING_TABLE_BEGIN(FITTING_MODE)
@@ -582,7 +583,7 @@ void ImageVisual::OnInitialize()
   Shader shader = GenerateShader();
 
   // Create the renderer
-  mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+  mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
   mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
 
   //Register transform properties
@@ -1057,7 +1058,7 @@ Shader ImageVisual::GenerateShader() const
 
   if(useStandardShader)
   {
-    bool   requiredAlphaMaskingOnRendering = (mMaskingData && !mMaskingData->mMaskImageLoadingFailed) ? !mMaskingData->mPreappliedMasking : false;
+    bool requiredAlphaMaskingOnRendering = (mMaskingData && !mMaskingData->mMaskImageLoadingFailed) ? !mMaskingData->mPreappliedMasking : false;
     // Create and cache the standard shader
     shader = mImageVisualShaderFactory.GetShader(
       mFactoryCache,
@@ -1133,8 +1134,8 @@ void ImageVisual::CheckMaskTexture()
 {
   if(mMaskingData && !mMaskingData->mPreappliedMasking)
   {
-    bool maskLoadFailed = true;
-    TextureSet textures = mImpl->mRenderer.GetTextures();
+    bool       maskLoadFailed = true;
+    TextureSet textures       = mImpl->mRenderer.GetTextures();
     if(textures && textures.GetTextureCount() >= TEXTURE_COUNT_FOR_GPU_ALPHA_MASK)
     {
       if(mMaskingData->mCropToMask)
index a92f7f8..9d0a2cc 100644 (file)
@@ -29,6 +29,7 @@
 // EXTERNAL INCLUDES
 #include <dali/devel-api/common/stage.h>
 #include <dali/integration-api/debug.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
 
 namespace Dali
 {
@@ -38,7 +39,7 @@ namespace Internal
 {
 namespace
 {
-const int CUSTOM_PROPERTY_COUNT(6); // atlas + corner/border
+const int CUSTOM_PROPERTY_COUNT(1); // atlas
 
 // property name
 const Dali::Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
@@ -85,7 +86,7 @@ void SvgVisual::OnInitialize()
 {
   Shader   shader   = GenerateShader();
   Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
-  mImpl->mRenderer  = VisualRenderer::New(geometry, shader);
+  mImpl->mRenderer  = DecoratedVisualRenderer::New(geometry, shader);
   mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
 
   Vector2 dpi     = Stage::GetCurrent().GetDpi();
index 2616b2a..49a14de 100644 (file)
@@ -126,10 +126,6 @@ Internal::Visual::Base::Impl::Impl(FittingMode fittingMode, Toolkit::Visual::Typ
   mCornerRadius(Vector4::ZERO),
   mCornerRadiusPolicy(1.0f),
   mDepthIndex(0.0f),
-  mBorderlineWidthIndex(Property::INVALID_INDEX),
-  mBorderlineColorIndex(Property::INVALID_INDEX),
-  mBorderlineOffsetIndex(Property::INVALID_INDEX),
-  mCornerRadiusIndex(Property::INVALID_INDEX),
   mFittingMode(fittingMode),
   mFlags(0),
   mResourceStatus(Toolkit::Visual::ResourceStatus::PREPARING),
index f462be2..568af24 100644 (file)
@@ -127,10 +127,6 @@ struct Base::Impl
   Vector4                         mCornerRadius;
   float                           mCornerRadiusPolicy;
   int                             mDepthIndex;
-  Property::Index                 mBorderlineWidthIndex;
-  Property::Index                 mBorderlineColorIndex;
-  Property::Index                 mBorderlineOffsetIndex;
-  Property::Index                 mCornerRadiusIndex;
   FittingMode                     mFittingMode; ///< How the contents should fit the view
   int                             mFlags;
   Toolkit::Visual::ResourceStatus mResourceStatus;
index 960a9fd..b50cc59 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/devel-api/rendering/renderer-devel.h>
 #include <dali/devel-api/scripting/enum-helper.h>
 #include <dali/integration-api/debug.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
 #include <dali/public-api/rendering/visual-renderer.h>
 
 //INTERNAL HEARDER
@@ -135,22 +136,16 @@ void Visual::Base::Initialize()
   if(mImpl->mRenderer)
   {
     RegisterMixColor();
+    RegisterDecoration();
 
-    if(IsRoundedCornerRequired())
-    {
-      mImpl->mCornerRadiusIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS, mImpl->mCornerRadius);
-      mImpl->mRenderer.RegisterUniqueProperty(CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
-
-      mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
-    }
     if(IsBorderlineRequired())
     {
-      mImpl->mBorderlineWidthIndex  = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_WIDTH, BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
-      mImpl->mBorderlineColorIndex  = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_COLOR, BORDERLINE_COLOR, mImpl->mBorderlineColor);
-      mImpl->mBorderlineOffsetIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_OFFSET, BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
-
       mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
     }
+    else if(IsRoundedCornerRequired())
+    {
+      mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+    }
   }
 }
 
@@ -300,29 +295,28 @@ void Visual::Base::SetProperties(const Property::Map& propertyMap)
           mImpl->mBorderlineWidth = width;
         }
 
-        if(mImpl->mBorderlineWidthIndex != Property::INVALID_INDEX)
-        {
-          mImpl->mRenderer.SetProperty(mImpl->mBorderlineWidthIndex, mImpl->mBorderlineWidth);
-        }
-        else if(DALI_UNLIKELY(mImpl->mRenderer && IsBorderlineRequired()))
+        if(DALI_UNLIKELY(mImpl->mRenderer))
         {
           // Unusual case. SetProperty called after OnInitialize().
           // Assume that DoAction call UPDATE_PROPERTY.
-          // We must regist properies into renderer, and update shader.
+          DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBorderlineUniform();
+          mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
 
-          // Borderline added by this action. Register property to renderer.
-          mImpl->mBorderlineWidthIndex  = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_WIDTH, BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
-          mImpl->mBorderlineColorIndex  = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_COLOR, BORDERLINE_COLOR, mImpl->mBorderlineColor);
-          mImpl->mBorderlineOffsetIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_OFFSET, BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
-
-          // Make Blend mode ON_WITHOUT_CULL for transparent mix color.
-          mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
+          // Check whether we must update shader.
+          if(!mImpl->mAlwaysUsingBorderline && IsBorderlineRequired())
+          {
+            // Make Blend mode ON_WITHOUT_CULL for transparent mix color.
+            mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
 
-          // Change the shader must not be occured many times. we always have to use borderline feature.
-          mImpl->mAlwaysUsingBorderline = true;
+            // Change the shader must not be occured many times. we always have to use borderline feature.
+            mImpl->mAlwaysUsingBorderline = true;
 
-          // Change shader
-          needUpdateShader = true;
+            // Change shader
+            if(!mImpl->mCustomShader)
+            {
+              needUpdateShader = true;
+            }
+          }
         }
         break;
       }
@@ -334,9 +328,11 @@ void Visual::Base::SetProperties(const Property::Map& propertyMap)
           mImpl->mBorderlineColor = color;
         }
 
-        if(mImpl->mBorderlineColorIndex != Property::INVALID_INDEX)
+        if(DALI_UNLIKELY(mImpl->mRenderer))
         {
-          mImpl->mRenderer.SetProperty(mImpl->mBorderlineColorIndex, mImpl->mBorderlineColor);
+          // Unusual case. SetProperty called after OnInitialize().
+          // Assume that DoAction call UPDATE_PROPERTY.
+          mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
         }
         break;
       }
@@ -348,9 +344,11 @@ void Visual::Base::SetProperties(const Property::Map& propertyMap)
           mImpl->mBorderlineOffset = offset;
         }
 
-        if(mImpl->mBorderlineOffsetIndex != Property::INVALID_INDEX)
+        if(DALI_UNLIKELY(mImpl->mRenderer))
         {
-          mImpl->mRenderer.SetProperty(mImpl->mBorderlineOffsetIndex, mImpl->mBorderlineOffset);
+          // Unusual case. SetProperty called after OnInitialize().
+          // Assume that DoAction call UPDATE_PROPERTY.
+          mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
         }
         break;
       }
@@ -378,32 +376,33 @@ void Visual::Base::SetProperties(const Property::Map& propertyMap)
           }
         }
 
-        if(mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
-        {
-          mImpl->mRenderer.SetProperty(mImpl->mCornerRadiusIndex, mImpl->mCornerRadius);
-        }
-        else if(DALI_UNLIKELY(mImpl->mRenderer && IsRoundedCornerRequired()))
+        if(DALI_UNLIKELY(mImpl->mRenderer))
         {
           // Unusual case. SetProperty called after OnInitialize().
           // Assume that DoAction call UPDATE_PROPERTY.
-          // We must regist properies into renderer, and update shader.
+          DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterCornerRadiusUniform();
+          mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS, mImpl->mCornerRadius);
 
-          // CornerRadius added by this action. Regist property to renderer.
-          mImpl->mCornerRadiusIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS, mImpl->mCornerRadius);
-          mImpl->mRenderer.RegisterUniqueProperty(CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
+          // Check whether we must update shader.
+          if(!mImpl->mAlwaysUsingCornerRadius && IsRoundedCornerRequired())
+          {
+            // Change the shader must not be occured many times. we always have to use corner radius feature.
+            mImpl->mAlwaysUsingCornerRadius = true;
 
-          // Change the shader must not be occured many times. we always have to use corner radius feature.
-          mImpl->mAlwaysUsingCornerRadius = true;
+            if(!IsBorderlineRequired())
+            {
+              // If IsBorderlineRequired is true, BLEND_MODE is already BlendMode::ON_WITHOUT_CULL. So we don't overwrite it.
+              mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+            }
 
-          if(!IsBorderlineRequired())
-          {
-            // If IsBorderlineRequired is true, BLEND_MODE is already BlendMode::ON_WITHOUT_CULL. So we don't overwrite it.
-            mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+            // Change shader
+            if(!mImpl->mCustomShader)
+            {
+              needUpdateShader = true;
+            }
           }
-
-          // Change shader
-          needUpdateShader = true;
         }
+
         break;
       }
       case Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY:
@@ -417,14 +416,11 @@ void Visual::Base::SetProperties(const Property::Map& propertyMap)
             case Toolkit::Visual::Transform::Policy::ABSOLUTE:
             {
               mImpl->mCornerRadiusPolicy = policy;
-              if(DALI_UNLIKELY(mImpl->mRenderer && mImpl->mCornerRadiusIndex != Property::INVALID_INDEX))
+              if(DALI_UNLIKELY(mImpl->mRenderer))
               {
                 // Unusual case. SetProperty called after OnInitialize().
                 // Assume that DoAction call UPDATE_PROPERTY.
-                // We must update properies result into renderer
-                // Note : mImpl->mCornerRadiusIndex is not INVALID_INDEX.
-                // So CornerRadiusPolicy property is already registed.
-                mImpl->mRenderer.SetProperty(mImpl->mRenderer.GetPropertyIndex(CORNER_RADIUS_POLICY), mImpl->mCornerRadiusPolicy);
+                mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
               }
               break;
             }
@@ -572,21 +568,15 @@ void Visual::Base::CreatePropertyMap(Property::Map& map) const
     mImpl->mTransform.mOffset = mImpl->mRenderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_OFFSET);
     mImpl->mTransform.mSize   = mImpl->mRenderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_SIZE);
 
-    if(mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
-    {
-      mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<Vector4>(mImpl->mCornerRadiusIndex);
-    }
-    if(mImpl->mBorderlineWidthIndex != Property::INVALID_INDEX)
+    if(IsTypeAvailableForCornerRadius(mImpl->mType))
     {
-      mImpl->mBorderlineWidth = mImpl->mRenderer.GetProperty<float>(mImpl->mBorderlineWidthIndex);
+      mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
     }
-    if(mImpl->mBorderlineColorIndex != Property::INVALID_INDEX)
+    if(IsTypeAvailableForBorderline(mImpl->mType))
     {
-      mImpl->mBorderlineColor = mImpl->mRenderer.GetProperty<Vector4>(mImpl->mBorderlineColorIndex);
-    }
-    if(mImpl->mBorderlineOffsetIndex != Property::INVALID_INDEX)
-    {
-      mImpl->mBorderlineOffset = mImpl->mRenderer.GetProperty<float>(mImpl->mBorderlineOffsetIndex);
+      mImpl->mBorderlineWidth  = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
+      mImpl->mBorderlineColor  = mImpl->mRenderer.GetProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
+      mImpl->mBorderlineOffset = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
     }
   }
 
@@ -675,12 +665,13 @@ bool Visual::Base::IsRoundedCornerRequired() const
   // If VisualType doesn't support rounded corner, always return false.
   if(IsTypeAvailableForCornerRadius(mImpl->mType))
   {
-    if(mImpl->mRenderer && mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
+    if(mImpl->mRenderer)
     {
       // Update values from Renderer
-      mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<Vector4>(mImpl->mCornerRadiusIndex);
+      Property::Value value = mImpl->mRenderer.GetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS);
+      value.Get(mImpl->mCornerRadius);
     }
-    return !(mImpl->mCornerRadius == Vector4::ZERO) || mImpl->mAlwaysUsingCornerRadius;
+    return mImpl->mAlwaysUsingCornerRadius || !(mImpl->mCornerRadius == Vector4::ZERO);
   }
   return false;
 }
@@ -690,12 +681,13 @@ bool Visual::Base::IsBorderlineRequired() const
   // If VisualType doesn't support borderline, always return false.
   if(IsTypeAvailableForBorderline(mImpl->mType))
   {
-    if(mImpl->mRenderer && mImpl->mBorderlineWidthIndex != Property::INVALID_INDEX)
+    if(mImpl->mRenderer)
     {
       // Update values from Renderer
-      mImpl->mBorderlineWidth = mImpl->mRenderer.GetProperty<float>(mImpl->mBorderlineWidthIndex);
+      Property::Value value = mImpl->mRenderer.GetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
+      value.Get(mImpl->mBorderlineWidth);
     }
-    return !EqualsZero(mImpl->mBorderlineWidth) || mImpl->mAlwaysUsingBorderline;
+    return mImpl->mAlwaysUsingBorderline || !EqualsZero(mImpl->mBorderlineWidth);
   }
   return false;
 }
@@ -722,6 +714,32 @@ void Visual::Base::RegisterMixColor()
   }
 }
 
+void Visual::Base::RegisterDecoration()
+{
+  if(mImpl->mRenderer)
+  {
+    if(IsTypeAvailableForCornerRadius(mImpl->mType))
+    {
+      if(mImpl->mAlwaysUsingCornerRadius || !(mImpl->mCornerRadius == Vector4::ZERO))
+      {
+        DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterCornerRadiusUniform();
+        mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS, mImpl->mCornerRadius);
+        mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
+      }
+    }
+    if(IsTypeAvailableForBorderline(mImpl->mType))
+    {
+      if(mImpl->mAlwaysUsingBorderline || !EqualsZero(mImpl->mBorderlineWidth))
+      {
+        DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBorderlineUniform();
+        mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
+        mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
+        mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
+      }
+    }
+  }
+}
+
 void Visual::Base::SetMixColor(const Vector4& color)
 {
   mImpl->mMixColor = color;
@@ -920,6 +938,22 @@ Property::Index Visual::Base::GetPropertyIndex(Property::Key key)
     {
       return VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA;
     }
+    case Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS:
+    {
+      return DecoratedVisualRenderer::Property::CORNER_RADIUS;
+    }
+    case Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH:
+    {
+      return DecoratedVisualRenderer::Property::BORDERLINE_WIDTH;
+    }
+    case Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR:
+    {
+      return DecoratedVisualRenderer::Property::BORDERLINE_COLOR;
+    }
+    case Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET:
+    {
+      return DecoratedVisualRenderer::Property::BORDERLINE_OFFSET;
+    }
   }
 
   Property::Index index = mImpl->mRenderer.GetPropertyIndex(key);
@@ -996,6 +1030,7 @@ void Visual::Base::AnimateProperty(
   Internal::TransitionData::Animator& animator)
 {
 #if defined(DEBUG_ENABLED)
+  if(gVisualBaseLogFilter->IsEnabledFor(Debug::General))
   {
     std::ostringstream oss;
     oss << "Visual::Base::AnimateProperty(Visual:" << mImpl->mName << " Property:" << animator.propertyKey << " Target: " << animator.targetValue << std::endl;
@@ -1121,9 +1156,9 @@ Dali::Property Visual::Base::GetPropertyObject(Dali::Property::Key key)
     return Dali::Property(handle, Property::INVALID_INDEX);
   }
 
-  // Default animatable properties from VisualRenderer
   switch(GetIntKey(key))
   {
+    // Default animatable properties from VisualRenderer
     case Toolkit::Visual::Property::MIX_COLOR:
     {
       return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR);
@@ -1140,85 +1175,79 @@ Dali::Property Visual::Base::GetPropertyObject(Dali::Property::Key key)
     {
       return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::TRANSFORM_SIZE);
     }
-    default:
-    {
-      if(key.type == Property::Key::INDEX &&
-         ((mImpl->mType == Toolkit::Visual::COLOR && key.indexKey == ColorVisual::Property::MIX_COLOR) ||
-          (mImpl->mType == Toolkit::Visual::PRIMITIVE && key.indexKey == PrimitiveVisual::Property::MIX_COLOR)))
-      {
-        return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR);
-      }
-    }
-  }
 
-  // Other cases
-  Property::Index index = GetPropertyIndex(key);
-  if(index == Property::INVALID_INDEX)
-  {
-    if(IsTypeAvailableForBorderline(mImpl->mType) &&
-       ((key.type == Property::Key::INDEX && key.indexKey == DevelVisual::Property::BORDERLINE_WIDTH) || (key.type == Property::Key::STRING && key.stringKey == BORDERLINE_WIDTH) ||
-        (key.type == Property::Key::INDEX && key.indexKey == DevelVisual::Property::BORDERLINE_COLOR) || (key.type == Property::Key::STRING && key.stringKey == BORDERLINE_COLOR) ||
-        (key.type == Property::Key::INDEX && key.indexKey == DevelVisual::Property::BORDERLINE_OFFSET) || (key.type == Property::Key::STRING && key.stringKey == BORDERLINE_OFFSET)))
+    // Default animatable properties from DecoratedVisualRenderer
+    case Toolkit::DevelVisual::Property::CORNER_RADIUS:
     {
-      mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
-
-      // Register borderline properties
-      mImpl->mBorderlineWidthIndex  = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_WIDTH, BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
-      mImpl->mBorderlineColorIndex  = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_COLOR, BORDERLINE_COLOR, mImpl->mBorderlineColor);
-      mImpl->mBorderlineOffsetIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_OFFSET, BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
+      if(IsTypeAvailableForCornerRadius(mImpl->mType))
+      {
+        const bool updateShader = !mImpl->mCustomShader && !IsRoundedCornerRequired();
 
-      // Borderline is animated now. we always have to use borderline feature.
-      mImpl->mAlwaysUsingBorderline = true;
+        // CornerRadius is animated now. we always have to use corner radius feature.
+        mImpl->mAlwaysUsingCornerRadius = true;
 
-      index = mImpl->mRenderer.GetPropertyIndex(key);
+        if(updateShader)
+        {
+          // Update each values to renderer
+          DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterCornerRadiusUniform();
+          mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS, mImpl->mCornerRadius);
+          mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
 
-      // Change shader
-      UpdateShader();
+          // Change shader
+          UpdateShader();
+        }
+        if(!IsBorderlineRequired())
+        {
+          // If IsBorderlineRequired is true, BLEND_MODE is already BlendMode::ON_WITHOUT_CULL. So we don't overwrite it.
+          mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+        }
+        return Dali::Property(mImpl->mRenderer, DecoratedVisualRenderer::Property::CORNER_RADIUS);
+      }
+      break;
     }
-    else if(IsTypeAvailableForCornerRadius(mImpl->mType) && ((key.type == Property::Key::INDEX && key.indexKey == DevelVisual::Property::CORNER_RADIUS) || (key.type == Property::Key::STRING && key.stringKey == CORNER_RADIUS)))
+    case Toolkit::DevelVisual::Property::BORDERLINE_WIDTH:
+    case Toolkit::DevelVisual::Property::BORDERLINE_COLOR:
+    case Toolkit::DevelVisual::Property::BORDERLINE_OFFSET:
     {
-      // Register CORNER_RADIUS property
-      mImpl->mCornerRadiusIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS, mImpl->mCornerRadius);
-      mImpl->mRenderer.RegisterUniqueProperty(CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
+      if(IsTypeAvailableForBorderline(mImpl->mType))
+      {
+        const bool updateShader = !mImpl->mCustomShader && !IsBorderlineRequired();
 
-      // CornerRadius is animated now. we always have to use corner radius feature.
-      mImpl->mAlwaysUsingCornerRadius = true;
+        // Borderline is animated now. we always have to use borderline feature.
+        mImpl->mAlwaysUsingBorderline = true;
 
-      if(!IsBorderlineRequired())
-      {
-        // If IsBorderlineRequired is true, BLEND_MODE is already BlendMode::ON_WITHOUT_CULL. So we don't overwrite it.
-        mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
-      }
+        if(updateShader)
+        {
+          // Update each values to renderer
+          DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBorderlineUniform();
+          mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
+          mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
+          mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
 
-      index = mImpl->mCornerRadiusIndex;
+          // Change shader
+          UpdateShader();
+        }
+        mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
 
-      // Change shader
-      UpdateShader();
-    }
-    else
-    {
-      // We can't find the property in the base class.
-      // Request to child class
-      return OnGetPropertyObject(key);
-    }
-  }
-  else
-  {
-    if(index == mImpl->mBorderlineWidthIndex ||
-       index == mImpl->mBorderlineColorIndex ||
-       index == mImpl->mBorderlineOffsetIndex)
-    {
-      // Borderline is animated now. we always have to use borderline feature.
-      mImpl->mAlwaysUsingBorderline = true;
+        return Dali::Property(mImpl->mRenderer, GetPropertyIndex(key));
+      }
+      break;
     }
-    if(index == mImpl->mCornerRadiusIndex)
+    // Special case for MIX_COLOR
+    default:
     {
-      // CornerRadius is animated now. we always have to use corner radius feature.
-      mImpl->mAlwaysUsingCornerRadius = true;
+      if(key.type == Property::Key::INDEX &&
+         ((mImpl->mType == Toolkit::Visual::COLOR && key.indexKey == ColorVisual::Property::MIX_COLOR) ||
+          (mImpl->mType == Toolkit::Visual::PRIMITIVE && key.indexKey == PrimitiveVisual::Property::MIX_COLOR)))
+      {
+        return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR);
+      }
     }
   }
 
-  return Dali::Property(mImpl->mRenderer, index);
+  // We can't find the property in the base class.
+  // Request to child class
+  return OnGetPropertyObject(key);
 }
 
 } // namespace Internal
index 20b0bd9..bdcb193 100644 (file)
@@ -422,6 +422,11 @@ private:
   void RegisterMixColor();
 
   /**
+   * Register the uniform on the DecoratedVisualRenderer and store the property index if necessary.
+   */
+  void RegisterDecoration();
+
+  /**
    * Find the matching property on the renderer or shader. If it's a shader
    * property, register it on the renderer in order to animate it for this
    * visual independently.
index ce19a6b..a4b0a0a 100644 (file)
@@ -388,9 +388,13 @@ void VisualFactory::SetBrokenImageUrl(Toolkit::StyleManager& styleManager)
 
   if(styleManager)
   {
-    customBrokenImageUrlList = Toolkit::DevelStyleManager::GetBrokenImageUrlList(styleManager);
-    Property::Map config     = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
-    config["brokenImageUrl"].Get(brokenImageUrl);
+    customBrokenImageUrlList                 = Toolkit::DevelStyleManager::GetBrokenImageUrlList(styleManager);
+    const Property::Map& config              = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
+    const auto           brokenImageUrlValue = config.Find("brokenImageUrl", Property::Type::STRING);
+    if(brokenImageUrlValue)
+    {
+      brokenImageUrlValue->Get(brokenImageUrl);
+    }
   }
 
   // Add default image