Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1.2 Quartz video: Ripped out QuickDraw and QuickTime.
Now we use the software path for YUV, and CoreGraphics for 2D stuff.

There are several other 10.6 fixes in here, too...now we can build a 64-bit
SDL for Snow Leopard!
  • Loading branch information
icculus committed Sep 21, 2009
1 parent 5b1dc7c commit 1751e87
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 827 deletions.
4 changes: 2 additions & 2 deletions configure.in
Expand Up @@ -2696,8 +2696,8 @@ case "$host" in
need_iokit_framework=yes
fi
if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
# The Cocoa backend still needs Carbon, and the YUV code QuickTime
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,ApplicationServices"
# The Cocoa backend still needs Carbon
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ApplicationServices"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
fi
# If either the audio or CD driver is used, add the AudioUnit framework
Expand Down
15 changes: 13 additions & 2 deletions src/video/quartz/SDL_QuartzGL.m
Expand Up @@ -41,13 +41,24 @@
#define NSOpenGLPFASamples ((NSOpenGLPixelFormatAttribute) 56)
#endif


#ifdef __powerpc__ /* we lost this in 10.6, which has no PPC support. */
@implementation NSOpenGLContext (CGLContextAccess)
- (CGLContextObj) cglContext;
{
return _contextAuxiliary;
}
@end
CGLContextObj QZ_GetCGLContextObj(NSOpenGLContext *nsctx)
{
return [nsctx cglContext];
}
#else
CGLContextObj QZ_GetCGLContextObj(NSOpenGLContext *nsctx)
{
return (CGLContextObj) [nsctx CGLContextObj];
}
#endif


/* OpenGL helper functions (used internally) */

Expand Down Expand Up @@ -165,7 +176,7 @@ int QZ_SetupOpenGL (_THIS, int bpp, Uint32 flags) {

{
long cache_max = 64;
CGLContextObj ctx = [ gl_context cglContext ];
CGLContextObj ctx = QZ_GetCGLContextObj(gl_context);
CGLSetParameter (ctx, GLI_SUBMIT_FUNC_CACHE_MAX, &cache_max);
CGLSetParameter (ctx, GLI_ARRAY_FUNC_CACHE_MAX, &cache_max);
}
Expand Down
27 changes: 12 additions & 15 deletions src/video/quartz/SDL_QuartzVideo.h
Expand Up @@ -53,7 +53,6 @@

#include <Cocoa/Cocoa.h>
#include <Carbon/Carbon.h>
#include <QuickTime/QuickTime.h>
#include <OpenGL/OpenGL.h> /* For CGL functions and types */
#include <IOKit/IOKitLib.h> /* For powersave handling */
#include <pthread.h>
Expand All @@ -68,13 +67,21 @@
#include "../SDL_pixels_c.h"
#include "../../events/SDL_events_c.h"


#ifdef __powerpc__
/*
This is a workaround to directly access NSOpenGLContext's CGL context
We need this to check for errors NSOpenGLContext doesn't support
Please note this is only used on PowerPC (Intel Macs are guaranteed to
have a better API for this, since it showed up in Mac OS X 10.3).
*/
@interface NSOpenGLContext (CGLContextAccess)
- (CGLContextObj) cglContext;
@end
#endif

/* use this to get the CGLContext; it handles Cocoa interface changes. */
CGLContextObj QZ_GetCGLContextObj(NSOpenGLContext *nsctx);


/* Main driver structure to store required state information */
Expand All @@ -93,7 +100,8 @@ typedef struct SDL_PrivateVideoData {
Uint32 warp_flag; /* boolean; notify to event loop that a warp just occured */
Uint32 warp_ticks; /* timestamp when the warp occured */
NSWindow *window; /* Cocoa window to implement the SDL window */
NSQuickDrawView *view; /* the window's view; draw 2D and OpenGL into this view */
NSView *view; /* the window's view; draw 2D and OpenGL into this view */
CGContextRef cg_context; /* CoreGraphics rendering context */
SDL_Surface *resize_icon; /* icon for the resize badge, we have to draw it by hand */
SDL_GrabMode current_grab_mode; /* default value is SDL_GRAB_OFF */
SDL_Rect **client_mode_list; /* resolution list to pass back to client */
Expand All @@ -113,14 +121,6 @@ typedef struct SDL_PrivateVideoData {
Uint8 *current_buffer; /* the buffer being copied to the screen */
BOOL quit_thread; /* used to quit the async blitting thread */
SInt32 system_version; /* used to dis-/enable workarounds depending on the system version */

ImageDescriptionHandle yuv_idh;
MatrixRecordPtr yuv_matrix;
DecompressorComponent yuv_codec;
ImageSequence yuv_seq;
PlanarPixmapInfoYUV420 *yuv_pixmap;
Sint16 yuv_width, yuv_height;
CGrafPtr yuv_port;

void *opengl_library; /* dynamically loaded OpenGL library. */
} SDL_PrivateVideoData;
Expand All @@ -139,6 +139,7 @@ typedef struct SDL_PrivateVideoData {
#define mode_flags (this->hidden->flags)
#define qz_window (this->hidden->window)
#define window_view (this->hidden->view)
#define cg_context (this->hidden->cg_context)
#define video_set (this->hidden->video_set)
#define warp_ticks (this->hidden->warp_ticks)
#define warp_flag (this->hidden->warp_flag)
Expand All @@ -156,6 +157,7 @@ typedef struct SDL_PrivateVideoData {
#define cursor_should_be_visible (this->hidden->cursor_should_be_visible)
#define cursor_visible (this->hidden->cursor_visible)
#define sw_buffers (this->hidden->sw_buffers)
#define sw_contexts (this->hidden->sw_contexts)
#define thread (this->hidden->thread)
#define sem1 (this->hidden->sem1)
#define sem2 (this->hidden->sem2)
Expand Down Expand Up @@ -215,11 +217,6 @@ int QZ_IconifyWindow (_THIS);
SDL_GrabMode QZ_GrabInput (_THIS, SDL_GrabMode grab_mode);
/*int QZ_GetWMInfo (_THIS, SDL_SysWMinfo *info);*/

/* YUV functions */
SDL_Overlay* QZ_CreateYUVOverlay (_THIS, int width, int height,
Uint32 format, SDL_Surface *display);


/* Private functions (used internally) */
void QZ_PrivateWarpCursor (_THIS, int x, int y);
void QZ_ChangeGrabState (_THIS, int action);
Expand Down

0 comments on commit 1751e87

Please sign in to comment.