From 54e5cdee10ffa0dfe030206415aec1e631bc64c3 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Tue, 15 Dec 2020 17:16:33 +0900 Subject: [PATCH] wasm: update picture size for file loading The width and height was not changed, if there is newly loaded file. As a result, the scale was not correct after loading a file. --- src/wasm/thorvgwasm.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wasm/thorvgwasm.cpp b/src/wasm/thorvgwasm.cpp index fc2f7c15..7c8d34fe 100644 --- a/src/wasm/thorvgwasm.cpp +++ b/src/wasm/thorvgwasm.cpp @@ -55,6 +55,11 @@ public: return false; } + /* need to reset size to calculate scale in Picture.size internally + before calling updateSize */ + mWidth = 0; + mHeight = 0; + updateSize(width, height); if (mSwCanvas->push(unique_ptr(mPicture)) != Result::Success) {