if(gTraceFilter && gTraceFilter->IsTraceEnabled())
{
mStartTimeNanoSceonds = GetNanoseconds();
- DALI_TRACE_BEGIN_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_MODEL_LOADING_TASK", [&](std::ostringstream& oss) {
- oss << "[u:" << mModelUrl << ",dir:" << mResourceDirectoryUrl << "]";
- });
+ DALI_TRACE_BEGIN_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_MODEL_LOADING_TASK", [&](std::ostringstream& oss)
+ { oss << "[u:" << mModelUrl << ",dir:" << mResourceDirectoryUrl << "]"; });
}
#endif
mResourceDirectoryUrl = std::string(modelUrl.parent_path()) + "/";
}
- Dali::Scene3D::Loader::ResourceBundle::PathProvider pathProvider = [&](Dali::Scene3D::Loader::ResourceType::Value type) {
+ Dali::Scene3D::Loader::ResourceBundle::PathProvider pathProvider = [&](Dali::Scene3D::Loader::ResourceType::Value type)
+ {
return mResourceDirectoryUrl;
};
mModelLoader = std::make_shared<Dali::Scene3D::Loader::ModelLoader>(mModelUrl, mResourceDirectoryUrl, mLoadResult);
- bool loadSucceeded = false;
+ bool loadSucceeded = false;
+
+#ifdef TRACE_ENABLED
bool useCachedModel = false;
+#endif
+
{
// Lock model url during process, so let we do not try to load same model multiple times.
mModelCacheManager.LockModelLoadScene(mModelUrl);
if(mModelCacheManager.IsSceneLoaded(mModelUrl))
{
+#ifdef TRACE_ENABLED
useCachedModel = true;
- loadSucceeded = true;
+#endif
+
+ loadSucceeded = true;
}
else
{
if(gTraceFilter && gTraceFilter->IsTraceEnabled())
{
mEndTimeNanoSceonds = GetNanoseconds();
- DALI_TRACE_END_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_MODEL_LOADING_TASK", [&](std::ostringstream& oss) {
+ DALI_TRACE_END_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_MODEL_LOADING_TASK", [&](std::ostringstream& oss)
+ {
oss << std::fixed << std::setprecision(3);
oss << "[";
oss << "d:" << static_cast<float>(mEndTimeNanoSceonds - mStartTimeNanoSceonds) / 1000000.0f << "ms ";
oss << "c?" << useCachedModel << " ";
oss << "s?" << loadSucceeded << " ";
oss << "dir:" << mResourceDirectoryUrl << " ";
- oss << "u:" << mModelUrl << "]";
- });
+ oss << "u:" << mModelUrl << "]"; });
}
#endif
if(!loadSucceeded)
// INTERNAL INCLUDES
-
namespace Dali
{
namespace Toolkit
const char* DALI_TEXT_NUMBER_OF_ASYNC_TEXT_LOADER("DALI_TEXT_NUMBER_OF_ASYNC_TEXT_LOADER");
const int DEFAULT_NUMBER_OF_LOADER = 4;
const int MINIMUM_NUMBER_OF_LOADER = 1;
-const uint32_t EMPTY_TASK_ID = 0u;
+const int MAXIMUM_NUMBER_OF_LOADER = 16;
+const uint32_t EMPTY_TASK_ID = 0u;
DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_TEXT_ASYNC, false);
} // namespace
auto numberOfLoaderString = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_TEXT_NUMBER_OF_ASYNC_TEXT_LOADER);
int numberOfLoader = numberOfLoaderString ? std::atoi(numberOfLoaderString) : DEFAULT_NUMBER_OF_LOADER;
- numberOfLoader = std::max(numberOfLoader, MINIMUM_NUMBER_OF_LOADER);
+ numberOfLoader = std::clamp(numberOfLoader, MINIMUM_NUMBER_OF_LOADER, MAXIMUM_NUMBER_OF_LOADER);
DALI_LOG_RELEASE_INFO("Number of async text loaders:%d\n", numberOfLoader);
- for(int i = 0; i < numberOfLoader; i ++)
+ for(int i = 0; i < numberOfLoader; i++)
{
Text::AsyncTextLoader loader = Text::AsyncTextLoader::New();
mAvailableLoaders.push_back(loader);
if(it->second.mObserver == observer)
{
it->second.mObserver = nullptr;
- it = mRunningTasks.erase(it);
+ it = mRunningTasks.erase(it);
}
else
{
{
Dali::AsyncTaskManager::Get().RemoveTask(it->second.mTask);
it->second.mObserver = nullptr;
- it = mWaitingTasks.erase(it);
+ it = mWaitingTasks.erase(it);
}
else
{
{
}
- LoadElement(Toolkit::Internal::TextLoadingTaskPtr task, TextLoadObserver* observer, AsyncTextParameters parameters)
+ LoadElement(Toolkit::Internal::TextLoadingTaskPtr task, TextLoadObserver* observer, const AsyncTextParameters& parameters)
: mTask(task),
mObserver(observer),
mParameters(parameters)
std::vector<Text::AsyncTextLoader> mAvailableLoaders; ///< List of available async text loader.
std::vector<Text::AsyncTextLoader> mRunningLoaders; ///< List of running async text loader.
- std::map<uint32_t, LoadElement> mWaitingTasks; ///< Waiting tasks, key is task id.
- std::map<uint32_t, LoadElement> mRunningTasks; ///< Running tasks, key is task id.
+ std::map<uint32_t, LoadElement> mWaitingTasks; ///< Waiting tasks, key is task id.
+ std::map<uint32_t, LoadElement> mRunningTasks; ///< Running tasks, key is task id.
};
} // namespace Internal
{
namespace Toolkit
{
-TextLoadObserver::TextInformation::TextInformation(Text::AsyncTextRenderInfo renderInfo, Text::AsyncTextParameters parameters)
+TextLoadObserver::TextInformation::TextInformation(const Text::AsyncTextRenderInfo& renderInfo, const Text::AsyncTextParameters& parameters)
: renderInfo(renderInfo),
parameters(parameters)
{
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/async-text/async-text-loader.h>
-
namespace Dali
{
namespace Toolkit
struct TextInformation
{
- TextInformation(Text::AsyncTextRenderInfo renderInfo, Text::AsyncTextParameters parameters);
+ TextInformation(const Text::AsyncTextRenderInfo& renderInfo, const Text::AsyncTextParameters& parameters);
TextInformation();
Text::AsyncTextRenderInfo renderInfo;
* @param[in] loadSuccess True if the text load was successful.
* @param[in] textureInformation Structure that contains loaded text information.
*/
- virtual void LoadComplete(bool loadSuccess, TextInformation textInformation) = 0;
+ virtual void LoadComplete(bool loadSuccess, const TextInformation& textInformation) = 0;
/**
* @brief Returns the destruction signal.
bool DisconnectDestructionSignal();
public:
-
private:
DestructionSignalType mDestructionSignal; ///< The destruction signal emitted when the observer is destroyed.
int mDestructionSignalConnect; ///< The number of times DestructionSignal is connected.
#include <dali/integration-api/debug.h>
#include <dali/integration-api/trace.h>
-
namespace Dali
{
namespace Toolkit
DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_TEXT_ASYNC, false);
} // namespace
-TextLoadingTask::TextLoadingTask(const uint32_t id, Text::AsyncTextParameters parameters, CallbackBase* callback)
+TextLoadingTask::TextLoadingTask(const uint32_t id, const Text::AsyncTextParameters& parameters, CallbackBase* callback)
: AsyncTask(callback),
mId(id),
mParameters(parameters),
void TextLoadingTask::SetLoader(Text::AsyncTextLoader& loader)
{
Dali::Mutex::ScopedLock lock(mMutex);
- mLoader = loader;
+ mLoader = loader;
mIsReady = true;
}
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/async-text/async-text-loader.h>
-
namespace Dali
{
namespace Toolkit
* @param [in] paramaters The async text parameters.
* @param [in] callback The callback that is called when the operation is completed.
*/
- TextLoadingTask(const uint32_t id,
- Text::AsyncTextParameters paramaters,
- CallbackBase* callback);
+ TextLoadingTask(const uint32_t id,
+ const Text::AsyncTextParameters& paramaters,
+ CallbackBase* callback);
/**
* Constructor, empty task for wake up the async task manger.
Text::AsyncTextRenderInfo mRenderInfo;
private:
- bool mIsReady : 1; ///< Whether this task ready to run
- Mutex mMutex;
+ bool mIsReady : 1; ///< Whether this task ready to run
+ Mutex mMutex;
};
} // namespace Internal
const int CUSTOM_PROPERTY_COUNT(3); // uTextColorAnimatable, uHasMultipleTextColors, requireRender
const float VERTICAL_ALIGNMENT_TABLE[Text::VerticalAlignment::BOTTOM + 1] =
-{
+ {
0.0f, // VerticalAlignment::TOP
0.5f, // VerticalAlignment::CENTER
1.0f // VerticalAlignment::BOTTOM
// When Cutout Enabled, the current visual must draw the entire control.
// so set the size to controlSize and offset to 0.
- relayoutSize = Vector2(controlWidth, controlHeight);
- mImpl->mTransform.mSize.width = controlWidth;
+ relayoutSize = Vector2(controlWidth, controlHeight);
+ mImpl->mTransform.mSize.width = controlWidth;
mImpl->mTransform.mSize.height = controlHeight;
// Relayout to the original size has been completed, so save only the offset information and use it in typesetter.
renderer.SetTextures(textureSet);
- //Register transform properties
+ // Register transform properties
mImpl->mTransform.SetUniforms(renderer, Direction::LEFT_TO_RIGHT);
// Enable the pre-multiplied alpha to improve the text quality
}
// From async text manager
-void TextVisual::LoadComplete(bool loadingSuccess, TextInformation textInformation)
+void TextVisual::LoadComplete(bool loadingSuccess, const TextInformation& textInformation)
{
Text::AsyncTextParameters parameters = textInformation.parameters;
}
#endif
- switch (parameters.requestType)
+ switch(parameters.requestType)
{
case Text::Async::RENDER_FIXED_SIZE:
case Text::Async::RENDER_FIXED_WIDTH:
}
mImpl->mRenderer.SetTextures(textureSet);
- //Register transform properties
+ // Register transform properties
mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
mImpl->mRenderer.SetProperty(mHasMultipleTextColorsIndex, static_cast<float>(mTextShaderFeatureCache.IsEnabledMultiColor()));
mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
mIsNaturalSizeTaskRunning = true;
TextLoadObserver* textLoadObserver = this;
- mNaturalSizeTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
+ mNaturalSizeTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
break;
}
case Text::Async::COMPUTE_HEIGHT_FOR_WIDTH:
mIsHeightForWidthTaskRunning = true;
TextLoadObserver* textLoadObserver = this;
- mHeightForWidthTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
+ mHeightForWidthTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
break;
}
default:
}
#endif
- mIsTextLoadingTaskRunning = true;
+ mIsTextLoadingTaskRunning = true;
TextLoadObserver* textLoadObserver = this;
- mTextLoadingTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
+ mTextLoadingTaskId = Text::AsyncTextManager::Get().RequestLoad(parameters, textLoadObserver);
return true;
}
TextureSet textureSet = GetTextTexture(size);
mImpl->mRenderer.SetTextures(textureSet);
- //Register transform properties
+ // Register transform properties
mImpl->mTransform.SetUniforms(mImpl->mRenderer, Direction::LEFT_TO_RIGHT);
mImpl->mRenderer.SetProperty(mHasMultipleTextColorsIndex, static_cast<float>(hasMultipleTextColors));
mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
private:
struct TilingInfo
{
- PixelData textPixelData;
- PixelData stylePixelData;
- PixelData overlayStylePixelData;
- PixelData maskPixelData;
- int32_t width;
- int32_t height;
- uint32_t offsetHeight;
- Vector2 transformOffset;
+ PixelData textPixelData;
+ PixelData stylePixelData;
+ PixelData overlayStylePixelData;
+ PixelData maskPixelData;
+ int32_t width;
+ int32_t height;
+ uint32_t offsetHeight;
+ Vector2 transformOffset;
TilingInfo(int32_t width, int32_t height)
: textPixelData(),
* @param[in] success True if the load was successful, false otherwise.
* @param[in] textInformation The text information including render info and parameters.
*/
- void LoadComplete(bool success, TextInformation textInformation) override;
+ void LoadComplete(bool success, const TextInformation& textInformation) override;
private:
typedef std::vector<Renderer> RendererContainer;
bool mTextRequireRender : 1; ///< The flag to indicate whether the text needs to be rendered.
RendererContainer mRendererList;
- uint32_t mTextLoadingTaskId; ///< The currently requested text loading(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 mIsTextLoadingTaskRunning : 1; ///< Whether the requested text loading 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.
+ uint32_t mTextLoadingTaskId; ///< The currently requested text loading(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 mIsTextLoadingTaskRunning : 1; ///< Whether the requested text loading 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