Skip to content

Commit

Permalink
Fix the Quick Look generator for macOS Sonoma, fixes LIJI32#581
Browse files Browse the repository at this point in the history
  • Loading branch information
LIJI32 committed Jan 11, 2024
1 parent 5fb6d55 commit 686a506
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions QuickLook/generator.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ static OSStatus render(CGContextRef cgContext, CFURLRef url, bool showBorder)
static NSImage *templateColor = nil;
static NSBundle *bundle = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
bundle = [NSBundle bundleWithIdentifier:@"com.github.liji32.sameboy.previewer"];
});
if (showBorder) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
bundle = [NSBundle bundleWithIdentifier:@"com.github.liji32.sameboy.previewer"];
template = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CartridgeTemplate" ofType:@"png"]];
templateUniversal = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"UniversalCartridgeTemplate" ofType:@"png"]];
templateColor = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"ColorCartridgeTemplate" ofType:@"png"]];
Expand All @@ -31,7 +34,7 @@ static OSStatus render(CGContextRef cgContext, CFURLRef url, bool showBorder)
/* Convert the screenshot to a CGImageRef */
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmap, sizeof(bitmap), NULL);
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast;
CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;

CGImageRef iref = CGImageCreate(160,
Expand Down

0 comments on commit 686a506

Please sign in to comment.