From 44ca908c6d93557c7621c40c4044b05ef773cb65 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Thu, 28 Feb 2019 23:28:25 +0100 Subject: [PATCH] disable multithread on iOS --- src/canvas.cpp | 34 ++++++++++++++++++++++++++++++++++ src/node_stroke_preview.cpp | 4 ++++ 2 files changed, 38 insertions(+) diff --git a/src/canvas.cpp b/src/canvas.cpp index 05749f4..9730058 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -1176,6 +1176,10 @@ void Canvas::clear_context() void Canvas::import_equirectangular(std::string file_path) { +#if __IOS__ + import_equirectangular_thread(file_path); + return; +#endif std::thread t(&Canvas::import_equirectangular_thread, this, file_path); t.detach(); } @@ -1249,6 +1253,12 @@ void Canvas::export_equirectangular(std::string file_path, std::function { if (App::I.check_license()) { +#if __IOS__ + export_equirectangular_thread(file_path); + if (on_complete) + on_complete(); + return; +#endif std::thread t([=] { export_equirectangular_thread(file_path); if (on_complete) @@ -1553,6 +1563,12 @@ void Canvas::export_layers(std::string file_name, std::function on_compl { if (App::I.check_license()) { +#if __IOS__ + export_layers_thread(file_name); + if (on_complete) + on_complete(); + return; +#endif std::thread t([=] { export_layers_thread(file_name); if (on_complete) @@ -1808,6 +1824,12 @@ void Canvas::project_save(std::function on_complete) { if (App::I.check_license()) { +#if __IOS__ + bool ret = project_save_thread(App::I.doc_path); + if (on_complete) + on_complete(ret); + return; +#endif std::thread t([=] { bool ret = project_save_thread(App::I.doc_path); if (on_complete) @@ -1822,6 +1844,12 @@ void Canvas::project_save(std::string file_path, std::function on_co LOG("saving %s", file_path.c_str()); if (App::I.check_license()) { +#if __IOS__ + bool ret = project_save_thread(file_path); + if (on_complete) + on_complete(ret); + return; +#endif std::thread t([=] { bool ret = project_save_thread(file_path); if (on_complete) @@ -2018,6 +2046,12 @@ bool Canvas::project_save_thread(std::string file_path) void Canvas::project_open(std::string file_path, std::function on_complete) { +#if __IOS__ + bool ret = project_open_thread(file_path); + if (on_complete) + on_complete(ret); + return; +#endif std::thread t([=] { bool result = project_open_thread(file_path); if (on_complete) diff --git a/src/node_stroke_preview.cpp b/src/node_stroke_preview.cpp index 9ba92b0..3a7b30e 100644 --- a/src/node_stroke_preview.cpp +++ b/src/node_stroke_preview.cpp @@ -477,6 +477,10 @@ void NodeStrokePreview::draw_stroke() { if (m_size.x == 0 || m_size.y == 0) return; +#if __IOS__ + draw_stroke_immediate(); + return; +#endif s_queue.mutex.lock(); if (!s_running) {