mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
lottie/loader: Corrected an issue with the return value when loading fails.
Previously, Picture::load(const char* data, uint32_t size, const std::string& mimeType, bool copy = false) would return 'Success' even when the data is invalid. This issue only occurred when the number of threads is set to 0.
This commit is contained in:
parent
042693ccfe
commit
4ba8ff1e11
1 changed files with 11 additions and 5 deletions
|
@ -66,10 +66,11 @@ void LottieLoader::run(unsigned tid)
|
||||||
builder->update(comp, frameNo);
|
builder->update(comp, frameNo);
|
||||||
//initial loading
|
//initial loading
|
||||||
} else {
|
} else {
|
||||||
LottieParser parser(content, dirName);
|
if (!comp) {
|
||||||
if (!parser.parse()) return;
|
LottieParser parser(content, dirName);
|
||||||
comp = parser.comp;
|
if (!parser.parse()) return;
|
||||||
if (!comp) return;
|
comp = parser.comp;
|
||||||
|
}
|
||||||
builder->build(comp);
|
builder->build(comp);
|
||||||
w = static_cast<float>(comp->w);
|
w = static_cast<float>(comp->w);
|
||||||
h = static_cast<float>(comp->h);
|
h = static_cast<float>(comp->h);
|
||||||
|
@ -104,7 +105,12 @@ LottieLoader::~LottieLoader()
|
||||||
bool LottieLoader::header()
|
bool LottieLoader::header()
|
||||||
{
|
{
|
||||||
//A single thread doesn't need to perform intensive tasks.
|
//A single thread doesn't need to perform intensive tasks.
|
||||||
if (TaskScheduler::threads() == 0) return true;
|
if (TaskScheduler::threads() == 0) {
|
||||||
|
LottieParser parser(content, dirName);
|
||||||
|
if (!parser.parse()) return false;
|
||||||
|
comp = parser.comp;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//Quickly validate the given Lottie file without parsing in order to get the animation info.
|
//Quickly validate the given Lottie file without parsing in order to get the animation info.
|
||||||
auto startFrame = 0.0f;
|
auto startFrame = 0.0f;
|
||||||
|
|
Loading…
Add table
Reference in a new issue