Show the broken image in case of invalid svg files
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / svg / svg-rasterize-thread.h
index d7eb16b..86e233f 100644 (file)
@@ -29,6 +29,7 @@
 #include <dali/public-api/rendering/texture-set.h>
 #include <dali/devel-api/adaptor-framework/vector-image-renderer.h>
 #include <dali/integration-api/adaptor-framework/log-factory-interface.h>
+#include <dali/integration-api/processor-interface.h>
 #include <memory>
 
 // INTERNAL INCLUDES
@@ -66,9 +67,8 @@ public:
    * @param[in] url The URL to svg resource to use.
    * @param[in] width The rasterization width.
    * @param[in] height The rasterization height.
-   * @param[in] loaded The svg resource is loaded or not.
    */
-  RasterizingTask( SvgVisual* svgRenderer, VectorImageRenderer vectorRenderer, const VisualUrl& url, float dpi, unsigned int width, unsigned int height, bool loaded );
+  RasterizingTask(SvgVisual* svgRenderer, VectorImageRenderer vectorRenderer, const VisualUrl& url, float dpi, unsigned int width, unsigned int height);
 
   /**
    * Destructor.
@@ -122,13 +122,13 @@ private:
   float           mDpi;
   unsigned int    mWidth;
   unsigned int    mHeight;
-  bool            mLoaded;
+  bool            mLoadSuccess;
 };
 
 /**
  * The worker thread for SVG rasterization.
  */
-class SvgRasterizeThread : public Thread
+class SvgRasterizeThread : public Thread, Integration::Processor
 {
 public:
 
@@ -137,7 +137,7 @@ public:
    *
    * @param[in] trigger The trigger to wake up the main thread.
    */
-  SvgRasterizeThread( EventThreadCallback* trigger );
+  SvgRasterizeThread();
 
   /**
    * Terminate the svg rasterize thread, join and delete.
@@ -176,6 +176,11 @@ public:
    */
   void DeleteImage( VectorImageRenderer vectorImage );
 
+    /**
+   * @copydoc Dali::Integration::Processor::Process()
+   */
+  void Process() override;
+
 private:
 
   /**
@@ -192,6 +197,17 @@ private:
    */
   void AddCompletedTask( RasterizingTaskPtr task );
 
+  /**
+   * Applies the rasterized image to material
+   */
+  void ApplyRasterizedSVGToSampler();
+
+  /**
+   * @brief Unregister a previously registered processor
+   *
+   */
+  void UnregisterProcessor();
+
 protected:
 
   /**
@@ -225,6 +241,7 @@ private:
   std::unique_ptr< EventThreadCallback > mTrigger;
   const Dali::LogFactoryInterface&       mLogFactory;
   bool                       mIsThreadWaiting;
+  bool                       mProcessorRegistered;
 };
 
 } // namespace Internal