mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
examples: fixing the crash for disabled loaders
ImageScaleUp/ImageScaleDown fixed.
This commit is contained in:
parent
4082a13527
commit
5bc6f4881a
2 changed files with 14 additions and 8 deletions
|
@ -35,16 +35,19 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
|||
|
||||
//Original
|
||||
auto picture = tvg::Picture::gen();
|
||||
pPicture = picture.get();
|
||||
|
||||
if (picture->load(EXAMPLE_DIR"/scaledown.png") == tvg::Result::Success) {
|
||||
if (canvas->push(move(picture)) != tvg::Result::Success) return;
|
||||
if (picture->load(EXAMPLE_DIR"/scaledown.png") != tvg::Result::Success) {
|
||||
cout << "The PNG file is not loaded correctly. Did you enable PNG Loader?" << endl;
|
||||
return;
|
||||
}
|
||||
if (canvas->push(move(picture)) == tvg::Result::Success) {
|
||||
pPicture = picture.get();
|
||||
}
|
||||
}
|
||||
|
||||
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||
{
|
||||
if (!canvas) return;
|
||||
if (!canvas || !pPicture) return;
|
||||
|
||||
auto scale = 1.0f;
|
||||
|
||||
|
|
|
@ -35,16 +35,19 @@ void tvgDrawCmds(tvg::Canvas* canvas)
|
|||
|
||||
//Original
|
||||
auto picture = tvg::Picture::gen();
|
||||
pPicture = picture.get();
|
||||
|
||||
if (picture->load(EXAMPLE_DIR"/scaleup.png") == tvg::Result::Success) {
|
||||
if (canvas->push(move(picture)) != tvg::Result::Success) return;
|
||||
if (picture->load(EXAMPLE_DIR"/scaleup.png") != tvg::Result::Success) {
|
||||
cout << "The PNG file is not loaded correctly. Did you enable PNG Loader?" << endl;
|
||||
return;
|
||||
}
|
||||
if (canvas->push(move(picture)) == tvg::Result::Success) {
|
||||
pPicture = picture.get();
|
||||
}
|
||||
}
|
||||
|
||||
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
|
||||
{
|
||||
if (!canvas) return;
|
||||
if (!canvas || !pPicture) return;
|
||||
|
||||
auto scale = 1.0f;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue