wasm: add force parameter for update() function
authorMichal Maciola <m.maciola@samsung.com>
Wed, 8 Sep 2021 15:33:17 +0000 (17:33 +0200)
committerJunsuChoi <jsuya.choi@samsung.com>
Tue, 14 Sep 2021 01:14:27 +0000 (10:14 +0900)
src/wasm/thorvgwasm.cpp

index f58c1c3..d0f0186 100644 (file)
@@ -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 (!mPicture) {
-            mErrorMsg = "Picture is NULL";
-            return;
+        if (!mSwCanvas || !mPicture) {
+            mErrorMsg = "Invalid Conditions";
+            return false;
         }
 
-        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()