mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
thorvg viewer: fix scale problem
If viewer calls load() with a data which does not have size changes of both viewbox and canvas, then load() does not set a scale value. This makes incorrect result on viewer side. So thorvg wasm should set a scale value, whenever load() is called.
This commit is contained in:
parent
acac884257
commit
cc81e46343
1 changed files with 1 additions and 8 deletions
|
@ -28,7 +28,6 @@ public:
|
|||
|
||||
bool load(string data, int width, int height)
|
||||
{
|
||||
uint32_t pw, ph;
|
||||
float w, h;
|
||||
|
||||
mErrorMsg = "None";
|
||||
|
@ -60,16 +59,10 @@ public:
|
|||
|
||||
/* get default size */
|
||||
mPicture->viewbox(nullptr, nullptr, &w, &h);
|
||||
|
||||
pw = mDefaultWidth;
|
||||
ph = mDefaultHeight;
|
||||
mDefaultWidth = static_cast<uint32_t>(w);
|
||||
mDefaultHeight = static_cast<uint32_t>(h);
|
||||
|
||||
if (pw != mDefaultWidth || ph != mDefaultHeight) {
|
||||
updateScale();
|
||||
}
|
||||
|
||||
updateSize(width, height);
|
||||
|
||||
if (mSwCanvas->push(unique_ptr<Picture>(mPicture)) != Result::Success) {
|
||||
|
|
Loading…
Add table
Reference in a new issue