summaryrefslogtreecommitdiffhomepage
path: root/src/rtextures.c
diff options
context:
space:
mode:
authorRay <[email protected]>2021-11-28 01:22:56 +0100
committerRay <[email protected]>2021-11-28 01:22:56 +0100
commitd1b8d4f2c7867f1c673c0a44925b59f6a012f8ba (patch)
treeda33cc8887274c6b5db6731180dd330d13df78a6 /src/rtextures.c
parent71f2e2b1e4f86b769f3ba62fcc0217d06a5dee11 (diff)
downloadraylib-d1b8d4f2c7867f1c673c0a44925b59f6a012f8ba.tar.gz
raylib-d1b8d4f2c7867f1c673c0a44925b59f6a012f8ba.zip
REVIEWED: Updated QOI to first official release
Diffstat (limited to 'src/rtextures.c')
-rw-r--r--src/rtextures.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rtextures.c b/src/rtextures.c
index 675cdc34..a5e2a551 100644
--- a/src/rtextures.c
+++ b/src/rtextures.c
@@ -375,7 +375,10 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
#if defined(SUPPORT_FILEFORMAT_QOI)
else if (TextIsEqual(fileExtLower, ".qoi"))
{
- image.data = qoi_decode(fileData, dataSize, &image.width, &image.height, 4);
+ qoi_desc desc = { 0 };
+ image.data = qoi_decode(fileData, dataSize, &desc, 4);
+ image.width = desc.width;
+ image.height = desc.height;
image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8;
image.mipmaps = 1;
}
@@ -505,7 +508,16 @@ bool ExportImage(Image image, const char *fileName)
else if (image.format == PIXELFORMAT_UNCOMPRESSED_R8G8B8A8) channels = 4;
else TRACELOG(LOG_WARNING, "IMAGE: Image pixel format must be R8G8B8 or R8G8B8A8");
- if ((channels == 3) || (channels == 4)) success = qoi_write(fileName, imgData, image.width, image.height, channels);
+ if ((channels == 3) || (channels == 4))
+ {
+ qoi_desc desc = { 0 };
+ desc.width = image.width;
+ desc.height = image.height;
+ desc.channels = channels;
+ desc.colorspace = QOI_SRGB;
+
+ success = qoi_write(fileName, imgData, &desc);
+ }
}
#endif
#if defined(SUPPORT_FILEFORMAT_KTX)