qoi: Added support for image of channels 3 (#4384)

This commit is contained in:
R-YaTian 2024-10-16 01:03:17 +08:00 committed by GitHub
parent 99ff770edc
commit 8d267aaf23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -506,10 +506,10 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
if (fileData != NULL) if (fileData != NULL)
{ {
qoi_desc desc = { 0 }; qoi_desc desc = { 0 };
image.data = qoi_decode(fileData, dataSize, &desc, 4); image.data = qoi_decode(fileData, dataSize, &desc, (int) fileData[12]);
image.width = desc.width; image.width = desc.width;
image.height = desc.height; image.height = desc.height;
image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8; image.format = desc.channels == 4 ? PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 : PIXELFORMAT_UNCOMPRESSED_R8G8B8;
image.mipmaps = 1; image.mipmaps = 1;
} }
} }