png_loader(static): Move the colortype check code to open()

This commit is contained in:
JunsuChoi 2023-02-10 13:46:06 +09:00 committed by Hermet Park
parent 02613feac3
commit 50da80573d

View file

@ -125,6 +125,8 @@ bool PngLoader::open(const string& path)
h = static_cast<float>(height);
ret = true;
if (state.info_png.color.colortype == LCT_RGBA) colorSpace = SwCanvas::ABGR8888;
goto finalize;
failure:
@ -159,6 +161,8 @@ bool PngLoader::open(const char* data, uint32_t size, bool copy)
h = static_cast<float>(height);
this->size = size;
if (state.info_png.color.colortype == LCT_RGBA) colorSpace = SwCanvas::ABGR8888;
return true;
}
@ -213,7 +217,5 @@ void PngLoader::run(unsigned tid)
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);
}