Fix async size computation issue
authorBowon Ryu <bowon.ryu@samsung.com>
Tue, 16 Jul 2024 00:46:17 +0000 (09:46 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Tue, 16 Jul 2024 00:46:17 +0000 (09:46 +0900)
Size computation should work regardless of whether there's a renderer present or not.

Change-Id: I9859eec8648f2413b0fe952922b74d5321c4ad6c
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
dali-toolkit/internal/visuals/text/text-visual.cpp

index 82b3c6737b68dd2d48c1141123c419db42a70a67..b8670aa3314f38015cda5f7304e4b1bd911c636f 100644 (file)
@@ -714,14 +714,6 @@ void TextVisual::LoadComplete(bool loadingSuccess, TextInformation textInformati
 
   Toolkit::Visual::ResourceStatus resourceStatus;
 
-  Actor control = mControl.GetHandle();
-  if(!control)
-  {
-    // Nothing to do.
-    ResourceReady(Toolkit::Visual::ResourceStatus::READY);
-    return;
-  }
-
   if(loadingSuccess)
   {
     resourceStatus = Toolkit::Visual::ResourceStatus::READY;
@@ -738,6 +730,14 @@ void TextVisual::LoadComplete(bool loadingSuccess, TextInformation textInformati
       }
     }
 
+    Actor control = mControl.GetHandle();
+    if(!control)
+    {
+      // Nothing to do.
+      ResourceReady(Toolkit::Visual::ResourceStatus::READY);
+      return;
+    }
+
     // Calculate the size of the visual that can fit the text.
     // The size of the text after it has been laid-out, size of pixel data buffer.
     Size layoutSize(static_cast<float>(renderInfo.width), static_cast<float>(renderInfo.height));
@@ -979,16 +979,10 @@ void TextVisual::SetAsyncTextInterface(Text::AsyncTextInterface* asyncTextInterf
 
 void TextVisual::RequestAsyncSizeComputation(Text::AsyncTextParameters& parameters)
 {
-  Actor control = mControl.GetHandle();
-  if(!control)
-  {
-    // Nothing to do.
-    return;
-  }
+  DALI_LOG_RELEASE_INFO("-->TextVisual::RequestAsyncSizeComputation RequestLoad\n");
 
   TextLoadObserver* textLoadObserver = this;
   Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
-  DALI_LOG_RELEASE_INFO("-->TextVisual::RequestAsyncSizeComputation RequestLoad\n");
 }
 
 void TextVisual::UpdateAsyncRenderer(Text::AsyncTextParameters& parameters)
@@ -1028,10 +1022,11 @@ void TextVisual::UpdateAsyncRenderer(Text::AsyncTextParameters& parameters)
     Text::AsyncTextManager::Get().RequestCancel(mTaskId);
   }
 
+  DALI_LOG_RELEASE_INFO("-->TextVisual::UpdateAsyncRenderer RequestLoad\n");
+
   mIsTaskRunning = true;
   TextLoadObserver* textLoadObserver = this;
   mTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
-  DALI_LOG_RELEASE_INFO("-->TextVisual::UpdateAsyncRenderer RequestLoad\n");
 }
 
 void TextVisual::AddRenderer(Actor& actor, const Vector2& size, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled, bool isOverlayStyle)