diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-09-19 15:39:00 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-09-19 15:39:00 +0200 |
commit | 62405cde0a9d15842ce2ceab54f940219051e71b (patch) | |
tree | 8fc79e156208a2f95bce2aa48deddb9269c168f9 | |
parent | 8d79355f2e72f5a4af66b0b97631e384926074ce (diff) |
change final framebuffer format (again. sorry.) to xRGB, more compatible
-rw-r--r-- | src/GPU2D.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp index 45d768f..7550562 100644 --- a/src/GPU2D.cpp +++ b/src/GPU2D.cpp @@ -608,11 +608,20 @@ void GPU2D::DrawScanline(u32 line) } } - // convert to 32-bit RGBA + // convert to 32-bit BGRA + // note: 32-bit RGBA would be more straightforward, but + // BGRA seems to be more compatible (Direct2D soft, cairo...) for (int i = 0; i < 256; i++) - dst[i] = ((dst[i] & 0x003F3F3F) << 2) | - ((dst[i] & 0x00303030) >> 4) | - 0xFF000000; + { + u32 c = dst[i]; + + u32 r = c << 18; + u32 g = (c << 2) & 0xFC00; + u32 b = (c >> 14) & 0xFC; + c = r | g | b; + + dst[i] = c | ((c & 0x00C0C0C0) >> 6) | 0xFF000000; + } } void GPU2D::VBlank() |