macOS: Fix some small mistakes with reference counting

This commit is contained in:
UnknownShadow200 2025-12-17 07:36:40 +11:00
parent b4fdd26946
commit b6eb396626
2 changed files with 15 additions and 14 deletions

View File

@ -349,7 +349,8 @@ static void ApplyIcon(void) {
img = [img initWithSize:NSMakeSize(CCIcon_Width, CCIcon_Height)]; img = [img initWithSize:NSMakeSize(CCIcon_Width, CCIcon_Height)];
[img addRepresentation:rep]; [img addRepresentation:rep];
[appHandle setApplicationIconImage:img]; [appHandle setApplicationIconImage:img];
//[img release];
[img release];
} }
static pascal OSErr HandleQuitMessage(const AppleEvent* ev, AppleEvent* reply, long handlerRefcon) { static pascal OSErr HandleQuitMessage(const AppleEvent* ev, AppleEvent* reply, long handlerRefcon) {
@ -404,7 +405,6 @@ void Window_SetTitle(const cc_string* title) {
str = [NSString stringWithUTF8String:raw]; str = [NSString stringWithUTF8String:raw];
[winHandle setTitle:str]; [winHandle setTitle:str];
[str release];
} }
// NOTE: Only defined since macOS 10.7 SDK // NOTE: Only defined since macOS 10.7 SDK
@ -781,7 +781,7 @@ static int SupportsModernFullscreen(void) {
return [winHandle respondsToSelector:@selector(toggleFullScreen:)]; return [winHandle respondsToSelector:@selector(toggleFullScreen:)];
} }
static NSOpenGLPixelFormat* MakePixelFormat(cc_bool fullscreen) { static NSOpenGLPixelFormat* InitPixelFormat(cc_bool fullscreen) {
// TODO: Is there a penalty for fullscreen contexts in 10.7 and later? // TODO: Is there a penalty for fullscreen contexts in 10.7 and later?
// Need to test whether there is a performance penalty or not // Need to test whether there is a performance penalty or not
if (SupportsModernFullscreen()) fullscreen = false; if (SupportsModernFullscreen()) fullscreen = false;
@ -800,11 +800,11 @@ static NSOpenGLPixelFormat* MakePixelFormat(cc_bool fullscreen) {
void GLContext_Create(void) { void GLContext_Create(void) {
NSOpenGLPixelFormat* fmt; NSOpenGLPixelFormat* fmt;
fmt = MakePixelFormat(true); fmt = InitPixelFormat(true);
if (!fmt) { if (!fmt) {
Platform_LogConst("Failed to create full screen pixel format."); Platform_LogConst("Failed to create full screen pixel format.");
Platform_LogConst("Trying again to create a non-fullscreen pixel format."); Platform_LogConst("Trying again to create a non-fullscreen pixel format.");
fmt = MakePixelFormat(false); fmt = InitPixelFormat(false);
} }
if (!fmt) Process_Abort("Choosing pixel format"); if (!fmt) Process_Abort("Choosing pixel format");
@ -813,9 +813,10 @@ void GLContext_Create(void) {
if (!ctxHandle) Process_Abort("Failed to create OpenGL context"); if (!ctxHandle) Process_Abort("Failed to create OpenGL context");
[ctxHandle setView:viewHandle]; [ctxHandle setView:viewHandle];
[fmt release];
[ctxHandle makeCurrentContext]; [ctxHandle makeCurrentContext];
[ctxHandle update]; [ctxHandle update];
[fmt release];
} }
void GLContext_Update(void) { void GLContext_Update(void) {

View File

@ -22,17 +22,17 @@
! Final calculation: ! Final calculation:
! out->c = type << 24 ! out->c = type << 24
! out->x = ((v2->x - v1->x) + v1->x) * 1/zNear ! out->x = (t * (v2->x - v1->x) + v1->x) * 1/zNear
! out->y = ((v2->y - v1->y) + v1->y) * 1/zNear ! out->y = (t * (v2->y - v1->y) + v1->y) * 1/zNear
! out->w = 1/zNear ! out->w = 1/zNear
! !
! out->u = (v2->u - v1->u) + v1->u; ! out->u = t * (v2->u - v1->u) + v1->u;
! out->v = (v2->v - v1->v) + v1->v; ! out->v = t * (v2->v - v1->v) + v1->v;
! !
! out->b = (v2->b - v1->b) + v1->b; ! out->b = t * (v2->b - v1->b) + v1->b;
! out->g = (v2->g - v1->g) + v1->g; ! out->g = t * (v2->g - v1->g) + v1->g;
! out->r = (v2->r - v1->r) + v1->r; ! out->r = t * (v2->r - v1->r) + v1->r;
! out->a = (v2->a - v1->a) + v1->a; ! out->a = t * (v2->a - v1->a) + v1->a;
! INPUT ARGUMENTS ! INPUT ARGUMENTS
#define IN1 r4 // input vertex 1 #define IN1 r4 // input vertex 1