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=d7eb16bd4cb62b4a3dcddf140d99ef56927a0c0b;hp=11fa03f48f581b56eca83e43cab4d23393deb3e6;hb=8f568af864987ed3039737045db38ea3db4ac962;hpb=debd4ef5b35507bac4579dfbb8983b743872c70b diff --git a/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h b/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h index 11fa03f..d7eb16b 100644 --- a/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h +++ b/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h @@ -27,10 +27,12 @@ #include #include #include -#include +#include +#include +#include -struct NSVGimage; -struct NSVGrasterizer; +// INTERNAL INCLUDES +#include namespace Dali { @@ -60,16 +62,13 @@ class RasterizingTask : public RefObject public: /** * Constructor - * * @param[in] svgRenderer The renderer which the rasterized image to be applied. - * @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. + * @param[in] loaded The svg resource is loaded or not. */ - RasterizingTask( SvgVisual* svgRenderer, NSVGimage* parsedSvg, const VisualUrl& url, float dpi, unsigned int width, unsigned int height ); + RasterizingTask( SvgVisual* svgRenderer, VectorImageRenderer vectorRenderer, const VisualUrl& url, float dpi, unsigned int width, unsigned int height, bool loaded ); /** * Destructor. @@ -79,7 +78,7 @@ public: /** * Do the rasterization with the mRasterizer. */ - void Rasterize( ); + void Rasterize(); /** * Get the svg visual @@ -93,10 +92,15 @@ public: PixelData GetPixelData() const; /** - * Get the parsed data. - * @return parsed image data. + * Get the VectorRenderer. + * @return VectorRenderer. */ - NSVGimage* GetParsedImage() const; + VectorImageRenderer GetVectorRenderer() const; + /** + * Whether the resource is loaded. + * @return True if the resource is loaded. + */ + bool IsLoaded() const; /** * Load svg file @@ -112,13 +116,13 @@ private: private: SvgVisualPtr mSvgVisual; - NSVGimage* mParsedSvg; + VectorImageRenderer mVectorRenderer; VisualUrl mUrl; PixelData mPixelData; float mDpi; unsigned int mWidth; unsigned int mHeight; - NSVGrasterizer* mRasterizer; + bool mLoaded; }; /** @@ -166,11 +170,11 @@ public: /** * Delete the parsed SVG image, called by main thread. * - * The parsed svg should be delelted in worker thread, as the main thread does not know whether a rasterization of this svg is ongoing. + * The parsed svg should be deleted in worker thread, as the main thread does not know whether a rasterization of this svg is ongoing. * - * @param[in] parsedImage The image to be deleted + * @param[in] VectorImage The image to be deleted */ - void DeleteImage( NSVGimage* parsedSvg ); + void DeleteImage( VectorImageRenderer vectorImage ); private: @@ -214,12 +218,12 @@ private: std::vector mRasterizeTasks; //The queue of the tasks waiting to rasterize the SVG image std::vector mCompletedTasks; //The queue of the tasks with the SVG rasterization completed - Vector mDeleteSvg; //The images that the event thread requested to delete + Vector mDeleteSvg; //The images that the event thread requested to delete ConditionalWait mConditionalWait; Dali::Mutex mMutex; - EventThreadCallback* mTrigger; - + std::unique_ptr< EventThreadCallback > mTrigger; + const Dali::LogFactoryInterface& mLogFactory; bool mIsThreadWaiting; };