diff options
| author | Guilherme Felipe | 2018-05-26 15:58:12 -0300 |
|---|---|---|
| committer | Guilherme Felipe | 2018-05-26 15:56:35 -0300 |
| commit | aa174d963df943ba8a763a57a51888e3a37c2fe0 (patch) | |
| tree | 4417d96820879a17ea4e9cb9fc9eb2052cf77409 /platform/osx/os_osx.mm | |
| parent | c0d37123050f0bbc04b42f3073ee22a657528190 (diff) | |
| download | godot-aa174d963df943ba8a763a57a51888e3a37c2fe0.tar.gz godot-aa174d963df943ba8a763a57a51888e3a37c2fe0.tar.zst godot-aa174d963df943ba8a763a57a51888e3a37c2fe0.zip | |
Diffstat (limited to 'platform/osx/os_osx.mm')
| -rw-r--r-- | platform/osx/os_osx.mm | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 5589f93a5..404ee5f47 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1546,7 +1546,7 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c image = texture->get_data(); - NSBitmapImageRep *imgrep = [[[NSBitmapImageRep alloc] + NSBitmapImageRep *imgrep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:int(texture_size.width) pixelsHigh:int(texture_size.height) @@ -1556,7 +1556,7 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:int(texture_size.width) * 4 - bitsPerPixel:32] autorelease]; + bitsPerPixel:32]; ERR_FAIL_COND(imgrep == nil); uint8_t *pixels = [imgrep bitmapData]; @@ -1588,16 +1588,20 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c image->unlock(); - NSImage *nsimage = [[[NSImage alloc] initWithSize:NSMakeSize(texture_size.width, texture_size.height)] autorelease]; + NSImage *nsimage = [[NSImage alloc] initWithSize:NSMakeSize(texture_size.width, texture_size.height)]; [nsimage addRepresentation:imgrep]; NSCursor *cursor = [[NSCursor alloc] initWithImage:nsimage hotSpot:NSMakePoint(p_hotspot.x, p_hotspot.y)]; + [cursors[p_shape] release]; cursors[p_shape] = cursor; if (p_shape == CURSOR_ARROW) { [cursor set]; } + + [imgrep release]; + [nsimage release]; } else { // Reset to default system cursor cursors[p_shape] = NULL; |
