Fix color blending in 16-bit 5-5-5 mode
Jeffrey Pfau jeffrey@endrift.com
Thu, 14 Nov 2013 23:09:13 -0800
1 files changed,
5 insertions(+),
11 deletions(-)
M
src/gba/renderers/video-software.c
→
src/gba/renderers/video-software.c
@@ -1531,32 +1531,26 @@ b = colorB & ~0x7C0;
a |= (colorA & 0x7C0) << 16; b |= (colorB & 0x7C0) << 16; c |= ((a * weightA + b * weightB) / 16); - if (c & 0x0020) { - c = (c & ~0x0020) | 0x001F; - } - if (c & 0x10000) { - c = (c & ~0x10000) | 0xF800; - } if (c & 0x08000000) { c = (c & 0x08000000) | 0x07C00000; } - c = (c & 0xFFFF) | (c >> 16); #else a = colorA & ~0x3E0; b = colorB & ~0x3E0; a |= (colorA & 0x3E0) << 16; b |= (colorB & 0x3E0) << 16; c |= ((a * weightA + b * weightB) / 16); + if (c & 0x04000000) { + c = (c & 0x04000000) | 0x03E00000; + } +#endif if (c & 0x0020) { c = (c & ~0x0020) | 0x001F; } if (c & 0x10000) { c = (c & ~0x10000) | 0xF800; } - if (c & 0x04000000) { - c = (c & 0x04000000) | 0x03E00000; - } -#endif + c = (c & 0xFFFF) | (c >> 16); #else a = colorA & 0xF8; b = colorB & 0xF8;