[dali_2.3.24] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / svg / svg-task.h
index beeaee4..e23a8ae 100644 (file)
@@ -19,6 +19,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/vector-image-renderer.h>
+#include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/images/pixel-data.h>
@@ -65,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.
    */
@@ -112,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
+  /**
+   * @copydoc Dali::AsyncTask::Process()
+   */
+  void Process();
+
   /**
-   * Process the task
+   * @copydoc Dali::AsyncTask::IsReady()
    */
-  void Process() override;
+  bool IsReady();
 
   /**
-   * Whether the task is ready to process.
-   * @return True if the task is ready to process.
+   * @copydoc Dali::AsyncTask::GetTaskName()
    */
-  bool IsReady() override;
+  std::string_view GetTaskName() const override
+  {
+    return "SvgLoadingTask";
+  }
 
 private:
   // Undefined
@@ -141,8 +140,9 @@ private:
   SvgLoadingTask& operator=(const SvgLoadingTask& task) = delete;
 
 private:
-  VisualUrl mImageUrl;
-  float     mDpi;
+  VisualUrl          mImageUrl;
+  EncodedImageBuffer mEncodedImageBuffer;
+  float              mDpi;
 };
 
 class SvgRasterizingTask : public SvgTask
@@ -163,17 +163,6 @@ public:
   ~SvgRasterizingTask() override;
 
   /**
-   * Process the task accodring to the type
-   */
-  void Process() override;
-
-  /**
-   * Whether the task is ready to process.
-   * @return True if the task is ready to process.
-   */
-  bool IsReady() override;
-
-  /**
    * Get the rasterization result.
    * @return The pixel data with the rasterized pixels.
    */
@@ -190,6 +179,25 @@ public:
   }
 #endif
 
+public: // Implementation of AsyncTask
+  /**
+   * @copydoc Dali::AsyncTask::Process()
+   */
+  void Process();
+
+  /**
+   * @copydoc Dali::AsyncTask::IsReady()
+   */
+  bool IsReady();
+
+  /**
+   * @copydoc Dali::AsyncTask::GetTaskName()
+   */
+  std::string_view GetTaskName() const override
+  {
+    return "SvgRasterizingTask";
+  }
+
 private:
   // Undefined
   SvgRasterizingTask(const SvgRasterizingTask& task) = delete;