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=0204befb124d9b5e1017efb1fdce98e9246dcf6d;hp=705d41140ff48e695845e68c6a1ccbe9ae2b6180;hb=7018f61b640b6fcf9cb576b537bafcb6bb8240e8;hpb=4be24b21c2acd28b5b14795afe57acbfdfd282ac diff --git a/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h b/dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h index 705d411..0204bef 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) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -19,17 +19,17 @@ // EXTERNAL INCLUDES #include +#include #include #include #include -#include +#include +#include #include #include +#include #include #include -#include -#include -#include #include // INTERNAL INCLUDES @@ -37,17 +37,14 @@ namespace Dali { - namespace Toolkit { - namespace Internal { - class SvgVisual; -typedef IntrusivePtr< SvgVisual > SvgVisualPtr; +typedef IntrusivePtr SvgVisualPtr; class RasterizingTask; -typedef IntrusivePtr< RasterizingTask > RasterizingTaskPtr; +typedef IntrusivePtr RasterizingTaskPtr; /** * The svg rasterizing tasks to be processed in the worker thread. @@ -67,9 +64,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. @@ -110,20 +106,20 @@ public: private: // Undefined - RasterizingTask( const RasterizingTask& task ); + RasterizingTask(const RasterizingTask& task); // Undefined - RasterizingTask& operator=( const RasterizingTask& task ); + RasterizingTask& operator=(const RasterizingTask& task); private: - SvgVisualPtr mSvgVisual; + SvgVisualPtr mSvgVisual; VectorImageRenderer mVectorRenderer; - VisualUrl mUrl; - PixelData mPixelData; - float mDpi; - unsigned int mWidth; - unsigned int mHeight; - bool mLoaded; + VisualUrl mUrl; + PixelData mPixelData; + float mDpi; + unsigned int mWidth; + unsigned int mHeight; + bool mLoadSuccess; }; /** @@ -132,7 +128,6 @@ private: class SvgRasterizeThread : public Thread, Integration::Processor { public: - /** * Constructor. * @@ -143,14 +138,14 @@ public: /** * Terminate the svg rasterize thread, join and delete. */ - static void TerminateThread( SvgRasterizeThread*& thread ); + static void TerminateThread(SvgRasterizeThread*& thread); /** * Add a rasterization task into the waiting queue, called by main thread. * * @param[in] task The task added to the queue. */ - void AddTask( RasterizingTaskPtr task ); + void AddTask(RasterizingTaskPtr task); /** * Pop the next task out from the completed queue, called by main thread. @@ -166,24 +161,14 @@ public: * * @param[in] visual The visual pointer. */ - void RemoveTask( SvgVisual* visual ); + void RemoveTask(SvgVisual* visual); /** - * 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 ); - - /** * @copydoc Dali::Integration::Processor::Process() */ - void Process() override; + void Process(bool postProcessor) override; private: - /** * Pop the next task out from the queue. * @@ -196,7 +181,7 @@ private: * * @param[in] task The task added to the queue. */ - void AddCompletedTask( RasterizingTaskPtr task ); + void AddCompletedTask(RasterizingTaskPtr task); /** * Applies the rasterized image to material @@ -210,13 +195,11 @@ private: void UnregisterProcessor(); protected: - /** * Destructor. */ ~SvgRasterizeThread() override; - /** * The entry function of the worker thread. * It fetches task from the Queue, rasterizes the image and apply to the renderer. @@ -224,25 +207,22 @@ protected: void Run() override; private: - // Undefined - SvgRasterizeThread( const SvgRasterizeThread& thread ); + SvgRasterizeThread(const SvgRasterizeThread& thread); // Undefined - SvgRasterizeThread& operator=( const SvgRasterizeThread& thread ); + SvgRasterizeThread& operator=(const SvgRasterizeThread& thread); 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 - - ConditionalWait mConditionalWait; - Dali::Mutex mMutex; - std::unique_ptr< EventThreadCallback > mTrigger; - const Dali::LogFactoryInterface& mLogFactory; - bool mIsThreadWaiting; - bool mProcessorRegistered; + 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 + + ConditionalWait mConditionalWait; + Dali::Mutex mMutex; + std::unique_ptr mTrigger; + const Dali::LogFactoryInterface& mLogFactory; + bool mIsThreadWaiting; + bool mProcessorRegistered; }; } // namespace Internal