(BenchmarkColor) Add borderline + shadow + innser shadow options to test performance... 07/323007/6
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 21 Apr 2025 11:15:02 +0000 (20:15 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Mon, 28 Apr 2025 08:34:16 +0000 (17:34 +0900)
Add option B : BorderlineWidth, D : shadow  and I : Inner Shadow to check borderline + innser shadow cases overhead

Change-Id: Id995de62a8bca832620c14d54e0fb2bd30312399
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
examples/benchmark-color/README.md
examples/benchmark-color/benchmark-color.cpp

index c46115b6c2a784a9f464f632efcf5c204f035719..ad50b4bddc30c2ffcd3c9efef00207da4a8b42e1 100644 (file)
@@ -20,12 +20,15 @@ We can add multiple optons.
 
 `C` : Use `DevelControl::Property::CORNER_RADIUS`
 `S` : Use `DevelControl::Property::CORNER_SQUARENESS`
+`B` : Use `DevelControl::Property::BORDERLINE_WIDTH`
+`H` : Use `DevelControl::Property::SHADOW`
+`I` : Use `DevelControl::Property::INNER_SHADOW`
 `O` : Use `DevelControl::Property::OFFSCREEN_RENDERING`
 
 ```shell
 $ ./benchmark-color.example -pC /// Rounded Corner
 $ ./benchmark-color.example -pCS /// Squircle Corner
-$ ./benchmark-color.example -r20 -c20 -pOC /// R = 20, C = 20 with OffscreenRendering::REFRESH_ALWAYS and Rounded Corner
+$ ./benchmark-color.example -r20 -c20 -pOCB /// R = 20, C = 20 with OffscreenRendering::REFRESH_ALWAYS and Rounded Border
 ```
 
 
index 6b37bf8d987608b77a498a3d0a944108620a1d7f..20de353d1a44e2a33bc2031f2d89ab8604f34e9a 100644 (file)
@@ -22,6 +22,8 @@
 #include <dali/devel-api/common/stage.h>
 
 #include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/devel-api/visuals/color-visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -41,8 +43,12 @@ enum ControlPropertyUsesFlag
 
   CORNER_RADIUS     = 1 << 0,
   CORNER_SQUARENESS = 1 << 1,
+  BORDERLINE_WIDTH  = 1 << 2,
 
-  OFFSCREEN_RENDERING = 1 << 2,
+  SHADOW       = 1 << 3,
+  INNER_SHADOW = 1 << 4,
+
+  OFFSCREEN_RENDERING = 1 << 5,
 };
 
 int gControlPropertyUses = ControlPropertyUsesFlag::NONE;
@@ -53,10 +59,15 @@ int gControlPropertyUses = ControlPropertyUsesFlag::NONE;
 // -c NumberOfColumns (Modifies the number of columns per page)
 // -d RunningDurationMilliSeconds (Modifies the duration of the test in milliseconds. 0 means infinite)
 //
-// -p Add options for control properties. C : Corner Radius, S : Corner Squareness, O : OffscreenRendering with refresh always.
+// -p Add options for control properties.
+//  * C : Corner Radius,
+//  * S : Corner Squareness,
+//  * B : Borderline,
+//  * I : Inner Shadow,
+//  * O : OffscreenRendering with refresh always.
 //
 // For example:
-// $ ./benchmark-color.example -r200 -c800 -d60000 -pCSO
+// $ ./benchmark-color.example -r200 -c800 -d60000 -pCSBI
 
 //
 class BenchmarkColor : public ConnectionTracker
@@ -115,6 +126,43 @@ public:
         {
           control.SetProperty(DevelControl::Property::CORNER_SQUARENESS, Vector4(0.6f, 0.6f, 0.6f, 0.6f));
         }
+        if(gControlPropertyUses & ControlPropertyUsesFlag::BORDERLINE_WIDTH)
+        {
+          control.SetProperty(DevelControl::Property::BORDERLINE_WIDTH, std::min(mSize.x, mSize.y) * 0.1f);
+          control.SetProperty(DevelControl::Property::BORDERLINE_COLOR, Vector4(Random::Range(0.0f, 1.0f), Random::Range(0.0f, 1.0f), Random::Range(0.0f, 1.0f), 1.0f));
+          control.SetProperty(DevelControl::Property::BORDERLINE_OFFSET, -1.0f);
+        }
+        if(gControlPropertyUses & ControlPropertyUsesFlag::SHADOW)
+        {
+          Property::Map map{
+            {Visual::Property::TYPE, Visual::COLOR},
+            {Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f)},
+            {DevelColorVisual::Property::BLUR_RADIUS, std::min(mSize.x, mSize.y) * 0.15f},
+            {DevelColorVisual::Property::CUTOUT_POLICY, DevelColorVisual::CutoutPolicy::CUTOUT_VIEW_WITH_CORNER_RADIUS},
+            {Visual::Property::TRANSFORM,
+             Property::Map{
+               {Visual::Transform::Property::OFFSET, Vector2(0.0f, 0.05f)},
+             }},
+          };
+          control.SetProperty(DevelControl::Property::SHADOW, map);
+        }
+        if(gControlPropertyUses & ControlPropertyUsesFlag::INNER_SHADOW)
+        {
+          Property::Map map{
+            {Visual::Property::TYPE, Visual::COLOR},
+            {Visual::Property::MIX_COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.0f)},
+            {DevelVisual::Property::BORDERLINE_WIDTH, std::min(mSize.x, mSize.y) * 0.3f},
+            {DevelVisual::Property::BORDERLINE_COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f)},
+            {DevelVisual::Property::BORDERLINE_OFFSET, 1.0f},
+            {DevelColorVisual::Property::BLUR_RADIUS, std::min(mSize.x, mSize.y) * 0.05f},
+            {DevelColorVisual::Property::CUTOUT_POLICY, DevelColorVisual::CutoutPolicy::CUTOUT_OUTSIDE_WITH_CORNER_RADIUS},
+            {Visual::Property::TRANSFORM,
+             Property::Map{
+               {Visual::Transform::Property::OFFSET, Vector2(0.15f, 0.10f)},
+             }},
+          };
+          control.SetProperty(DevelControl::Property::INNER_SHADOW, map);
+        }
         if(gControlPropertyUses & ControlPropertyUsesFlag::OFFSCREEN_RENDERING)
         {
           control.SetProperty(DevelControl::Property::OFFSCREEN_RENDERING, DevelControl::OffScreenRenderingType::REFRESH_ALWAYS);
@@ -211,6 +259,18 @@ int DALI_EXPORT_API main(int argc, char** argv)
         {
           gControlPropertyUses |= ControlPropertyUsesFlag::CORNER_SQUARENESS;
         }
+        if(c == 'B' || c == 'b')
+        {
+          gControlPropertyUses |= ControlPropertyUsesFlag::BORDERLINE_WIDTH;
+        }
+        if(c == 'H' || c == 'h')
+        {
+          gControlPropertyUses |= ControlPropertyUsesFlag::SHADOW;
+        }
+        if(c == 'I' || c == 'i')
+        {
+          gControlPropertyUses |= ControlPropertyUsesFlag::INNER_SHADOW;
+        }
         if(c == 'O' || c == 'o')
         {
           gControlPropertyUses |= ControlPropertyUsesFlag::OFFSCREEN_RENDERING;