IPHONE: Fix transparency with RGB cursors using a key color

This commit is contained in:
Thierry Crozat 2020-10-11 03:55:32 +01:00
parent 3fc7fc285e
commit d43d86f3c0

View file

@ -491,19 +491,17 @@ void OSystem_IPHONE::updateMouseTexture() {
} else {
if (crossBlit((byte *)mouseTexture.getPixels(), (const byte *)_mouseBuffer.getPixels(), mouseTexture.pitch,
_mouseBuffer.pitch, _mouseBuffer.w, _mouseBuffer.h, mouseTexture.format, _mouseBuffer.format)) {
if (!_mouseBuffer.format.aBits()) {
// Apply color keying since the original cursor had no alpha channel.
const uint16 *src = (const uint16 *)_mouseBuffer.getPixels();
uint8 *dstRaw = (uint8 *)mouseTexture.getPixels();
// Apply color keying since the original cursor had no alpha channel.
const uint16 *src = (const uint16 *)_mouseBuffer.getPixels();
uint8 *dstRaw = (uint8 *)mouseTexture.getPixels();
for (uint y = 0; y < _mouseBuffer.h; ++y, dstRaw += mouseTexture.pitch) {
uint16 *dst = (uint16 *)dstRaw;
for (uint x = 0; x < _mouseBuffer.w; ++x, ++dst) {
if (*src++ == _mouseKeyColor)
*dst &= ~1;
else
*dst |= 1;
}
for (uint y = 0; y < _mouseBuffer.h; ++y, dstRaw += mouseTexture.pitch) {
uint16 *dst = (uint16 *)dstRaw;
for (uint x = 0; x < _mouseBuffer.w; ++x, ++dst) {
if (*src++ == _mouseKeyColor)
*dst &= ~1;
else
*dst |= 1;
}
}
} else {