mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
wasm: add force parameter for update() function
This commit is contained in:
parent
1ea9692841
commit
8c4197a8a5
1 changed files with 8 additions and 14 deletions
|
@ -90,32 +90,26 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(int width, int height)
|
bool update(int width, int height, bool force)
|
||||||
{
|
{
|
||||||
mErrorMsg = "None";
|
mErrorMsg = "None";
|
||||||
|
|
||||||
if (!mSwCanvas) {
|
if (!mSwCanvas || !mPicture) {
|
||||||
mErrorMsg = "Canvas is NULL";
|
mErrorMsg = "Invalid Conditions";
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mPicture) {
|
if (!force && mWidth == width && mHeight == height) {
|
||||||
mErrorMsg = "Picture is NULL";
|
return true;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mWidth == width && mHeight == height) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSize(width, height);
|
updateSize(width, height);
|
||||||
|
|
||||||
if (mSwCanvas->update(mPicture) != Result::Success) {
|
if (mSwCanvas->update(mPicture) != Result::Success) {
|
||||||
mErrorMsg = "Update failed";
|
mErrorMsg = "Update failed";
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val render()
|
val render()
|
||||||
|
|
Loading…
Add table
Reference in a new issue