X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fsvg%2Fsvg-rasterize-thread.h;h=1c94ca9b11c1ebf8519398e8d71d88c2a8501f55;hp=1f426cb3c55998177b73c21b438338fb1d6049c3;hb=96e0b7fdbe4cfe733a38cbcc2b493a7aeff66d6d;hpb=257a9991486e4e05335212b21ecc1f5a0aacbc63 diff --git a/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h b/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h index 1f426cb..1c94ca9 100644 --- a/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h +++ b/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_SVG_RASTERIZE_THREAD_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -28,6 +28,7 @@ #include #include #include +#include struct NSVGimage; struct NSVGrasterizer; @@ -53,7 +54,7 @@ typedef IntrusivePtr< RasterizingTask > RasterizingTaskPtr; * 1. Created by SvgVisual in the main thread * 2. Queued in the worked thread waiting to be processed. * 3. If this task gets its turn to do the rasterization, it triggers main thread to apply the rasterized image to material then been deleted in main thread call back - * Or if this task is been removed ( new image/size set to the renderer or actor off stage) before its turn to be processed, it then been deleted in the worker thread. + * Or if this task is been removed ( new image/size set to the visual or actor off stage) before its turn to be processed, it then been deleted in the worker thread. */ class RasterizingTask : public RefObject { @@ -65,10 +66,11 @@ 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. @@ -77,7 +79,7 @@ public: void Rasterize( NSVGrasterizer* rasterizer ); /** - * Get the svg renderer + * Get the svg visual */ SvgVisual* GetSvgVisual() const; @@ -87,8 +89,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 +108,15 @@ 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; }; - /** * The worker thread for SVG rasterization. */ @@ -138,13 +151,13 @@ public: RasterizingTaskPtr NextCompletedTask(); /** - * Remove the task with the given renderer from the waiting queue, called by main thread. + * Remove the task with the given visual from the waiting queue, called by main thread. * * Typically called when the actor is put off stage, so the renderer is not needed anymore. * - * @param[in] renderer The renderer pointer. + * @param[in] visual The visual pointer. */ - void RemoveTask( SvgVisual* renderer ); + void RemoveTask( SvgVisual* visual ); /** * Delete the parsed SVG image, called by main thread. @@ -183,7 +196,7 @@ protected: * 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: