mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
wasm: Enhance gif saving without data copy
Removed data copy for gif saving. Binding function `save` has changed: - bool save(string data, string mimetype)
This commit is contained in:
parent
a5dc165fa8
commit
a85470b5d5
1 changed files with 3 additions and 7 deletions
|
@ -230,9 +230,6 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: remove this copy, save with a file passing.
|
|
||||||
this->data = data; //back up for saving
|
|
||||||
|
|
||||||
canvas->clear(true);
|
canvas->clear(true);
|
||||||
|
|
||||||
delete(animation);
|
delete(animation);
|
||||||
|
@ -350,15 +347,15 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saver methods
|
// Saver methods
|
||||||
bool save(string mimetype)
|
bool save(string data, string mimetype)
|
||||||
{
|
{
|
||||||
if (mimetype == "gif") return save2Gif();
|
if (mimetype == "gif") return save2Gif(data);
|
||||||
|
|
||||||
errorMsg = "Invalid mimetype";
|
errorMsg = "Invalid mimetype";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool save2Gif()
|
bool save2Gif(string data)
|
||||||
{
|
{
|
||||||
errorMsg = NoError;
|
errorMsg = NoError;
|
||||||
|
|
||||||
|
@ -427,7 +424,6 @@ private:
|
||||||
Canvas* canvas = nullptr;
|
Canvas* canvas = nullptr;
|
||||||
Animation* animation = nullptr;
|
Animation* animation = nullptr;
|
||||||
TvgEngineMethod* engine = nullptr;
|
TvgEngineMethod* engine = nullptr;
|
||||||
string data;
|
|
||||||
uint32_t width = 0;
|
uint32_t width = 0;
|
||||||
uint32_t height = 0;
|
uint32_t height = 0;
|
||||||
float psize[2]; //picture size
|
float psize[2]; //picture size
|
||||||
|
|
Loading…
Add table
Reference in a new issue