From 8c4197a8a5e8b825c4ffd8f7d41b21b43a8e22ab Mon Sep 17 00:00:00 2001 From: Michal Maciola Date: Wed, 8 Sep 2021 17:33:17 +0200 Subject: [PATCH] wasm: add force parameter for update() function --- src/wasm/thorvgwasm.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/wasm/thorvgwasm.cpp b/src/wasm/thorvgwasm.cpp index f58c1c3c..d0f01866 100644 --- a/src/wasm/thorvgwasm.cpp +++ b/src/wasm/thorvgwasm.cpp @@ -90,32 +90,26 @@ public: return true; } - void update(int width, int height) + bool update(int width, int height, bool force) { mErrorMsg = "None"; - if (!mSwCanvas) { - mErrorMsg = "Canvas is NULL"; - return; + if (!mSwCanvas || !mPicture) { + mErrorMsg = "Invalid Conditions"; + return false; } - if (!mPicture) { - mErrorMsg = "Picture is NULL"; - return; - } - - if (mWidth == width && mHeight == height) { - return; + if (!force && mWidth == width && mHeight == height) { + return true; } updateSize(width, height); if (mSwCanvas->update(mPicture) != Result::Success) { mErrorMsg = "Update failed"; - return; + return false; } - - return; + return true; } val render()