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=5c8b323e37af613c86bc429694fa1ecfd847f083;hp=b7bdbfd0e6bacc530c666f1e25f9b60a5e4bd345;hb=bb764a75b719ea839f4c255ab015b8fa54fd8039;hpb=4cc02f3e2045755c2c65e64a6f5e126a4c6208ea diff --git a/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h b/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h index b7bdbfd..5c8b323 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) 2019 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. @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -30,8 +29,13 @@ #include #include +#ifdef NO_THORVG struct NSVGimage; struct NSVGrasterizer; +#else /* NO_THORVG */ +#include +#include +#endif /* NO_THORVG */ namespace Dali { @@ -59,6 +63,7 @@ typedef IntrusivePtr< RasterizingTask > RasterizingTaskPtr; class RasterizingTask : public RefObject { public: +#ifdef NO_THORVG /** * Constructor * @@ -71,11 +76,22 @@ public: * @param[in] height The rasterization height. */ RasterizingTask( SvgVisual* svgRenderer, NSVGimage* parsedSvg, const VisualUrl& url, float dpi, unsigned int width, unsigned int height ); +#else /* NO_THORVG */ + /** + * Constructor + * @param[in] svgRenderer The renderer which the rasterized image to be applied. + * @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 ); +#endif /* NO_THORVG */ /** * Destructor. */ - ~RasterizingTask(); + ~RasterizingTask() override; /** * Do the rasterization with the mRasterizer. @@ -93,11 +109,31 @@ public: */ PixelData GetPixelData() const; +#ifdef NO_THORVG /** * Get the parsed data. * @return parsed image data. */ NSVGimage* GetParsedImage() const; + /** + * Get default size of svg + * + * @param[out] width The default width of svg + * @param[out] height The default height of svg + */ + void GetDefaultSize( uint32_t& width, uint32_t& height ) const; +#else /* NO_THORVG */ + /** + * Get the VectorRenderer. + * @return VectorRenderer. + */ + VectorImageRenderer GetVectorRenderer() const; + /** + * Whether the resource is loaded. + * @return True if the resource is loaded. + */ + bool IsLoaded() const; +#endif /* NO_THORVG */ /** * Load svg file @@ -113,13 +149,21 @@ private: private: SvgVisualPtr mSvgVisual; +#ifdef NO_THORVG NSVGimage* mParsedSvg; +#else /* NO_THORVG */ + VectorImageRenderer mVectorRenderer; +#endif /* NO_THORVG */ VisualUrl mUrl; PixelData mPixelData; float mDpi; unsigned int mWidth; unsigned int mHeight; +#ifdef NO_THORVG NSVGrasterizer* mRasterizer; +#else /* NO_THORVG */ + bool mLoaded; +#endif /* NO_THORVG */ }; /** @@ -164,14 +208,25 @@ public: */ void RemoveTask( SvgVisual* visual ); +#ifdef NO_THORVG /** * 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 */ void DeleteImage( NSVGimage* parsedSvg ); +#else /* NO_THORVG */ + /** + * Delete the parsed SVG image, called by main thread. + * + * 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] VectorImage The image to be deleted + */ + void DeleteImage( VectorImageRenderer vectorImage ); +#endif /* NO_THORVG */ private: @@ -194,7 +249,7 @@ protected: /** * Destructor. */ - virtual ~SvgRasterizeThread(); + ~SvgRasterizeThread() override; /** @@ -215,7 +270,11 @@ 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 +#ifdef NO_THORVG Vector mDeleteSvg; //The images that the event thread requested to delete +#else /* NO_THORVG */ + Vector mDeleteSvg; //The images that the event thread requested to delete +#endif /* NO_THORVG */ ConditionalWait mConditionalWait; Dali::Mutex mMutex;