[librptexture] Qoi: qoi.h has the R and B channels swapped compared to what rp_image expects.

This was broken since support for Qoi was added in v2.5. Not sure why
I didn't notice it until now...

Affects: v2.4 - v2.5
This commit is contained in:
David Korth 2025-06-16 00:51:54 -04:00
parent c3643b9244
commit f0ee7bee10
2 changed files with 10 additions and 1 deletions

View File

@ -33,6 +33,8 @@
empty data as a PNG image. (Needs more debugging for a proper fix...)
* See #451: libpng errors crash due to libpng setjmp/longjmp (Windows 10, release builds only)
* Reported by @Masamune3210.
* Qoi: R/B channels were incorrectly swapped when this was first added in v2.5.
* Affects: v2.5 - v2.5.1
* Other changes:
* rpcli: Added more colorization for warning messages.

View File

@ -162,7 +162,14 @@ rp_image_const_ptr QoiPrivate::loadImage(void)
px_src += src_stride;
}
free(pixels);
// NOTE: qoi.h has the R and B channels swapped compared to what rp_image expects.
int ret = tmp_img->swizzle("bgra");
if (ret != 0) {
// Swizzle failed.
return {};
}
img.reset(tmp_img);
return img;
}