mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 04:24:28 +00:00
png_loader(static): Move the colortype check code to open()
This commit is contained in:
parent
02613feac3
commit
50da80573d
1 changed files with 4 additions and 2 deletions
|
@ -125,6 +125,8 @@ bool PngLoader::open(const string& path)
|
||||||
h = static_cast<float>(height);
|
h = static_cast<float>(height);
|
||||||
ret = true;
|
ret = true;
|
||||||
|
|
||||||
|
if (state.info_png.color.colortype == LCT_RGBA) colorSpace = SwCanvas::ABGR8888;
|
||||||
|
|
||||||
goto finalize;
|
goto finalize;
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
|
@ -159,6 +161,8 @@ bool PngLoader::open(const char* data, uint32_t size, bool copy)
|
||||||
h = static_cast<float>(height);
|
h = static_cast<float>(height);
|
||||||
this->size = size;
|
this->size = size;
|
||||||
|
|
||||||
|
if (state.info_png.color.colortype == LCT_RGBA) colorSpace = SwCanvas::ABGR8888;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +217,5 @@ void PngLoader::run(unsigned tid)
|
||||||
|
|
||||||
lodepng_decode(&image, &width, &height, &state, data, size);
|
lodepng_decode(&image, &width, &height, &state, data, size);
|
||||||
|
|
||||||
if (state.info_png.color.colortype == LCT_RGBA) colorSpace = SwCanvas::ABGR8888;
|
|
||||||
|
|
||||||
_premultiply((uint32_t*)(image), width, height);
|
_premultiply((uint32_t*)(image), width, height);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue