Overriding virtual destructors are marked as 'override'.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / svg / svg-rasterize-thread.h
index 46c6966..11fa03f 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_SVG_RASTERIZE_THREAD_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
 #include <dali/devel-api/threading/conditional-wait.h>
 #include <dali/devel-api/threading/mutex.h>
 #include <dali/devel-api/threading/thread.h>
-#include <dali/public-api/images/buffer-image.h>
 #include <dali/public-api/images/pixel-data.h>
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/rendering/texture-set.h>
+#include <dali-toolkit/internal/visuals/visual-url.h>
 
 struct NSVGimage;
 struct NSVGrasterizer;
@@ -65,16 +65,21 @@ public:
    * @param[in] parsedSvg The parsed svg for rasterizing.
    *            Note, after the task is added to the worker thread, the worker thread takes over the ownership.
    *            When the image is to be deleted, delete it in the worker thread by calling SvgRasterizeThread::DeleteImage( parsedSvg ).
+   * @param[in] url The URL to svg resource to use.
    * @param[in] width The rasterization width.
    * @param[in] height The rasterization height.
    */
-  RasterizingTask( SvgVisual* svgRenderer, NSVGimage* parsedSvg, unsigned int width, unsigned int height );
+  RasterizingTask( SvgVisual* svgRenderer, NSVGimage* parsedSvg, const VisualUrl& url, float dpi, unsigned int width, unsigned int height );
 
   /**
-   * Do the rasterization with the given rasterizer.
-   *@param[in] rasterizer The rasterizer that rasterize the SVG to a buffer image
+   * Destructor.
+   */
+  ~RasterizingTask() override;
+
+  /**
+   * Do the rasterization with the mRasterizer.
    */
-  void Rasterize( NSVGrasterizer* rasterizer );
+  void Rasterize( );
 
   /**
    * Get the svg visual
@@ -87,8 +92,18 @@ public:
    */
   PixelData GetPixelData() const;
 
-private:
+  /**
+   * Get the parsed data.
+   * @return parsed image data.
+   */
+  NSVGimage* GetParsedImage() const;
 
+  /**
+   * Load svg file
+   */
+  void Load();
+
+private:
   // Undefined
   RasterizingTask( const RasterizingTask& task );
 
@@ -96,14 +111,16 @@ private:
   RasterizingTask& operator=( const RasterizingTask& task );
 
 private:
-  SvgVisualPtr  mSvgVisual;
-  PixelData       mPixelData;
+  SvgVisualPtr    mSvgVisual;
   NSVGimage*      mParsedSvg;
+  VisualUrl       mUrl;
+  PixelData       mPixelData;
+  float           mDpi;
   unsigned int    mWidth;
   unsigned int    mHeight;
+  NSVGrasterizer* mRasterizer;
 };
 
-
 /**
  * The worker thread for SVG rasterization.
  */
@@ -176,14 +193,14 @@ protected:
   /**
    * Destructor.
    */
-  virtual ~SvgRasterizeThread();
+  ~SvgRasterizeThread() override;
 
 
   /**
    * The entry function of the worker thread.
    * It fetches task from the Queue, rasterizes the image and apply to the renderer.
    */
-  virtual void Run();
+  void Run() override;
 
 private:
 
@@ -203,7 +220,6 @@ private:
   Dali::Mutex                mMutex;
   EventThreadCallback*       mTrigger;
 
-  NSVGrasterizer*            mRasterizer;
   bool                       mIsThreadWaiting;
 };