all repos — mgba @ d85548ac181988e544adc84c869bdbf0009930c0

mGBA Game Boy Advance Emulator

Util: Fix PowerPC PNG read/write pixel order
Jeffrey Pfau jeffrey@endrift.com
Tue, 15 Sep 2015 00:16:06 -0700
commit

d85548ac181988e544adc84c869bdbf0009930c0

parent

19b81a21634c6fccac226a14b03c63ea66a96e5b

2 files changed, 14 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -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.csrc/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);