X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fcontroller%2Ftext-controller-impl-model-updater.cpp;h=fb4eb5f2117b6e122940aab25a5270c0341ede5d;hb=HEAD;hp=01e9157c38705e695d6cd270d4adb73dee659487;hpb=27f1cf254ac125105e5ea4b5b830d6f58155b685;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 01e9157..fb4eb5f 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 @@ -19,6 +19,7 @@ #include // EXTERNAL INCLUDES +#include #include #include #include @@ -43,6 +44,18 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_TEXT_PERFORMANCE_MARKER, false); +#if defined(TRACE_ENABLED) +uint32_t GetMilliSeconds() +{ + // Get the time of a monotonic clock since its epoch. + auto epoch = std::chrono::steady_clock::now().time_since_epoch(); + + auto duration = std::chrono::duration_cast(epoch); + + return static_cast(duration.count()); +} +#endif + // 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; @@ -249,7 +262,7 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o // Set the normal font and the placeholder font. defaultFontDescription = impl.mFontDefaults->mFontDescription; - if(impl.mTextFitEnabled) + if(impl.mTextFitEnabled || impl.mTextFitArrayEnabled) { defaultPointSize = impl.mFontDefaults->mFitPointSize * numberOfPointsPerOneUnitOfPointSize; } @@ -327,6 +340,20 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o newParagraphGlyphs.Reserve(numberOfParagraphs); const Length currentNumberOfGlyphs = glyphs.Count(); + +#if defined(TRACE_ENABLED) + uint32_t logThreshold = TextAbstraction::FontClient::GetPerformanceLogThresholdTime(); + bool logEnabled = TextAbstraction::FontClient::IsPerformanceLogEnabled(); + + uint32_t timeStamps[6]; + uint32_t timeStampIndex = 0; + + if(logEnabled) + { + timeStamps[timeStampIndex++] = GetMilliSeconds(); + } +#endif + if(Controller::NO_OPERATION != (Controller::SHAPE_TEXT & operations)) { const Vector& textToShape = textMirrored ? mirroredUtf32Characters : utf32Characters; @@ -350,6 +377,13 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o updated = true; } +#if defined(TRACE_ENABLED) + if(logEnabled) + { + timeStamps[timeStampIndex++] = GetMilliSeconds(); + } +#endif + const Length numberOfGlyphs = static_cast(glyphs.Count()) - currentNumberOfGlyphs; if(Controller::NO_OPERATION != (Controller::GET_GLYPH_METRICS & operations)) @@ -370,6 +404,13 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o updated = true; } +#if defined(TRACE_ENABLED) + if(logEnabled) + { + timeStamps[timeStampIndex++] = GetMilliSeconds(); + } +#endif + if((nullptr != impl.mEventData) && impl.mEventData->mPreEditFlag && (0u != impl.mModel->mVisualModel->mCharactersToGlyph.Count())) @@ -564,6 +605,13 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o updated = true; } +#if defined(TRACE_ENABLED) + if(logEnabled) + { + timeStamps[timeStampIndex++] = GetMilliSeconds(); + } +#endif + if(Controller::NO_OPERATION != (Controller::COLOR & operations)) { // Set the color runs in glyphs. @@ -589,6 +637,13 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o updated = true; } +#if defined(TRACE_ENABLED) + if(logEnabled) + { + timeStamps[timeStampIndex++] = GetMilliSeconds(); + } +#endif + if((Controller::NO_OPERATION != (Controller::SHAPE_TEXT & operations)) && !((nullptr != impl.mEventData) && impl.mEventData->mPreEditFlag && @@ -608,6 +663,26 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o updated = true; } +#if defined(TRACE_ENABLED) + if(logEnabled) + { + timeStamps[timeStampIndex++] = GetMilliSeconds(); + uint32_t timeShape = timeStamps[1] - timeStamps[0]; + uint32_t timeGlyph = timeStamps[2] - timeStamps[1]; + uint32_t timePreedit = timeStamps[3] - timeStamps[2]; + uint32_t timeColor = timeStamps[4] - timeStamps[3]; + uint32_t timeCopy = timeStamps[5] - timeStamps[4]; + + if(timeStamps[5] - timeStamps[0] > logThreshold) + { + std::string currentText; + Utf32ToUtf8(impl.mModel->mLogicalModel->mText.Begin(), numberOfCharacters, currentText); + DALI_LOG_DEBUG_INFO("DALI_TEXT_MODEL_UPDATE shape:%u ms, glyph:%u ms, preedit:%u ms, color:%u ms, copy:%u ms\n", timeShape, timeGlyph, timePreedit, timeColor, timeCopy); + DALI_LOG_DEBUG_INFO("DALI_TEXT_MODEL_UPDATE chars:%d, text:%s\n", numberOfCharacters, currentText.c_str()); + } + } +#endif + // The estimated number of lines. Used to avoid reallocations when layouting. impl.mTextUpdateInfo.mEstimatedNumberOfLines = std::max(impl.mModel->mVisualModel->mLines.Count(), impl.mModel->mLogicalModel->mParagraphInfo.Count());