X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fcontroller%2Ftext-controller-impl-model-updater.cpp;h=9225771f416e80fb857d292e441549b30efafeb9;hb=68b2b66aec90018a2cb6aaff5c4e4de7f1f70c69;hp=ff4697b7f2e72183b47e7dc44a713e4d6b451372;hpb=f5c4eea32ac6eff21edbc662f5e879c9614da165;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/controller/text-controller-impl-model-updater.cpp b/dali-toolkit/internal/text/controller/text-controller-impl-model-updater.cpp index ff4697b..9225771 100644 --- a/dali-toolkit/internal/text/controller/text-controller-impl-model-updater.cpp +++ b/dali-toolkit/internal/text/controller/text-controller-impl-model-updater.cpp @@ -20,6 +20,8 @@ // EXTERNAL INCLUDES #include +#include +#include // INTERNAL INCLUDES #include @@ -39,6 +41,8 @@ namespace Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS"); #endif +DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_TEXT_PERFORMANCE_MARKER, false); + // The relative luminance of a color is defined as (L = 0.2126 * R + 0.7152 * G + 0.0722 * B) // based on W3C Recommendations (https://www.w3.org/TR/WCAG20/) constexpr float BRIGHTNESS_THRESHOLD = 0.179f; @@ -66,6 +70,7 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o // Nothing to do if no operations are pending and required. return false; } + DALI_TRACE_SCOPE(gTraceFilter, "DALI_TEXT_MODEL_UPDATE"); Vector& srcCharacters = impl.mModel->mLogicalModel->mText; Vector displayCharacters; @@ -94,32 +99,39 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o impl.CalculateTextUpdateIndices(paragraphCharacters); // Check whether the indices for updating the text is valid - if(numberOfCharacters > 0u && - (impl.mTextUpdateInfo.mParagraphCharacterIndex > numberOfCharacters || - impl.mTextUpdateInfo.mRequestedNumberOfCharacters > numberOfCharacters)) + if(impl.mTextUpdateInfo.mParagraphCharacterIndex > numberOfCharacters || + impl.mTextUpdateInfo.mRequestedNumberOfCharacters > numberOfCharacters) { - std::string currentText; - Utf32ToUtf8(impl.mModel->mLogicalModel->mText.Begin(), numberOfCharacters, currentText); - - DALI_LOG_ERROR("Controller::Impl::UpdateModel: mTextUpdateInfo has invalid indices\n"); - DALI_LOG_ERROR("Number of characters: %d, current text is: %s\n", numberOfCharacters, currentText.c_str()); - - // Dump mTextUpdateInfo - DALI_LOG_ERROR("Dump mTextUpdateInfo:\n"); - DALI_LOG_ERROR(" mTextUpdateInfo.mCharacterIndex = %u\n", impl.mTextUpdateInfo.mCharacterIndex); - DALI_LOG_ERROR(" mTextUpdateInfo.mNumberOfCharactersToRemove = %u\n", impl.mTextUpdateInfo.mNumberOfCharactersToRemove); - DALI_LOG_ERROR(" mTextUpdateInfo.mNumberOfCharactersToAdd = %u\n", impl.mTextUpdateInfo.mNumberOfCharactersToAdd); - DALI_LOG_ERROR(" mTextUpdateInfo.mPreviousNumberOfCharacters = %u\n", impl.mTextUpdateInfo.mPreviousNumberOfCharacters); - DALI_LOG_ERROR(" mTextUpdateInfo.mParagraphCharacterIndex = %u\n", impl.mTextUpdateInfo.mParagraphCharacterIndex); - DALI_LOG_ERROR(" mTextUpdateInfo.mRequestedNumberOfCharacters = %u\n", impl.mTextUpdateInfo.mRequestedNumberOfCharacters); - DALI_LOG_ERROR(" mTextUpdateInfo.mStartGlyphIndex = %u\n", impl.mTextUpdateInfo.mStartGlyphIndex); - DALI_LOG_ERROR(" mTextUpdateInfo.mStartLineIndex = %u\n", impl.mTextUpdateInfo.mStartLineIndex); - DALI_LOG_ERROR(" mTextUpdateInfo.mEstimatedNumberOfLines = %u\n", impl.mTextUpdateInfo.mEstimatedNumberOfLines); - DALI_LOG_ERROR(" mTextUpdateInfo.mClearAll = %d\n", impl.mTextUpdateInfo.mClearAll); - DALI_LOG_ERROR(" mTextUpdateInfo.mFullRelayoutNeeded = %d\n", impl.mTextUpdateInfo.mFullRelayoutNeeded); - DALI_LOG_ERROR(" mTextUpdateInfo.mIsLastCharacterNewParagraph = %d\n", impl.mTextUpdateInfo.mIsLastCharacterNewParagraph); - - return false; + if(numberOfCharacters == 0u) + { + impl.mTextUpdateInfo.Clear(); + impl.mTextUpdateInfo.mClearAll = true; + } + else // numberOfCharacters > 0u + { + std::string currentText; + Utf32ToUtf8(impl.mModel->mLogicalModel->mText.Begin(), numberOfCharacters, currentText); + + DALI_LOG_ERROR("Controller::Impl::UpdateModel: mTextUpdateInfo has invalid indices\n"); + DALI_LOG_ERROR("Number of characters: %d, current text is: %s paragraphCharacters: %d\n", numberOfCharacters, currentText.c_str(), paragraphCharacters); + + // Dump mTextUpdateInfo + DALI_LOG_ERROR("Dump mTextUpdateInfo:\n"); + DALI_LOG_ERROR(" mTextUpdateInfo.mCharacterIndex = %u\n", impl.mTextUpdateInfo.mCharacterIndex); + DALI_LOG_ERROR(" mTextUpdateInfo.mNumberOfCharactersToRemove = %u\n", impl.mTextUpdateInfo.mNumberOfCharactersToRemove); + DALI_LOG_ERROR(" mTextUpdateInfo.mNumberOfCharactersToAdd = %u\n", impl.mTextUpdateInfo.mNumberOfCharactersToAdd); + DALI_LOG_ERROR(" mTextUpdateInfo.mPreviousNumberOfCharacters = %u\n", impl.mTextUpdateInfo.mPreviousNumberOfCharacters); + DALI_LOG_ERROR(" mTextUpdateInfo.mParagraphCharacterIndex = %u\n", impl.mTextUpdateInfo.mParagraphCharacterIndex); + DALI_LOG_ERROR(" mTextUpdateInfo.mRequestedNumberOfCharacters = %u\n", impl.mTextUpdateInfo.mRequestedNumberOfCharacters); + DALI_LOG_ERROR(" mTextUpdateInfo.mStartGlyphIndex = %u\n", impl.mTextUpdateInfo.mStartGlyphIndex); + DALI_LOG_ERROR(" mTextUpdateInfo.mStartLineIndex = %u\n", impl.mTextUpdateInfo.mStartLineIndex); + DALI_LOG_ERROR(" mTextUpdateInfo.mEstimatedNumberOfLines = %u\n", impl.mTextUpdateInfo.mEstimatedNumberOfLines); + DALI_LOG_ERROR(" mTextUpdateInfo.mClearAll = %d\n", impl.mTextUpdateInfo.mClearAll); + DALI_LOG_ERROR(" mTextUpdateInfo.mFullRelayoutNeeded = %d\n", impl.mTextUpdateInfo.mFullRelayoutNeeded); + DALI_LOG_ERROR(" mTextUpdateInfo.mIsLastCharacterNewParagraph = %d\n", impl.mTextUpdateInfo.mIsLastCharacterNewParagraph); + + return false; + } } startIndex = impl.mTextUpdateInfo.mParagraphCharacterIndex; @@ -387,7 +399,8 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o impl.mModel->mVisualModel->mUnderlineRuns.PushBack(underlineRun); //Mark-up processor case - if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled()) + if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled() || + impl.mModel->mLogicalModel->mUnderlineRunsUpdated) { impl.CopyUnderlinedFromLogicalToVisualModels(false); } @@ -403,13 +416,13 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o impl.mModel->mLogicalModel->mBackgroundColorRuns.PushBack(backgroundColorRun); Vector4 backgroundColor = impl.mModel->mVisualModel->GetBackgroundColor(); - if(backgroundColor.a == 0) // There is no text background color. + if(Dali::EqualsZero(backgroundColor.a)) // There is no text background color. { // Try use the control's background color. if(nullptr != impl.mEditableControlInterface) { impl.mEditableControlInterface->GetControlBackgroundColor(backgroundColor); - if(backgroundColor.a == 0) // There is no control background color. + if(Dali::EqualsZero(backgroundColor.a)) // There is no control background color. { // Determines black or white color according to text color. // Based on W3C Recommendations (https://www.w3.org/TR/WCAG20/) @@ -428,7 +441,8 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o impl.mModel->mLogicalModel->mColorRuns.PushBack(colorRun); //Mark-up processor case - if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled()) + if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled() || + impl.mModel->mLogicalModel->mUnderlineRunsUpdated) { impl.CopyUnderlinedFromLogicalToVisualModels(false); } @@ -443,7 +457,8 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o impl.mModel->mLogicalModel->mBackgroundColorRuns.PushBack(backgroundColorRun); //Mark-up processor case - if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled()) + if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled() || + impl.mModel->mLogicalModel->mUnderlineRunsUpdated) { impl.CopyUnderlinedFromLogicalToVisualModels(false); } @@ -464,7 +479,8 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o impl.mModel->mVisualModel->mUnderlineRuns.PushBack(underlineRun); //Mark-up processor case - if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled()) + if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled() || + impl.mModel->mLogicalModel->mUnderlineRunsUpdated) { impl.CopyUnderlinedFromLogicalToVisualModels(false); } @@ -485,7 +501,8 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o impl.mModel->mVisualModel->mUnderlineRuns.PushBack(underlineRun); //Mark-up processor case - if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled()) + if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled() || + impl.mModel->mLogicalModel->mUnderlineRunsUpdated) { impl.CopyUnderlinedFromLogicalToVisualModels(false); } @@ -506,7 +523,8 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o impl.mModel->mVisualModel->mUnderlineRuns.PushBack(underlineRun); //Mark-up processor case - if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled()) + if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled() || + impl.mModel->mLogicalModel->mUnderlineRunsUpdated) { impl.CopyUnderlinedFromLogicalToVisualModels(false); } @@ -527,7 +545,8 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o impl.mModel->mVisualModel->mUnderlineRuns.PushBack(underlineRun); //Mark-up processor case - if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled()) + if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled() || + impl.mModel->mLogicalModel->mUnderlineRunsUpdated) { impl.CopyUnderlinedFromLogicalToVisualModels(false); } @@ -575,7 +594,10 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o (0u != impl.mModel->mVisualModel->mCharactersToGlyph.Count()))) { //Mark-up processor case - if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled()) + if(impl.mModel->mVisualModel->IsMarkupProcessorEnabled() || + impl.mModel->mLogicalModel->mUnderlineRunsUpdated || + impl.mModel->mLogicalModel->mCharacterSpacingRunsUpdated || + impl.mModel->mLogicalModel->mStrikethroughRunsUpdated) { impl.CopyUnderlinedFromLogicalToVisualModels(true); impl.CopyStrikethroughFromLogicalToVisualModels();