Util: Fix PowerPC PNG read/write pixel order
Jeffrey Pfau jeffrey@endrift.com
Tue, 15 Sep 2015 00:16:06 -0700
2 files changed,
14 insertions(+),
0 deletions(-)
M
CHANGES
→
CHANGES
@@ -11,6 +11,7 @@ - Libretro: Fix a memory leak with the render buffer
- GBA Audio: Fix 8-bit writes to audio channel 3 and 4 registers - GBA Audio: Fix audio channels being silenced at the wrong time - VFS: Fix return values of VFileFILE.read and .write + - Util: Fix PowerPC PNG read/write pixel order Misc: - Qt: Window size command line options are now supported - Qt: Increase usability of key mapper
M
src/util/png-io.c
→
src/util/png-io.c
@@ -65,9 +65,15 @@ unsigned i;
for (i = 0; i < height; ++i) { unsigned x; for (x = 0; x < width; ++x) { +#if defined(__POWERPC__) || defined(__PPC__) + row[x * 3] = pixelData[stride * i * 4 + x * 4 + 3]; + row[x * 3 + 1] = pixelData[stride * i * 4 + x * 4 + 2]; + row[x * 3 + 2] = pixelData[stride * i * 4 + x * 4 + 1]; +#else row[x * 3] = pixelData[stride * i * 4 + x * 4]; row[x * 3 + 1] = pixelData[stride * i * 4 + x * 4 + 1]; row[x * 3 + 2] = pixelData[stride * i * 4 + x * 4 + 2]; +#endif } png_write_row(png, row); }@@ -167,9 +173,16 @@ for (i = 0; i < pngHeight; ++i) {
png_read_row(png, row, 0); unsigned x; for (x = 0; x < pngWidth; ++x) { + +#if defined(__POWERPC__) || defined(__PPC__) + pixelData[stride * i * 4 + x * 4 + 3] = row[x * 3]; + pixelData[stride * i * 4 + x * 4 + 2] = row[x * 3 + 1]; + pixelData[stride * i * 4 + x * 4 + 1] = row[x * 3 + 2]; +#else pixelData[stride * i * 4 + x * 4] = row[x * 3]; pixelData[stride * i * 4 + x * 4 + 1] = row[x * 3 + 1]; pixelData[stride * i * 4 + x * 4 + 2] = row[x * 3 + 2]; +#endif } } free(row);