PPC mac: Fix launcher not drawing when compiled with more recent SDK

This commit is contained in:
UnknownShadow200 2024-08-10 20:33:16 +10:00
parent 5f937f6a06
commit 7848bb060c

View File

@ -216,9 +216,12 @@ void Window_Free(void) { }
/*########################################################################################################################* /*########################################################################################################################*
*-----------------------------------------------------------Window--------------------------------------------------------* *-----------------------------------------------------------Window--------------------------------------------------------*
*#########################################################################################################################*/ *#########################################################################################################################*/
#if !defined MAC_OS_X_VERSION_10_4 #ifdef CC_BIG_ENDIAN
// Doesn't exist in < 10.4 SDK. No issue since < 10.4 is only Big Endian PowerPC anyways /* Default byte order is big endian */
#define kCGBitmapByteOrder32Host 0 /* Also can't use kCGBitmapByteOrder32Host because that doesn't exist in older SDKs */
#define BITMAP_BYTE_ORDER 0
#else
#define BITMAP_BYTE_ORDER kCGBitmapByteOrder32Little
#endif #endif
static void RefreshWindowBounds(void) { static void RefreshWindowBounds(void) {
@ -716,7 +719,7 @@ static void DoDrawFramebuffer(NSRect dirty) {
NSGraphicsContext* nsContext; NSGraphicsContext* nsContext;
CGImageRef image; CGImageRef image;
CGRect rect; CGRect rect;
Event_RaiseVoid(&WindowEvents.Redrawing); Event_RaiseVoid(&WindowEvents.Redrawing);
// Unfortunately CGImageRef is immutable, so changing the // Unfortunately CGImageRef is immutable, so changing the
@ -734,8 +737,9 @@ static void DoDrawFramebuffer(NSRect dirty) {
// TODO: REPLACE THIS AWFUL HACK // TODO: REPLACE THIS AWFUL HACK
provider = CGDataProviderCreateWithData(NULL, fb_bmp.scan0, provider = CGDataProviderCreateWithData(NULL, fb_bmp.scan0,
Bitmap_DataSize(fb_bmp.width, fb_bmp.height), NULL); Bitmap_DataSize(fb_bmp.width, fb_bmp.height), NULL);
image = CGImageCreate(fb_bmp.width, fb_bmp.height, 8, 32, fb_bmp.width * 4, colorSpace, image = CGImageCreate(fb_bmp.width, fb_bmp.height, 8, 32, fb_bmp.width * 4, colorSpace,
kCGBitmapByteOrder32Host | kCGImageAlphaNoneSkipFirst, provider, NULL, 0, 0); BITMAP_BYTE_ORDER | kCGImageAlphaNoneSkipFirst, provider, NULL, 0, 0);
CGContextDrawImage(context, rect, image); CGContextDrawImage(context, rect, image);
CGContextSynchronize(context); CGContextSynchronize(context);