mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 14:21:04 +08:00
Windows: Fixed swapped colors for custom cursors
Previously the red and blue color channels were swapped, since Windows expects a different channel order for DIBs. This fixes issue #1464.
This commit is contained in:
parent
c2008b2fb4
commit
410c8aa5f5
@ -89,7 +89,15 @@ bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hot
|
||||
}
|
||||
|
||||
// Fill our bitmap with the cursor color data
|
||||
std::memcpy(bitmapData, pixels, size.x * size.y * 4);
|
||||
// We'll have to swap the red and blue channels here
|
||||
Uint8* bitmapOffset = bitmapData;
|
||||
for (std::size_t remaining = size.x * size.y; remaining; --remaining, pixels += 4)
|
||||
{
|
||||
*bitmapOffset++ = pixels[2]; // Blue
|
||||
*bitmapOffset++ = pixels[1]; // Green
|
||||
*bitmapOffset++ = pixels[0]; // Red
|
||||
*bitmapOffset++ = pixels[3]; // Alpha
|
||||
}
|
||||
|
||||
// Create a dummy mask bitmap (it won't be used)
|
||||
HBITMAP mask = CreateBitmap(size.x, size.y, 1, 1, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user