}
case Toolkit::Control::Property::BACKGROUND:
{
- const Vector4 backgroundColor = propertyValue.Get<Vector4>();
-
if(mController->IsTextCutout())
{
- DevelControl::EnableVisual(*this, Toolkit::Control::Property::BACKGROUND, false);
- mController->SetBackgroundWithCutoutEnabled(true);
+ const Vector4 backgroundColor = propertyValue.Get<Vector4>();
mController->SetBackgroundColorWithCutout(backgroundColor);
- }
+ mController->SetBackgroundWithCutoutEnabled(true);
+ if(!mController->IsAsyncTextLoadEnabled())
+ {
+ EnableControlBackground(false);
+ }
+ }
break;
}
case Toolkit::DevelTextLabel::Property::CUTOUT:
{
const bool cutoutEnabled = propertyValue.Get<bool>();
-
+ mController->SetBackgroundWithCutoutEnabled(cutoutEnabled);
if(cutoutEnabled)
{
- Vector4 backgroundColor = Vector4::ZERO;
-
const Property::Map backgroundMap = Self().GetProperty(Toolkit::Control::Property::BACKGROUND).Get<Property::Map>();
Property::Value* backgroundValue = backgroundMap.Find(ColorVisual::Property::MIX_COLOR);
if(backgroundValue)
{
+ Vector4 backgroundColor = Vector4::ZERO;
backgroundColor = backgroundValue->Get<Vector4>();
+ mController->SetBackgroundColorWithCutout(backgroundColor);
}
-
- DevelControl::EnableVisual(*this, Toolkit::Control::Property::BACKGROUND, false);
- mController->SetBackgroundWithCutoutEnabled(true);
- mController->SetBackgroundColorWithCutout(backgroundColor);
}
- else
+ if(!mController->IsAsyncTextLoadEnabled())
{
- DevelControl::EnableVisual(*this, Toolkit::Control::Property::BACKGROUND, true);
-
- Property::Map backgroundMapSet;
- mController->SetBackgroundWithCutoutEnabled(false);
+ EnableControlBackground(!cutoutEnabled);
+ TextVisual::SetRequireRender(mVisual, cutoutEnabled);
}
-
- TextVisual::SetRequireRender(mVisual, cutoutEnabled);
break;
}
default:
}
}
+void TextLabel::AsyncLoadComplete()
+{
+ // Pure Virtual from AsyncTextInterface
+ DALI_LOG_INFO(gLogFilter, Debug::General, "TextLabel::AsyncLoadComplete\n");
+
+ // To avoid flickering issues, enable/disable the background visual when async load is completed.
+ EnableControlBackground(!mController->IsTextCutout());
+}
+
void TextLabel::OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
{
mController->ChangedLayoutDirection();
mLocale(std::string()),
mRenderingBackend(DEFAULT_RENDERING_BACKEND),
mTextUpdateNeeded(false),
- mLastAutoScrollEnabled(false)
+ mLastAutoScrollEnabled(false),
+ mControlBackgroundEnabeld(true)
{
}
return mController->IsRemoveBackInset();
}
+void TextLabel::EnableControlBackground(const bool enable)
+{
+ // Avoid function calls if there is no change.
+ if(mControlBackgroundEnabeld != enable)
+ {
+ mControlBackgroundEnabeld = enable;
+ DevelControl::EnableVisual(*this, Toolkit::Control::Property::BACKGROUND, enable);
+ }
+}
+
std::string TextLabel::TextLabelAccessible::GetNameRaw() const
{
return GetWholeText();
*/
bool IsRemoveBackInset() const;
+ /**
+ * @brief Enable control's background
+ *
+ * @param[in] enable Whether to enable the background of control.
+ */
+ void EnableControlBackground(const bool enable);
+
private: // From Control
/**
* @copydoc Control::OnInitialize()
*/
void AsyncTextFitChanged(float pointSize) override;
+ /**
+ * @copydoc Text::AsyncTextInterface::AsyncLoadComplete()
+ */
+ void AsyncLoadComplete();
+
private: // Implementation
/**
* Construct a new TextLabel.
int mRenderingBackend;
bool mTextUpdateNeeded : 1;
bool mLastAutoScrollEnabled : 1;
+ bool mControlBackgroundEnabeld : 1;
protected:
/**
visualTransformOffset.y = roundf(parameters.padding.top + alignmentOffset.y);
}
+ SetRequireRender(renderInfo.isCutout);
+
// Transform offset is used for subpixel data upload in text tiling.
// We should set the transform before creating a tiling texture.
Property::Map visualTransform;
// VisualRenderer::Property::OPACITY uses same animatable property internally.
Constraint opacityConstraint = Constraint::New<float>(renderer, Dali::DevelRenderer::Property::OPACITY, OpacityConstraint);
opacityConstraint.AddSource(Source(control, mAnimatableTextColorPropertyIndex));
+ opacityConstraint.AddSource(Source(mImpl->mRenderer, mTextRequireRenderPropertyIndex));
opacityConstraint.Apply();
}
}
{
mAsyncTextInterface->AsyncTextFitChanged(parameters.fontSize);
}
+
+ if(mAsyncTextInterface)
+ {
+ mAsyncTextInterface->AsyncLoadComplete();
+ }
}
else
{
void TextVisual::SetRequireRender(bool requireRender)
{
- mTextRequireRender = requireRender;
- if(mImpl->mRenderer)
+ // Avoid function calls if there is no change.
+ if(mTextRequireRender != requireRender)
{
- mImpl->mRenderer.SetProperty(mTextRequireRenderPropertyIndex, mTextRequireRender);
+ mTextRequireRender = requireRender;
+ if(mImpl->mRenderer)
+ {
+ mImpl->mRenderer.SetProperty(mTextRequireRenderPropertyIndex, mTextRequireRender);
+ }
}
}