From a85470b5d53339c988311c38ab858740faf9c03e Mon Sep 17 00:00:00 2001 From: Jinny You Date: Mon, 18 Nov 2024 13:31:44 +0900 Subject: [PATCH] wasm: Enhance gif saving without data copy Removed data copy for gif saving. Binding function `save` has changed: - bool save(string data, string mimetype) --- src/bindings/wasm/tvgWasmLottieAnimation.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/bindings/wasm/tvgWasmLottieAnimation.cpp b/src/bindings/wasm/tvgWasmLottieAnimation.cpp index 33b09e13..e0447ed6 100644 --- a/src/bindings/wasm/tvgWasmLottieAnimation.cpp +++ b/src/bindings/wasm/tvgWasmLottieAnimation.cpp @@ -230,9 +230,6 @@ public: return false; } - //FIXME: remove this copy, save with a file passing. - this->data = data; //back up for saving - canvas->clear(true); delete(animation); @@ -350,15 +347,15 @@ public: } // Saver methods - bool save(string mimetype) + bool save(string data, string mimetype) { - if (mimetype == "gif") return save2Gif(); + if (mimetype == "gif") return save2Gif(data); errorMsg = "Invalid mimetype"; return false; } - bool save2Gif() + bool save2Gif(string data) { errorMsg = NoError; @@ -427,7 +424,6 @@ private: Canvas* canvas = nullptr; Animation* animation = nullptr; TvgEngineMethod* engine = nullptr; - string data; uint32_t width = 0; uint32_t height = 0; float psize[2]; //picture size