Add LOTTIE_RASTER_THREAD option. 92/295092/2 accepted/tizen/unified/20230705.063708
authorjoogab.yun <joogab.yun@samsung.com>
Mon, 3 Jul 2023 02:10:01 +0000 (11:10 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Mon, 3 Jul 2023 02:36:28 +0000 (11:36 +0900)
If LOTTIE_RASTER_THREAD is off, threads are not used when rasterizing.

Change-Id: Id5069745a77768aeacc6145effa22a8eb1583314

CMakeLists.txt
cmake/config.h.in
meson.build
meson_options.txt
src/vector/vraster.cpp

index 38a986225bc8ddb853c79c2692dd61edcb7123ea..940a9e436e7a3596a9cc3571125e72dc24625934 100644 (file)
@@ -30,6 +30,7 @@ add_library(rlottie::rlottie ALIAS rlottie)
 
 option(LOTTIE_MODULE "Enable LOTTIE MODULE SUPPORT" ON)
 option(LOTTIE_THREAD "Enable LOTTIE THREAD SUPPORT" ON)
+option(LOTTIE_RASTER_THREAD "Enable LOTTIE RASTER THREAD SUPPORT" OFF)
 option(LOTTIE_CACHE "Enable LOTTIE CACHE SUPPORT" ON)
 option(LOTTIE_TEST "Build LOTTIE AUTOTESTS" OFF)
 option(LOTTIE_CCACHE "Enable LOTTIE ccache SUPPORT" OFF)
index ca42a9e1d407e08ba2256cdfb274d5a903fbe07a..e4c0c3edec0df996b56253f6e8c917739a071c24 100644 (file)
@@ -17,3 +17,9 @@
 #ifdef LOTTIE_CACHE
 #define LOTTIE_CACHE_SUPPORT
 #endif
+
+#cmakedefine LOTTIE_RASTER_THREAD
+
+#ifdef LOTTIE_RASTER_THREAD
+#define LOTTIE_RASTER_THREAD_SUPPORT
+#endif
index 50404c58679ab3142dac1c286020a00a39d02f5e..46b1ec4c864692504d49fd1c5b8362ff78c8fa02 100644 (file)
@@ -18,6 +18,10 @@ if get_option('thread') == true
     config_h.set10('LOTTIE_THREAD_SUPPORT', true)
 endif
 
+if get_option('raster_thread') == true
+  config_h.set10('LOTTIE_RASTER_THREAD_SUPPORT', true)
+endif
+
 if get_option('module') == true
     config_h.set10('LOTTIE_IMAGE_MODULE_SUPPORT', true)
 
@@ -116,6 +120,3 @@ Summary:
     )
 
 message(summary)
-
-
-
index c81dfbc4f4e92a5986943638013a9241cfd15344..acc79d218dabf40f4a29a2bf17bfae6142ece5f4 100644 (file)
@@ -3,6 +3,11 @@ option('thread',
    value: true,
    description: 'Enable threading in rlottie')
 
+option('raster_thread',
+   type: 'boolean',
+   value: false,
+   description: 'Enable raster threading in rlottie')
+
 option('cache',
    type: 'boolean',
    value: true,
@@ -41,6 +46,3 @@ option('cmake',
   type: 'boolean',
   value: false,
   description: 'Enable Generating  CMake config files')
-
-
-
index 8ef7b57132593d011a135ce2520efd06131f96bb..e52f27dca5d0ba86a3b34388878468d8bc1df34f 100644 (file)
@@ -415,7 +415,7 @@ struct VRleTask {
 
 using VTask = std::shared_ptr<VRleTask>;
 
-#ifdef LOTTIE_THREAD_SUPPORT
+#if defined(LOTTIE_THREAD_SUPPORT) && defined(LOTTIE_RASTER_THREAD_SUPPORT)
 
 #include <thread>
 #include "vtaskqueue.h"
@@ -534,7 +534,13 @@ public:
 
     ~RleTaskScheduler() { SW_FT_Stroker_Done(stroker); }
 
-    void process(VTask task) { (*task)(outlineRef, stroker); }
+    void process(VTask task)
+    {
+        std::lock_guard<std::mutex> lock(mMutex);
+        (*task)(outlineRef, stroker);
+    }
+private:
+    std::mutex              mMutex;
 };
 #endif