X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fsvg%2Fsvg-task.h;h=e23a8ae376231539637bf08f128e083a2973f673;hb=HEAD;hp=31855b9baa51e6b7d475566708b0f27318292092;hpb=6648cdfb9e2dd90cb8a34da7aaad71fce83ca05b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/svg/svg-task.h b/dali-toolkit/internal/visuals/svg/svg-task.h index 31855b9..e23a8ae 100644 --- a/dali-toolkit/internal/visuals/svg/svg-task.h +++ b/dali-toolkit/internal/visuals/svg/svg-task.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_SVG_TASK_H /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ // EXTERNAL INCLUDES #include +#include #include #include #include @@ -55,8 +56,9 @@ public: * Constructor * @param[in] vectorRenderer The vector rasterizer. * @param[in] callback The callback that is called when the operation is completed. + * @param[in] priorityType The priority of this task. */ - SvgTask(VectorImageRenderer vectorRenderer, CallbackBase* callback); + SvgTask(VectorImageRenderer vectorRenderer, CallbackBase* callback, AsyncTask::PriorityType priorityType = AsyncTask::PriorityType::DEFAULT); /** * Destructor. @@ -64,17 +66,6 @@ public: virtual ~SvgTask() = default; /** - * Process the task - */ - virtual void Process() = 0; - - /** - * Whether the task is ready to process. - * @return True if the task is ready to process. - */ - virtual bool IsReady() = 0; - - /** * Whether the task has succeeded. * @return True if the task has succeeded. */ @@ -111,26 +102,35 @@ public: * Constructor * @param[in] vectorRenderer The vector rasterizer. * @param[in] url The URL to svg resource to use. + * @param[in] encodedImageBuffer The resource buffer if required. * @param[in] dpi The DPI of the screen. * @param[in] callback The callback that is called when the operation is completed. */ - SvgLoadingTask(VectorImageRenderer vectorRenderer, const VisualUrl& url, float dpi, CallbackBase* callback); + SvgLoadingTask(VectorImageRenderer vectorRenderer, const VisualUrl& url, EncodedImageBuffer encodedImageBuffer, float dpi, CallbackBase* callback); /** * Destructor. */ ~SvgLoadingTask() override; +public: // Implementation of AsyncTask /** - * Process the task + * @copydoc Dali::AsyncTask::Process() */ - void Process() override; + void Process(); /** - * Whether the task is ready to process. - * @return True if the task is ready to process. + * @copydoc Dali::AsyncTask::IsReady() */ - bool IsReady() override; + bool IsReady(); + + /** + * @copydoc Dali::AsyncTask::GetTaskName() + */ + std::string_view GetTaskName() const override + { + return "SvgLoadingTask"; + } private: // Undefined @@ -140,8 +140,9 @@ private: SvgLoadingTask& operator=(const SvgLoadingTask& task) = delete; private: - VisualUrl mUrl; - float mDpi; + VisualUrl mImageUrl; + EncodedImageBuffer mEncodedImageBuffer; + float mDpi; }; class SvgRasterizingTask : public SvgTask @@ -162,21 +163,40 @@ public: ~SvgRasterizingTask() override; /** - * Process the task accodring to the type + * Get the rasterization result. + * @return The pixel data with the rasterized pixels. */ - void Process() override; + PixelData GetPixelData() const override; +#ifdef TRACE_ENABLED /** - * Whether the task is ready to process. - * @return True if the task is ready to process. + * Set the url of rasterizatoin visual. Only for tracing + * @param[in] url The url of this visual */ - bool IsReady() override; + void SetUrl(VisualUrl url) + { + mImageUrl = std::move(url); + } +#endif +public: // Implementation of AsyncTask /** - * Get the rasterization result. - * @return The pixel data with the rasterized pixels. + * @copydoc Dali::AsyncTask::Process() */ - PixelData GetPixelData() const override; + void Process(); + + /** + * @copydoc Dali::AsyncTask::IsReady() + */ + bool IsReady(); + + /** + * @copydoc Dali::AsyncTask::GetTaskName() + */ + std::string_view GetTaskName() const override + { + return "SvgRasterizingTask"; + } private: // Undefined @@ -186,6 +206,9 @@ private: SvgRasterizingTask& operator=(const SvgRasterizingTask& task) = delete; private: +#ifdef TRACE_ENABLED + VisualUrl mImageUrl{}; +#endif PixelData mPixelData; uint32_t mWidth; uint32_t mHeight;