mirror of https://github.com/mgba-emu/mgba.git
Fix color blending in 16-bit 5-5-5 mode
This commit is contained in:
parent
55c6103116
commit
0bc5c4a69e
|
@ -1531,32 +1531,26 @@ static unsigned _mix(int weightA, unsigned colorA, int weightB, unsigned colorB)
|
||||||
a |= (colorA & 0x7C0) << 16;
|
a |= (colorA & 0x7C0) << 16;
|
||||||
b |= (colorB & 0x7C0) << 16;
|
b |= (colorB & 0x7C0) << 16;
|
||||||
c |= ((a * weightA + b * weightB) / 16);
|
c |= ((a * weightA + b * weightB) / 16);
|
||||||
if (c & 0x0020) {
|
|
||||||
c = (c & ~0x0020) | 0x001F;
|
|
||||||
}
|
|
||||||
if (c & 0x10000) {
|
|
||||||
c = (c & ~0x10000) | 0xF800;
|
|
||||||
}
|
|
||||||
if (c & 0x08000000) {
|
if (c & 0x08000000) {
|
||||||
c = (c & 0x08000000) | 0x07C00000;
|
c = (c & 0x08000000) | 0x07C00000;
|
||||||
}
|
}
|
||||||
c = (c & 0xFFFF) | (c >> 16);
|
|
||||||
#else
|
#else
|
||||||
a = colorA & ~0x3E0;
|
a = colorA & ~0x3E0;
|
||||||
b = colorB & ~0x3E0;
|
b = colorB & ~0x3E0;
|
||||||
a |= (colorA & 0x3E0) << 16;
|
a |= (colorA & 0x3E0) << 16;
|
||||||
b |= (colorB & 0x3E0) << 16;
|
b |= (colorB & 0x3E0) << 16;
|
||||||
c |= ((a * weightA + b * weightB) / 16);
|
c |= ((a * weightA + b * weightB) / 16);
|
||||||
|
if (c & 0x04000000) {
|
||||||
|
c = (c & 0x04000000) | 0x03E00000;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (c & 0x0020) {
|
if (c & 0x0020) {
|
||||||
c = (c & ~0x0020) | 0x001F;
|
c = (c & ~0x0020) | 0x001F;
|
||||||
}
|
}
|
||||||
if (c & 0x10000) {
|
if (c & 0x10000) {
|
||||||
c = (c & ~0x10000) | 0xF800;
|
c = (c & ~0x10000) | 0xF800;
|
||||||
}
|
}
|
||||||
if (c & 0x04000000) {
|
c = (c & 0xFFFF) | (c >> 16);
|
||||||
c = (c & 0x04000000) | 0x03E00000;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
a = colorA & 0xF8;
|
a = colorA & 0xF8;
|
||||||
b = colorB & 0xF8;
|
b = colorB & 0xF8;
|
||||||
|
|
Loading…
Reference in New Issue