Merge branch 'devel/master' into devel/async_text
authorBowon Ryu <bowon.ryu@samsung.com>
Thu, 25 Jul 2024 03:36:47 +0000 (12:36 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Thu, 25 Jul 2024 03:36:47 +0000 (12:36 +0900)
Change-Id: Ief46a8e7a0db5ec95c1ead6190d2ed369d95e173

1  2 
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp

@@@ -1348,49 -1203,10 +1348,51 @@@ void TextLabel::OnRelayout(const Vector
    Extents padding;
    padding = self.GetProperty<Extents>(Toolkit::Control::Property::PADDING);
  
-   Vector2 contentSize(size.x - (padding.start + padding.end), size.y - (padding.top + padding.bottom));
+   float width  = std::max(size.x - (padding.start + padding.end), 0.0f);
+   float height = std::max(size.y - (padding.top + padding.bottom), 0.0f);
+   Vector2 contentSize(width, height);
  
 +  // Support Right-To-Left
 +  Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(self);
 +
 +  // Support Right-To-Left of padding
 +  if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection)
 +  {
 +    std::swap(padding.start, padding.end);
 +  }
 +
 +  if(mController->GetRenderMode() == DevelTextLabel::Render::ASYNC_AUTO ||
 +     mController->GetRenderMode() == DevelTextLabel::Render::ASYNC_MANUAL)
 +  {
 +    if(mController->GetRenderMode() == DevelTextLabel::Render::ASYNC_AUTO && mTextScroller && mTextScroller->IsScrolling() && !(mTextUpdateNeeded || sizeChanged))
 +    {
 +      // When auto scroll is playing, a text load request is made only if a text update is absolutely necessary.
 +      return;
 +    }
 +
 +    if(mIsManualRender || !(sizeChanged || mIsAsyncRenderNeeded))
 +    {
 +      // Do not request async render if the manual render is still ongoing or if there are no size or property updates.
 +      return;
 +    }
 +
 +    if(manualRendered && sizeChanged && !mIsAsyncRenderNeeded)
 +    {
 +      // Do not request async render if only the size has changed when manual render is completed.
 +      // Users may attempt to change the size inside the completed callback post manual render.
 +      // In case of ASYNC_AUTO, this could potentially trigger relayout and engender further computation.
 +      // This is needed to avoid recomputations, but it may have some limitations.
 +      return;
 +    }
 +
 +    DALI_LOG_RELEASE_INFO("Request size : %f, %f\n", contentSize.width, contentSize.height);
 +    AsyncTextParameters parameters = GetAsyncTextParameters(Async::RENDER_FIXED_SIZE, contentSize, padding, layoutDirection);
 +    TextVisual::UpdateAsyncRenderer(mVisual, parameters);
 +    mTextUpdateNeeded = false;
 +    mIsAsyncRenderNeeded = false;
 +    return;
 +  }
 +
    if(mController->IsTextFitArrayEnabled())
    {
      mController->FitArrayPointSizeforLayout(contentSize);