[Tizen] Reduce GetCurrentSize call time 37/285737/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 19 Dec 2022 06:59:13 +0000 (15:59 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Mon, 19 Dec 2022 06:59:13 +0000 (15:59 +0900)
Change-Id: I1a22b4d86ad97856a14aa367f1b3d4b62b7e31bf
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/event/actors/actor-sizer.cpp

index 4d8e6d2..0c06f60 100644 (file)
@@ -117,14 +117,27 @@ void ActorSizer::SetSizeInternal(const Vector3& size)
   // dont allow recursive loop
   DALI_ASSERT_ALWAYS(!mInsideOnSizeSet && "Cannot call SetSize from OnSizeSet");
   // check that we have a node AND the new size width, height or depth is at least a little bit different from the old one
-  Vector3 currentSize = mOwner.GetCurrentSize();
+  bool changeTargetSize = false;
 
   if((fabsf(mTargetSize.width - size.width) > Math::MACHINE_EPSILON_1) ||
      (fabsf(mTargetSize.height - size.height) > Math::MACHINE_EPSILON_1) ||
-     (fabsf(mTargetSize.depth - size.depth) > Math::MACHINE_EPSILON_1) ||
-     (fabsf(mTargetSize.width - currentSize.width) > Math::MACHINE_EPSILON_1) ||
-     (fabsf(mTargetSize.height - currentSize.height) > Math::MACHINE_EPSILON_1) ||
-     (fabsf(mTargetSize.depth - currentSize.depth) > Math::MACHINE_EPSILON_1))
+     (fabsf(mTargetSize.depth - size.depth) > Math::MACHINE_EPSILON_1))
+  {
+    changeTargetSize = true;
+  }
+  else
+  {
+    // Check if currentSize it difference with target size.
+    Vector3 currentSize = mOwner.GetCurrentSize();
+    if((fabsf(mTargetSize.width - currentSize.width) > Math::MACHINE_EPSILON_1) ||
+       (fabsf(mTargetSize.height - currentSize.height) > Math::MACHINE_EPSILON_1) ||
+       (fabsf(mTargetSize.depth - currentSize.depth) > Math::MACHINE_EPSILON_1))
+    {
+      changeTargetSize = true;
+    }
+  }
+
+  if(changeTargetSize)
   {
     mTargetSize = size;