Quellcode durchsuchen

Refactor CocoaSetDockIcon function

Refactor CocoaSetDockIcon to improve structure and readability.
pull/5425/head
annes vor 3 Monaten
committed von GitHub
Ursprung
Commit
738b81aa50
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden GPG-Schlüssel-ID: B5690EEEBB952194
1 geänderte Dateien mit 13 neuen und 2 gelöschten Zeilen
  1. +13
    -2
      src/_cocoalayer.mm

+ 13
- 2
src/_cocoalayer.mm Datei anzeigen

@ -1,9 +1,14 @@
#if defined(__APPLE__)
#import <Cocoa/Cocoa.h>
#import <objc/runtime.h>
#include "_cocoalayer.h"
// Example: make a global function you can call
extern "C" void CocoaSetDockIcon(unsigned char* data, int width, int height)
#ifdef __cplusplus
extern "C" {
#endif
void CocoaSetDockIcon(unsigned char* data, int width, int height)
{
NSImage *dockIcon = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
CGDataProviderRef provider = CGDataProviderCreateWithData(nullptr, data, width*height*4, nullptr);
@ -17,4 +22,10 @@ extern "C" void CocoaSetDockIcon(unsigned char* data, int width, int height)
CGColorSpaceRelease(colorSpace);
CGDataProviderRelease(provider);
}
#ifdef __cplusplus
}
#endif
#endif

Laden…
Abbrechen
Speichern