mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 18:41:14 +00:00
🩹 fix: use actual transparent pixel if surface supports alpha channel (#616)
This commit is contained in:
parent
bf3820c054
commit
df84f4d7a5
@ -1198,6 +1198,8 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface(const CursorBitmap* p_
|
|||||||
}
|
}
|
||||||
|
|
||||||
MxS32 bytesPerPixel = ddsd.ddpfPixelFormat.dwRGBBitCount / 8;
|
MxS32 bytesPerPixel = ddsd.ddpfPixelFormat.dwRGBBitCount / 8;
|
||||||
|
MxBool isAlphaAvailable = ((ddsd.ddpfPixelFormat.dwFlags & DDPF_ALPHAPIXELS) == DDPF_ALPHAPIXELS) &&
|
||||||
|
(ddsd.ddpfPixelFormat.dwRGBAlphaBitMask != 0);
|
||||||
|
|
||||||
ddsd.dwWidth = p_cursorBitmap->width;
|
ddsd.dwWidth = p_cursorBitmap->width;
|
||||||
ddsd.dwHeight = p_cursorBitmap->height;
|
ddsd.dwHeight = p_cursorBitmap->height;
|
||||||
@ -1260,7 +1262,12 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface(const CursorBitmap* p_
|
|||||||
|
|
||||||
MxS32 pixel;
|
MxS32 pixel;
|
||||||
if (!isOpaque) {
|
if (!isOpaque) {
|
||||||
pixel = RGB8888_CREATE(0xff, 0, 0xff, 0); // Transparent pixel
|
if (isAlphaAvailable) {
|
||||||
|
pixel = RGB8888_CREATE(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pixel = RGB8888_CREATE(0xff, 0, 0xff, 0);
|
||||||
|
} // Transparent pixel
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pixel = isBlack ? RGB8888_CREATE(0, 0, 0, 0xff) : RGB8888_CREATE(0xff, 0xff, 0xff, 0xff);
|
pixel = isBlack ? RGB8888_CREATE(0, 0, 0, 0xff) : RGB8888_CREATE(0xff, 0xff, 0xff, 0xff);
|
||||||
@ -1290,10 +1297,12 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CreateCursorSurface(const CursorBitmap* p_
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
DDCOLORKEY colorkey;
|
if (!isAlphaAvailable) {
|
||||||
colorkey.dwColorSpaceHighValue = RGB8888_CREATE(0xff, 0, 0xff, 0);
|
DDCOLORKEY colorkey;
|
||||||
colorkey.dwColorSpaceLowValue = RGB8888_CREATE(0xff, 0, 0xff, 0);
|
colorkey.dwColorSpaceHighValue = RGB8888_CREATE(0xff, 0, 0xff, 0);
|
||||||
newSurface->SetColorKey(DDCKEY_SRCBLT, &colorkey);
|
colorkey.dwColorSpaceLowValue = RGB8888_CREATE(0xff, 0, 0xff, 0);
|
||||||
|
newSurface->SetColorKey(DDCKEY_SRCBLT, &colorkey);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user