}
DALI_LOG_RELEASE_INFO("Request size : %f, %f\n", contentSize.width, contentSize.height);
- AsyncTextParameters parameters = GetAsyncTextParameters(contentSize, padding, layoutDirection);
+ AsyncTextParameters parameters = GetAsyncTextParameters(Async::RENDER_FIXED_SIZE, contentSize, padding, layoutDirection);
TextVisual::UpdateAsyncRenderer(mVisual, parameters);
mTextUpdateNeeded = false;
mIsPropertyUpdated = false;
// Signal that a Relayout may be needed
}
-AsyncTextParameters TextLabel::GetAsyncTextParameters(const Vector2& contentSize, const Extents& padding, const Dali::LayoutDirection::Type layoutDirection)
+AsyncTextParameters TextLabel::GetAsyncTextParameters(const Async::RequestType requestType, const Vector2& contentSize, const Extents& padding, const Dali::LayoutDirection::Type layoutDirection)
{
// Logically, all properties of the text label should be passed.
mController->GetRawText(text);
AsyncTextParameters parameters;
- parameters.maxTextureSize = Dali::GetMaxTextureSize();
- parameters.text = text;
- parameters.fontSize = mController->GetDefaultFontSize(Text::Controller::POINT_SIZE);
- parameters.textColor = mController->GetDefaultColor();
- parameters.fontFamily = mController->GetDefaultFontFamily();
- parameters.fontWeight = mController->GetDefaultFontWeight();
- parameters.fontWidth = mController->GetDefaultFontWidth();
- parameters.fontSlant = mController->GetDefaultFontSlant();
- parameters.isMultiLine = mController->IsMultiLineEnabled();
- parameters.ellipsis = mController->IsTextElideEnabled();
- parameters.enableMarkup = mController->IsMarkupProcessorEnabled();
- parameters.removeFrontInset = mController->IsRemoveFrontInset();
- parameters.removeBackInset = mController->IsRemoveBackInset();
- parameters.minLineSize = mController->GetDefaultLineSize();
- parameters.lineSpacing = mController->GetDefaultLineSpacing();
- parameters.relativeLineSize = mController->GetRelativeLineSize();
- parameters.characterSpacing = mController->GetCharacterSpacing();
- parameters.fontSizeScale = mController->IsFontSizeScaleEnabled() ? mController->GetFontSizeScale() : 1.f;
- parameters.textWidth = contentSize.width;
- parameters.textHeight = contentSize.height;
- parameters.padding = padding;
- parameters.horizontalAlignment = mController->GetHorizontalAlignment();
- parameters.verticalAlignment = mController->GetVerticalAlignment();
- parameters.verticalLineAlignment = mController->GetVerticalLineAlignment();
- parameters.lineWrapMode = mController->GetLineWrapMode();
- parameters.layoutDirection = layoutDirection;
- parameters.layoutDirectionPolicy = mController->GetMatchLayoutDirection();
- parameters.ellipsisPosition = mController->GetEllipsisPosition();
- parameters.isUnderlineEnabled = mController->IsUnderlineEnabled();
- parameters.underlineType = mController->GetUnderlineType();
- parameters.underlineColor = mController->GetUnderlineColor();
- parameters.underlineHeight = mController->GetUnderlineHeight();
- parameters.dashedUnderlineWidth = mController->GetDashedUnderlineWidth();
- parameters.dashedUnderlineGap = mController->GetDashedUnderlineGap();
+ parameters.requestType = requestType;
+ parameters.textWidth = contentSize.width;
+ parameters.textHeight = contentSize.height;
+ parameters.padding = padding;
+ parameters.layoutDirection = layoutDirection;
+ parameters.text = text;
+
+ parameters.maxTextureSize = Dali::GetMaxTextureSize();
+ parameters.fontSize = mController->GetDefaultFontSize(Text::Controller::POINT_SIZE);
+ parameters.textColor = mController->GetDefaultColor();
+ parameters.fontFamily = mController->GetDefaultFontFamily();
+ parameters.fontWeight = mController->GetDefaultFontWeight();
+ parameters.fontWidth = mController->GetDefaultFontWidth();
+ parameters.fontSlant = mController->GetDefaultFontSlant();
+ parameters.isMultiLine = mController->IsMultiLineEnabled();
+ parameters.ellipsis = mController->IsTextElideEnabled();
+ parameters.enableMarkup = mController->IsMarkupProcessorEnabled();
+ parameters.removeFrontInset = mController->IsRemoveFrontInset();
+ parameters.removeBackInset = mController->IsRemoveBackInset();
+ parameters.minLineSize = mController->GetDefaultLineSize();
+ parameters.lineSpacing = mController->GetDefaultLineSpacing();
+ parameters.relativeLineSize = mController->GetRelativeLineSize();
+ parameters.characterSpacing = mController->GetCharacterSpacing();
+ parameters.fontSizeScale = mController->IsFontSizeScaleEnabled() ? mController->GetFontSizeScale() : 1.f;
+ parameters.horizontalAlignment = mController->GetHorizontalAlignment();
+ parameters.verticalAlignment = mController->GetVerticalAlignment();
+ parameters.verticalLineAlignment = mController->GetVerticalLineAlignment();
+ parameters.lineWrapMode = mController->GetLineWrapMode();
+ parameters.layoutDirectionPolicy = mController->GetMatchLayoutDirection();
+ parameters.ellipsisPosition = mController->GetEllipsisPosition();
+ parameters.isUnderlineEnabled = mController->IsUnderlineEnabled();
+ parameters.underlineType = mController->GetUnderlineType();
+ parameters.underlineColor = mController->GetUnderlineColor();
+ parameters.underlineHeight = mController->GetUnderlineHeight();
+ parameters.dashedUnderlineWidth = mController->GetDashedUnderlineWidth();
+ parameters.dashedUnderlineGap = mController->GetDashedUnderlineGap();
parameters.isStrikethroughEnabled = mController->IsStrikethroughEnabled();
- parameters.strikethroughColor = mController->GetStrikethroughColor();
- parameters.strikethroughHeight = mController->GetStrikethroughHeight();
- parameters.shadowBlurRadius = mController->GetShadowBlurRadius();
- parameters.shadowColor = mController->GetShadowColor();
- parameters.shadowOffset = mController->GetShadowOffset();
- parameters.outlineWidth = mController->GetOutlineWidth();
- parameters.outlineColor = mController->GetOutlineColor();
- parameters.outlineBlurRadius = mController->GetOutlineBlurRadius();
- parameters.outlineOffset = mController->GetOutlineOffset();
- parameters.isTextFitEnabled = mController->IsTextFitEnabled();
- parameters.textFitMinSize = mController->GetTextFitMinSize();
- parameters.textFitMaxSize = mController->GetTextFitMaxSize();
- parameters.textFitStepSize = mController->GetTextFitStepSize();
- parameters.isTextFitArrayEnabled = mController->IsTextFitArrayEnabled();
- parameters.textFitArray = mController->GetTextFitArray();
- parameters.isAutoScrollEnabled = mController->IsAutoScrollEnabled();
+ parameters.strikethroughColor = mController->GetStrikethroughColor();
+ parameters.strikethroughHeight = mController->GetStrikethroughHeight();
+ parameters.shadowBlurRadius = mController->GetShadowBlurRadius();
+ parameters.shadowColor = mController->GetShadowColor();
+ parameters.shadowOffset = mController->GetShadowOffset();
+ parameters.outlineWidth = mController->GetOutlineWidth();
+ parameters.outlineColor = mController->GetOutlineColor();
+ parameters.outlineBlurRadius = mController->GetOutlineBlurRadius();
+ parameters.outlineOffset = mController->GetOutlineOffset();
+ parameters.isTextFitEnabled = mController->IsTextFitEnabled();
+ parameters.textFitMinSize = mController->GetTextFitMinSize();
+ parameters.textFitMaxSize = mController->GetTextFitMaxSize();
+ parameters.textFitStepSize = mController->GetTextFitStepSize();
+ parameters.isTextFitArrayEnabled = mController->IsTextFitArrayEnabled();
+ parameters.textFitArray = mController->GetTextFitArray();
+ parameters.isAutoScrollEnabled = mController->IsAutoScrollEnabled();
if(parameters.isAutoScrollEnabled)
{
if(!mTextScroller)
Vector2 contentSize(0.0f, 0.0f);
Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(self);
- AsyncTextParameters parameters = GetAsyncTextParameters(contentSize, padding, layoutDirection);
- parameters.requestType = Async::COMPUTE_NATURAL_SIZE;
-
+ AsyncTextParameters parameters = GetAsyncTextParameters(Async::COMPUTE_NATURAL_SIZE, contentSize, padding, layoutDirection);
TextVisual::RequestAsyncSizeComputation(mVisual, parameters);
}
Vector2 contentSize(width, 0.0f);
Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(self);
- AsyncTextParameters parameters = GetAsyncTextParameters(contentSize, padding, layoutDirection);
- parameters.requestType = Async::COMPUTE_HEIGHT_FOR_WIDTH;
-
+ AsyncTextParameters parameters = GetAsyncTextParameters(Async::COMPUTE_HEIGHT_FOR_WIDTH, contentSize, padding, layoutDirection);
TextVisual::RequestAsyncSizeComputation(mVisual, parameters);
}
std::swap(padding.start, padding.end);
}
- AsyncTextParameters parameters = GetAsyncTextParameters(contentSize, padding, layoutDirection);
- parameters.requestType = Async::RENDER_FIXED_SIZE;
+ AsyncTextParameters parameters = GetAsyncTextParameters(Async::RENDER_FIXED_SIZE, contentSize, padding, layoutDirection);
parameters.manualRender = true;
TextVisual::UpdateAsyncRenderer(mVisual, parameters);
std::swap(padding.start, padding.end);
}
- AsyncTextParameters parameters = GetAsyncTextParameters(contentSize, padding, layoutDirection);
- parameters.requestType = Async::RENDER_FIXED_WIDTH;
+ AsyncTextParameters parameters = GetAsyncTextParameters(Async::RENDER_FIXED_WIDTH, contentSize, padding, layoutDirection);
parameters.manualRender = true;
TextVisual::UpdateAsyncRenderer(mVisual, parameters);
std::swap(padding.start, padding.end);
}
- AsyncTextParameters parameters = GetAsyncTextParameters(contentSize, padding, layoutDirection);
- parameters.requestType = Async::RENDER_CONSTRAINT;
+ AsyncTextParameters parameters = GetAsyncTextParameters(Async::RENDER_CONSTRAINT, contentSize, padding, layoutDirection);
parameters.manualRender = true;
TextVisual::UpdateAsyncRenderer(mVisual, parameters);
* @brief Get the AsyncTextParameters
* All properties of the text label needed to render the text are stored and returned in the parameter.
*
+ * @param[in] requestType Type to request asynchronous computation.
* @param[in] contentSize The size of the text content requested by relayout excluding padding.
* @param[in] padding The size of the label's padding.
* @param[in] layoutDirection The layout direction.
* @return The parameters for async text render.
*/
- Text::AsyncTextParameters GetAsyncTextParameters(const Vector2& contentSize, const Extents& padding, const Dali::LayoutDirection::Type layoutDirection);
+ Text::AsyncTextParameters GetAsyncTextParameters(const Text::Async::RequestType requestType, const Vector2& contentSize, const Extents& padding, const Dali::LayoutDirection::Type layoutDirection);
/**
* @brief Set up Autoscrolling
mTextModel->mVisualModel->mBackgroundColorIndices.Clear();
}
-void PrintParameters(AsyncTextParameters& parameters)
-{
- DALI_LOG_RELEASE_INFO("-- AsyncTextParameters -- \n");
- DALI_LOG_RELEASE_INFO("--- text : %s\n", parameters.text.c_str());
- DALI_LOG_RELEASE_INFO("--- pointSize : %f\n", parameters.fontSize);
- DALI_LOG_RELEASE_INFO("--- textColor : %.2f, %.2f, %.2f, %.2f\n", parameters.textColor.r, parameters.textColor.g, parameters.textColor.b, parameters.textColor.a);
- DALI_LOG_RELEASE_INFO("--- fontFamily : %s\n", parameters.fontFamily.c_str());
- DALI_LOG_RELEASE_INFO("--- fontStyle : %d, fontWidth : %d, fontSlant : %d\n", parameters.fontWeight, parameters.fontWidth, parameters.fontSlant);
- DALI_LOG_RELEASE_INFO("--- isMultiLine : %d\n", parameters.isMultiLine);
- DALI_LOG_RELEASE_INFO("--- ellipsis : %d, ellipsisPosition : %d\n", parameters.ellipsis, parameters.ellipsisPosition);
- DALI_LOG_RELEASE_INFO("--- enableMarkup : %d\n", parameters.enableMarkup);
- DALI_LOG_RELEASE_INFO("--- minLineSize : %f, lineSpacing : %f, relativeLineSize : %f\n", parameters.minLineSize, parameters.lineSpacing, parameters.relativeLineSize);
- DALI_LOG_RELEASE_INFO("--- charSpacing : %f\n", parameters.characterSpacing);
- DALI_LOG_RELEASE_INFO("--- fontSizeScale : %f\n", parameters.fontSizeScale);
- DALI_LOG_RELEASE_INFO("--- size : %f, %f\n", parameters.textWidth, parameters.textHeight);
- DALI_LOG_RELEASE_INFO("--- padding : %.2f, %.2f, %.2f, %.2f\n", parameters.padding.start, parameters.padding.end, parameters.padding.top, parameters.padding.bottom);
- DALI_LOG_RELEASE_INFO("--- alignment : %d, %d, verticalLine : %d\n", parameters.horizontalAlignment, parameters.verticalAlignment, parameters.verticalLineAlignment);
- DALI_LOG_RELEASE_INFO("--- lineWrapMode : %d\n", parameters.lineWrapMode);
- DALI_LOG_RELEASE_INFO("--- layoutDirection : %s\n", parameters.layoutDirection == Dali::LayoutDirection::LEFT_TO_RIGHT ? "LTR" : "RTL");
- DALI_LOG_RELEASE_INFO("--- underline : %d, type : %d, color : %.2f, %.2f, %.2f, %.2f, height : %f, dash width : %f, gap : %f\n", parameters.isUnderlineEnabled, parameters.underlineType, parameters.underlineColor.r, parameters.underlineColor.g, parameters.underlineColor.b, parameters.underlineColor.a, parameters.underlineHeight, parameters.dashedUnderlineWidth, parameters.dashedUnderlineGap);
- DALI_LOG_RELEASE_INFO("--- strikethrough : %d, color : %.1f, %.2f, %.2f, %.2f, height : %f\n", parameters.isStrikethroughEnabled, parameters.strikethroughColor.r, parameters.strikethroughColor.g, parameters.strikethroughColor.b, parameters.strikethroughColor.a, parameters.strikethroughHeight);
- DALI_LOG_RELEASE_INFO("--- shadow : %f, color : %.2f, %.2f, %.2f, %.2f, offset : %f, %f\n", parameters.shadowBlurRadius, parameters.shadowColor.r, parameters.shadowColor.g, parameters.shadowColor.b, parameters.shadowColor.a, parameters.shadowOffset.x, parameters.shadowOffset.y);
- DALI_LOG_RELEASE_INFO("--- outline : %u, color : %.2f, %.2f, %.2f, %.2f\n", parameters.outlineWidth, parameters.outlineColor.r, parameters.outlineColor.g, parameters.outlineColor.b, parameters.outlineColor.a);
- DALI_LOG_RELEASE_INFO("--- textFit : %d, min : %f, max : %f, step : %f\n", parameters.isTextFitEnabled, parameters.minLineSize, parameters.textFitMaxSize, parameters.textFitStepSize);
- DALI_LOG_RELEASE_INFO("--- textFitArray : %d, array size : %lu\n", parameters.isTextFitArrayEnabled, parameters.textFitArray.size());
-}
-
-void PrintPixelData(PixelData& data)
-{
- printf("-- PrintPixelData --\n");
- printf("--- PixelData size : %u, %u, stride : %u\n", data.GetWidth(), data.GetHeight(), data.GetStride());
- Dali::Integration::PixelDataBuffer pixelData = Dali::Integration::GetPixelDataBuffer(data);
- printf("--- PixelData buffer size : %u, size : %u, %u \n", pixelData.bufferSize, pixelData.width, pixelData.height);
-
- for(uint32_t i = 0 ; i < pixelData.width + 2u; i ++)
- {
- printf("■");
- }
- printf("\n");
-
- for(uint32_t i = 0 ; i < pixelData.height ; i ++)
- {
- printf("■");
- for(uint32_t j = 0 ; j < pixelData.width ; j ++)
- {
- uint8_t pixelValue = *(reinterpret_cast<uint8_t*>(pixelData.buffer + j + (i * pixelData.width)));
- printf("%s", pixelValue > 0u ? "■" : " ");
- }
- printf("■");
- printf("\n");
- }
-
- for(uint32_t i = 0 ; i < pixelData.width + 2u; i ++)
- {
- printf("■");
- }
- printf("\n");
-}
-
-void PrintGlyphInfo(Text::ModelPtr& model, Length numberOfGlyphs)
-{
- printf("-- PrintGlyphInfo --\n");
-
- for (uint32_t i = 0; i < numberOfGlyphs; i++)
- {
- GlyphInfo glyph = model->mVisualModel->mGlyphs[i];
- printf("--- idx:%u, size:%.1f, %.1f, xBear:%.1f, adv:%.1f \n", glyph.index, glyph.width, glyph.height, glyph.xBearing, glyph.advance);
- }
-}
-
-void PrintTextInfo(Text::ModelPtr& model, uint32_t numberOfCharacters)
-{
- Vector<Character>& utf32Characters = model->mLogicalModel->mText; // Characters encoded in utf32.
- Vector<LineBreakInfo>& lineBreakInfo = model->mLogicalModel->mLineBreakInfo; // The line break info.
- Vector<ScriptRun>& scripts = model->mLogicalModel->mScriptRuns; // Charactes's script.
- Vector<FontDescriptionRun>& fontDescriptionRuns = model->mLogicalModel->mFontDescriptionRuns; // Desired font descriptions.
- Vector<FontRun>& validFonts = model->mLogicalModel->mFontRuns; // Validated fonts.
- Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = model->mLogicalModel->mBidirectionalParagraphInfo; // The bidirectional info per paragraph.
- Vector<ColorRun>& colorRuns = model->mLogicalModel->mColorRuns; // colors of the text.
-
- const Vector<GlyphIndex>& charactersToGlyph = model->mVisualModel->mCharactersToGlyph;
- const Vector<Length>& glyphsPerCharacter = model->mVisualModel->mGlyphsPerCharacter;
- const GlyphIndex* const charactersToGlyphBuffer = charactersToGlyph.Begin();
- const Length* const glyphsPerCharacterBuffer = glyphsPerCharacter.Begin();
-
- const CharacterIndex lastIndex = numberOfCharacters > 0u ? numberOfCharacters - 1u : 0u;
- const GlyphIndex startGlyphIndex = 0u;
-
- const Length numberOfGlyphs = (numberOfCharacters > 0u) ? *(charactersToGlyphBuffer + lastIndex) + *(glyphsPerCharacterBuffer + lastIndex) - startGlyphIndex : 0u;
- const Length totalNumberOfGlyphs = model->mVisualModel->mGlyphs.Count();
-
-
- printf("-- PrintTextInfo --\n");
- printf("--- utf32Characters : %lu \n", utf32Characters.Size());
- printf("--- lineBreakInfo : %lu \n", lineBreakInfo.Size());
- printf("--- scripts : %lu \n", scripts.Size());
- printf("--- validFonts : %lu \n", validFonts.Size());
- printf("--- bidirectionalInfo : %lu \n", bidirectionalInfo.Size());
- printf("\n");
-
- printf("--- fontDescriptionRuns : %lu \n", fontDescriptionRuns.Size());
- printf("--- colorRuns : %lu \n", colorRuns.Size());
- printf("--- embeddedItems : %lu \n", model->mLogicalModel->mEmbeddedItems.Size());
- printf("--- anchors : %lu \n", model->mLogicalModel->mAnchors.Size());
- printf("--- underlineRuns : %lu \n", model->mLogicalModel->mUnderlinedCharacterRuns.Size());
- printf("--- backgroundColorRuns : %lu \n", model->mLogicalModel->mBackgroundColorRuns.Size());
- printf("--- strikethroughRuns : %lu \n", model->mLogicalModel->mStrikethroughCharacterRuns.Size());
- printf("--- paragraphRuns : %lu \n", model->mLogicalModel->mBoundedParagraphRuns.Size());
- printf("--- charSpacingRuns : %lu \n", model->mLogicalModel->mCharacterSpacingCharacterRuns.Size());
- printf("\n");
-
- printf("--- numberOfCharacters : %u \n", numberOfCharacters);
- printf("--- numberOfGlyphs : %u, totalNumberOfGlyphs : %u \n", numberOfGlyphs, totalNumberOfGlyphs);
-
-}
-
void AsyncTextLoader::Update(AsyncTextParameters& parameters)
{
DALI_LOG_RELEASE_INFO("-->AsyncTextLoader::Update\n");
Text::Layout::Engine mLayoutEngine;
Text::TypesetterPtr mTypesetter;
- Length mNumberOfCharacters;
- bool mFitActualEllipsis : 1; // Used to store actual ellipses during TextFit calculations. Do not use it in other sections.
- bool mIsTextDirectionRTL : 1; // The direction of the first line after layout completion.
- bool mIsTextMirrored : 1;
- bool mModuleClearNeeded : 1;
+ Length mNumberOfCharacters;
+ bool mFitActualEllipsis : 1; // Used to store actual ellipses during TextFit calculations. Do not use it in other sections.
+ bool mIsTextDirectionRTL : 1; // The direction of the first line after layout completion.
+ bool mIsTextMirrored : 1;
+ bool mModuleClearNeeded : 1;
Mutex mMutex;
}; // class AsyncTextLoader
Async::RequestType requestType;
bool manualRender : 1;
- int maxTextureSize; ///< The maximum size of texture.
+ int maxTextureSize; ///< The maximum size of texture.
+ std::string text; ///< The text to be rendered encoded in utf8.
+ float fontSize; ///< The font's size (in points).
+ Vector4 textColor; ///< The default text's color. Default is white.
- std::string text; ///< The text to be rendered encoded in utf8.
-
- float fontSize; ///< The font's size (in points).
- Vector4 textColor; ///< The default text's color. Default is white.
-
- std::string fontFamily; ///< The font's family.
- FontWeight fontWeight; ///< The font's weight.
- FontWidth fontWidth; ///< The font's width.
- FontSlant fontSlant; ///< The font's slant.
+ std::string fontFamily; ///< The font's family.
+ FontWeight fontWeight; ///< The font's weight.
+ FontWidth fontWidth; ///< The font's width.
+ FontSlant fontSlant; ///< The font's slant.
bool isMultiLine : 1; ///< Whether the multi-line layout is enabled.
bool ellipsis : 1; ///< Whether the ellipsis layout option is enabled.
DevelText::MatchLayoutDirection layoutDirectionPolicy; ///< The policy used to set the text layout direction : one of {INHERIT, LOCALE, CONTENTS}.
DevelText::EllipsisPosition::Type ellipsisPosition; ///< The position of the ellipsis glyph: one of {END, START, MIDDLE}.
- bool isUnderlineEnabled : 1; ///< Underline properties
+ bool isUnderlineEnabled : 1; ///< Underline properties
Text::Underline::Type underlineType;
Vector4 underlineColor;
float underlineHeight;
float dashedUnderlineWidth;
float dashedUnderlineGap;
- bool isStrikethroughEnabled : 1; ///< Strikethrough properties
- Vector4 strikethroughColor;
- float strikethroughHeight;
+ bool isStrikethroughEnabled : 1; ///< Strikethrough properties
+ Vector4 strikethroughColor;
+ float strikethroughHeight;
- float shadowBlurRadius; ///< Shadow properties
- Vector4 shadowColor;
- Vector2 shadowOffset;
+ float shadowBlurRadius; ///< Shadow properties
+ Vector4 shadowColor;
+ Vector2 shadowOffset;
- uint16_t outlineWidth; ///< Outline properties
- Vector4 outlineColor;
- float outlineBlurRadius; ///< Shadow properties
- Vector2 outlineOffset;
+ uint16_t outlineWidth; ///< Outline properties
+ Vector4 outlineColor;
+ float outlineBlurRadius;
+ Vector2 outlineOffset;
- bool isTextFitEnabled : 1; ///< TextFit
- float textFitMinSize;
- float textFitMaxSize;
- float textFitStepSize;
+ bool isTextFitEnabled : 1; ///< TextFit
+ float textFitMinSize;
+ float textFitMaxSize;
+ float textFitStepSize;
bool isTextFitArrayEnabled : 1; ///< TextFitArray
std::vector<DevelTextLabel::FitOption> textFitArray;
- bool isAutoScrollEnabled : 1; ///< Auto scroll
- TextLabel::AutoScrollStopMode::Type autoScrollStopMode;
- int autoScrollSpeed;
- int autoScrollLoopCount;
- float autoScrollLoopDelay;
- int autoScrollGap;
- bool isAutoScrollMaxTextureExceeded : 1;
+ bool isAutoScrollEnabled : 1; ///< Auto scroll
+ TextLabel::AutoScrollStopMode::Type autoScrollStopMode;
+ int autoScrollSpeed;
+ int autoScrollLoopCount;
+ float autoScrollLoopDelay;
+ int autoScrollGap;
+ bool isAutoScrollMaxTextureExceeded : 1;
- bool cutout : 1; ///< Cutout enabled flag
+ bool cutout : 1; ///< Cutout enabled flag
bool backgroundWithCutoutEnabled : 1; ///< Background with cutout enabled flag.
Vector4 backgroundColorWithCutout; ///< Background color with cutout.
};
struct AsyncTextRenderInfo
{
AsyncTextRenderInfo()
- : textPixelData(),
+ : requestType(Async::RENDER_FIXED_SIZE),
+ textPixelData(),
stylePixelData(),
overlayStylePixelData(),
maskPixelData(),
height(0u),
controlSize(),
renderedSize(),
+ lineCount(0),
autoScrollWrapGap(0.f),
hasMultipleTextColors(false),
containsColorGlyph(false),
isOverlayStyle(false),
isTextDirectionRTL(false),
isCutout(false),
- manualRendered(false),
- lineCount(0),
- requestType(Async::RENDER_FIXED_SIZE)
+ manualRendered(false)
{
}
~AsyncTextRenderInfo()
{
}
-
- PixelData textPixelData;
- PixelData stylePixelData;
- PixelData overlayStylePixelData;
- PixelData maskPixelData;
- PixelData autoScrollPixelData;
- uint32_t width;
- uint32_t height;
- Size controlSize;
- Size renderedSize;
- float autoScrollWrapGap;
- bool hasMultipleTextColors;
- bool containsColorGlyph;
- bool styleEnabled;
- bool isOverlayStyle;
- bool isTextDirectionRTL;
- bool isCutout;
- bool manualRendered;
- int lineCount;
Async::RequestType requestType;
+ PixelData textPixelData;
+ PixelData stylePixelData;
+ PixelData overlayStylePixelData;
+ PixelData maskPixelData;
+ PixelData autoScrollPixelData;
+ uint32_t width;
+ uint32_t height;
+ Size controlSize;
+ Size renderedSize;
+ int lineCount;
+ float autoScrollWrapGap;
+ bool hasMultipleTextColors : 1;
+ bool containsColorGlyph : 1;
+ bool styleEnabled : 1;
+ bool isOverlayStyle : 1;
+ bool isTextDirectionRTL : 1;
+ bool isCutout : 1;
+ bool manualRendered : 1;
};
/**
mTextRequireRenderPropertyIndex(Property::INVALID_INDEX),
mRendererUpdateNeeded(false),
mTextRequireRender(false),
- mTaskId(0u),
- mSizeTaskId(0u),
- mIsTaskRunning(false),
- mIsSizeTaskRunning(false)
+ mRenderTaskId(0u),
+ mNaturalSizeTaskId(0u),
+ mHeightForWidthTaskId(0u),
+ mIsRenderTaskRunning(false),
+ mIsNaturalSizeTaskRunning(false),
+ mIsHeightForWidthTaskRunning(false)
{
// Enable the pre-multiplied alpha to improve the text quality
mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
Text::AsyncTextParameters parameters = textInformation.parameters;
- if(parameters.requestType == Text::Async::COMPUTE_NATURAL_SIZE || parameters.requestType == Text::Async::COMPUTE_HEIGHT_FOR_WIDTH)
+ switch (parameters.requestType)
{
- mIsSizeTaskRunning = false;
- }
- else
- {
- mIsTaskRunning = false;
+ case Text::Async::RENDER_FIXED_SIZE:
+ case Text::Async::RENDER_FIXED_WIDTH:
+ case Text::Async::RENDER_CONSTRAINT:
+ {
+ mIsRenderTaskRunning = false;
+ }
+ break;
+
+ case Text::Async::COMPUTE_NATURAL_SIZE:
+ {
+ mIsNaturalSizeTaskRunning = false;
+ }
+ break;
+
+ case Text::Async::COMPUTE_HEIGHT_FOR_WIDTH:
+ {
+ mIsHeightForWidthTaskRunning = false;
+ }
+ break;
+
+ default:
+ {
+ DALI_LOG_ERROR("Unexpected request type : %d\n", parameters.requestType);
+ }
+ break;
}
Toolkit::Visual::ResourceStatus resourceStatus;
}
// Ignore current result when user re-request async load during load complete callback.
- if(mIsTaskRunning)
+ if(mIsRenderTaskRunning)
{
// Remove the texture set and any renderer previously set.
RemoveRenderer(control, true);
{
DALI_LOG_RELEASE_INFO("-->TextVisual::RequestAsyncSizeComputation RequestLoad\n");
- // This does not mean whether task is actually running or waiting.
- // It is whether text visual received a completion callback after requesting a task.
- if(mIsSizeTaskRunning)
+ switch (parameters.requestType)
{
- Text::AsyncTextManager::Get().RequestCancel(mSizeTaskId);
- }
+ case Text::Async::COMPUTE_NATURAL_SIZE:
+ {
+ if(mIsNaturalSizeTaskRunning)
+ {
+ Text::AsyncTextManager::Get().RequestCancel(mNaturalSizeTaskId);
+ }
+ mIsNaturalSizeTaskRunning = true;
- DALI_LOG_RELEASE_INFO("-->TextVisual::UpdateAsyncRenderer RequestLoad\n");
+ TextLoadObserver* textLoadObserver = this;
+ mNaturalSizeTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
+ }
+ break;
+
+ case Text::Async::COMPUTE_HEIGHT_FOR_WIDTH:
+ {
+ if(mIsHeightForWidthTaskRunning)
+ {
+ Text::AsyncTextManager::Get().RequestCancel(mHeightForWidthTaskId);
+ }
+ mIsHeightForWidthTaskRunning = true;
- mIsSizeTaskRunning = true;
- TextLoadObserver* textLoadObserver = this;
- mSizeTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
+ TextLoadObserver* textLoadObserver = this;
+ mHeightForWidthTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
+ }
+ break;
+
+ default:
+ {
+ DALI_LOG_ERROR("Unexpected request type : %d\n", parameters.requestType);
+ }
+ break;
+ }
}
void TextVisual::UpdateAsyncRenderer(Text::AsyncTextParameters& parameters)
// This does not mean whether task is actually running or waiting.
// It is whether text visual received a completion callback after requesting a task.
- if(mIsTaskRunning)
+ if(mIsRenderTaskRunning)
{
- Text::AsyncTextManager::Get().RequestCancel(mTaskId);
+ Text::AsyncTextManager::Get().RequestCancel(mRenderTaskId);
}
DALI_LOG_RELEASE_INFO("-->TextVisual::UpdateAsyncRenderer RequestLoad\n");
- mIsTaskRunning = true;
+ mIsRenderTaskRunning = true;
TextLoadObserver* textLoadObserver = this;
- mTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
+ mRenderTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
}
void TextVisual::AddRenderer(Actor& actor, const Vector2& size, bool hasMultipleTextColors, bool containsColorGlyph, bool styleEnabled, bool isOverlayStyle)
bool mTextRequireRender : 1; ///< The flag to indicate whether the text needs to be rendered.
RendererContainer mRendererList;
- uint32_t mTaskId; ///< The currently requested task Id.
- uint32_t mSizeTaskId; ///< The currently requested size task Id.
- bool mIsTaskRunning : 1; ///< Whether the requested task is running or not.
- bool mIsSizeTaskRunning :1; ///< Whether the requested size task is running or not.
+ uint32_t mRenderTaskId; ///< The currently requested render task Id.
+ uint32_t mNaturalSizeTaskId; ///< The currently requested natural size task Id.
+ uint32_t mHeightForWidthTaskId; ///< The currently requested height for width task Id.
+ bool mIsRenderTaskRunning : 1; ///< Whether the requested render task is running or not.
+ bool mIsNaturalSizeTaskRunning : 1; ///< Whether the requested natural size task is running or not.
+ bool mIsHeightForWidthTaskRunning : 1; ///< Whether the requested height for width task is running or not.
};
} // namespace Internal