Add flag to avoid re-request async render
authorBowon Ryu <bowon.ryu@samsung.com>
Thu, 11 Jul 2024 07:32:41 +0000 (16:32 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Thu, 11 Jul 2024 07:32:41 +0000 (16:32 +0900)
Prevent user-requested manual renders from being cancelled due to automatic async render requests.
This should be supplemented after testing more use cases.

Change-Id: Ie93ad33b1113555256ebb3dc7d0888fe71d65b89
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.h

index 9518d8f..c9b1a38 100644 (file)
@@ -1149,10 +1149,15 @@ void TextLabel::OnPropertySet(Property::Index index, const Property::Value& prop
   {
     case Dali::Actor::Property::SIZE:
     {
-      if(mController->GetRenderMode() != DevelTextLabel::Render::SYNC)
+      const Vector2& size = propertyValue.Get<Vector2>();
+      if(mSize != size)
       {
-        mTextUpdateNeeded = true;
-        mIsPropertyUpdated = true;
+        mSize = size;
+        if(mController->GetRenderMode() != DevelTextLabel::Render::SYNC)
+        {
+          mTextUpdateNeeded = true;
+          mIsPropertyUpdated = true;
+        }
       }
       break;
     }
@@ -1289,11 +1294,12 @@ void TextLabel::OnRelayout(const Vector2& size, RelayoutContainer& container)
       return;
     }
 
-    if(!mIsPropertyUpdated)
+    if(!mIsPropertyUpdated || mIsManualRendering)
     {
       return;
     }
 
+    DALI_LOG_RELEASE_INFO("Request size : %f, %f\n", contentSize.width, contentSize.height);
     AsyncTextParameters parameters = GetAsyncTextParameters(contentSize, padding, layoutDirection);
     TextVisual::UpdateAsyncRenderer(mVisual, parameters);
     mTextUpdateNeeded = false;
@@ -1588,6 +1594,11 @@ void TextLabel::AsyncLoadComplete(Text::AsyncTextRenderInfo renderInfo)
   Extents padding;
   padding = self.GetProperty<Extents>(Toolkit::Control::Property::PADDING);
 
+  if(mIsManualRendering)
+  {
+    mIsManualRendering = false;
+  }
+
   EmitAsyncTextRenderedSignal(renderInfo.renderedSize.width + (padding.start + padding.end), renderInfo.renderedSize.height + (padding.top + padding.bottom));
 }
 
@@ -1630,11 +1641,13 @@ void TextLabel::OnAccessibilityStatusChanged()
 TextLabel::TextLabel(ControlBehaviour additionalBehaviour)
 : Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT | additionalBehaviour)),
   mLocale(std::string()),
+  mSize(),
   mRenderingBackend(DEFAULT_RENDERING_BACKEND),
   mTextUpdateNeeded(false),
   mLastAutoScrollEnabled(false),
   mControlBackgroundEnabeld(true),
-  mIsPropertyUpdated(false)
+  mIsPropertyUpdated(false),
+  mIsManualRendering(false)
 {
 }
 
@@ -1738,6 +1751,8 @@ void TextLabel::RequestAsyncRenderWithFixedSize(float width, float height)
     return;
   }
 
+  mIsManualRendering = true;
+
   Actor self = Self();
 
   Extents padding;
@@ -1772,6 +1787,8 @@ void TextLabel::RequestAsyncRenderWithFixedWidth(float width, float heightConstr
     return;
   }
 
+  mIsManualRendering = true;
+
   Actor self = Self();
 
   Extents padding;
@@ -1798,7 +1815,7 @@ void TextLabel::RequestAsyncRenderWithFixedWidth(float width, float heightConstr
 
 void TextLabel::RequestAsyncRenderWithConstraint(float widthConstraint, float heightConstraint)
 {
-  DALI_LOG_RELEASE_INFO("Request width constraint : %f\n", widthConstraint);
+  DALI_LOG_RELEASE_INFO("Request constraint : %f, %f\n", widthConstraint, heightConstraint);
 
   if(mController->GetRenderMode() == DevelTextLabel::Render::SYNC)
   {
@@ -1806,6 +1823,8 @@ void TextLabel::RequestAsyncRenderWithConstraint(float widthConstraint, float he
     return;
   }
 
+  mIsManualRendering = true;
+
   Actor self = Self();
 
   Extents padding;
index 8911dfb..d488e65 100644 (file)
@@ -445,6 +445,7 @@ private: // Data
   Toolkit::DevelTextLabel::AsyncTextRenderedSignalType mAsyncTextRenderedSignal;
 
   std::string mLocale;
+  Vector2 mSize;
 
   int  mRenderingBackend;
   bool mTextUpdateNeeded : 1;
@@ -452,6 +453,7 @@ private: // Data
   bool mControlBackgroundEnabeld : 1;
 
   bool mIsPropertyUpdated : 1;
+  bool mIsManualRendering : 1;
 
 protected:
   /**