From 914621ebdebb0a199f4c147e1df967c5621661f1 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 442d06cf..a896293e 100644 --- a/inc/thorvg.h +++ b/inc/thorvg.h @@ -1664,8 +1664,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 659410d4..4bac1ec5 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; }