From ae03c96098be613b5915bb030804adf7f0a8334e Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Tue, 16 Jul 2024 09:46:17 +0900 Subject: [PATCH] Fix async size computation issue Size computation should work regardless of whether there's a renderer present or not. Change-Id: I9859eec8648f2413b0fe952922b74d5321c4ad6c Signed-off-by: Bowon Ryu --- dali-toolkit/internal/visuals/text/text-visual.cpp | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index 82b3c67..b8670aa 100644 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -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(renderInfo.width), static_cast(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) -- 2.7.4