From 22c36b7069cb78ae2f554dd17771d4f54a72d059 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 31 Oct 2023 10:46:10 +0900 Subject: [PATCH] wasm: fix a regression bug. The Animation::frame() method has been modified. It will now return InsufficientCondition, if the frame value is the same as the previous one. In addition to this change, we have also updated its usage accordingly. --- inc/thorvg.h | 4 ++-- src/bindings/wasm/tvgWasm.cpp | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/inc/thorvg.h b/inc/thorvg.h index b2027467..3e5c18df 100644 --- a/inc/thorvg.h +++ b/inc/thorvg.h @@ -1701,8 +1701,8 @@ public: * @param[in] no The index of the animation frame to be displayed. The index should be less than the totalFrame(). * * @retval Result::Success Successfully set the frame. - * @retval Result::InsufficientCondition No animatable data loaded from the Picture. - * @retval Result::NonSupport The Picture data does not support animations. + * @retval Result::InsufficientCondition if the given @p no is the same as the current frame value. + * @retval Result::NonSupport The current Picture data does not support animations. * * @see totalFrame() * diff --git a/src/bindings/wasm/tvgWasm.cpp b/src/bindings/wasm/tvgWasm.cpp index a5fe71be..a57a03de 100644 --- a/src/bindings/wasm/tvgWasm.cpp +++ b/src/bindings/wasm/tvgWasm.cpp @@ -152,13 +152,9 @@ public: bool frame(float no) { if (!canvas || !animation) return false; - if (animation->frame(no) != Result::Success) { - errorMsg = "frame() fail"; - return false; + if (animation->frame(no) == Result::Success) { + updated = true; } - - updated = true; - return true; }