From 2d2928652b61754bae2735c8f37f47c74221428c 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 40916685..fb26ce13 100644 --- a/inc/thorvg.h +++ b/inc/thorvg.h @@ -1648,8 +1648,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 e372e436..3b1d54b0 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; }