aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/GPU2D.cpp17
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()