fix rgb order
[saturn.git] / vdp1_to_png.c
index 6b62437..3d1da46 100644 (file)
@@ -33,9 +33,9 @@ static int writepng(const char *fname, const unsigned short *src)
                row_pointers[i] = dst;
                for (j = 0; j < WIDTH; j++, src++, dst += 3) {
                        unsigned short v = (*src >> 8) | (*src << 8);
-                       dst[0] = (v & 0x7c00) >> 7;
-                       dst[1] = (v & 0x03e0) >> 2;
-                       dst[2] = (v & 0x001f) << 3;
+                       dst[0] = (v & 0x001f) << 3; // r
+                       dst[1] = (v & 0x03e0) >> 2; // g
+                       dst[2] = (v & 0x7c00) >> 7; // b
                }
        }