mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-29 06:28:29 +00:00
Use an empty bitmap for the blank cursor on macOS
Some macOS installations seem to have trouble decoding the GIF we were using Fixes https://github.com/libsdl-org/SDL/issues/14012
This commit is contained in:
@@ -44,19 +44,20 @@
|
|||||||
{
|
{
|
||||||
static NSCursor *invisibleCursor = NULL;
|
static NSCursor *invisibleCursor = NULL;
|
||||||
if (!invisibleCursor) {
|
if (!invisibleCursor) {
|
||||||
// RAW 16x16 transparent GIF
|
const int size = 32;
|
||||||
static unsigned char cursorBytes[] = {
|
NSImage *cursorImage = [[NSImage alloc] initWithSize:NSMakeSize(size, size)];
|
||||||
0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x10, 0x00, 0x10, 0x00, 0x80,
|
NSBitmapImageRep *imgrep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04,
|
pixelsWide:size
|
||||||
0x01, 0x00, 0x00, 0x01, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x10,
|
pixelsHigh:size
|
||||||
0x00, 0x10, 0x00, 0x00, 0x02, 0x0E, 0x8C, 0x8F, 0xA9, 0xCB, 0xED,
|
bitsPerSample:8
|
||||||
0x0F, 0xA3, 0x9C, 0xB4, 0xDA, 0x8B, 0xB3, 0x3E, 0x05, 0x00, 0x3B
|
samplesPerPixel:4
|
||||||
};
|
hasAlpha:YES
|
||||||
|
isPlanar:NO
|
||||||
|
colorSpaceName:NSDeviceRGBColorSpace
|
||||||
|
bytesPerRow:(size * 4)
|
||||||
|
bitsPerPixel:32];
|
||||||
|
[cursorImage addRepresentation:imgrep];
|
||||||
|
|
||||||
NSData *cursorData = [NSData dataWithBytesNoCopy:&cursorBytes[0]
|
|
||||||
length:sizeof(cursorBytes)
|
|
||||||
freeWhenDone:NO];
|
|
||||||
NSImage *cursorImage = [[NSImage alloc] initWithData:cursorData];
|
|
||||||
invisibleCursor = [[NSCursor alloc] initWithImage:cursorImage
|
invisibleCursor = [[NSCursor alloc] initWithImage:cursorImage
|
||||||
hotSpot:NSZeroPoint];
|
hotSpot:NSZeroPoint];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user