comparison src/video/quartz/SDL_QuartzVideo.h @ 588:2c6510c0a304

Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
author Sam Lantinga <slouken@libsdl.org>
date Sat, 01 Feb 2003 19:59:23 +0000
parents 04dcaf3da918
children 7ec821f3cbd0
comparison
equal deleted inserted replaced
587:f00ccf8d8edc 588:2c6510c0a304
51 #include <Cocoa/Cocoa.h> 51 #include <Cocoa/Cocoa.h>
52 #include <OpenGL/OpenGL.h> 52 #include <OpenGL/OpenGL.h>
53 #include <Carbon/Carbon.h> 53 #include <Carbon/Carbon.h>
54 #include <QuickTime/QuickTime.h> 54 #include <QuickTime/QuickTime.h>
55 #include <IOKit/IOKitLib.h> /* For powersave handling */ 55 #include <IOKit/IOKitLib.h> /* For powersave handling */
56 56 #include <pthread.h>
57
58 #include "SDL_thread.h"
57 #include "SDL_video.h" 59 #include "SDL_video.h"
58 #include "SDL_error.h" 60 #include "SDL_error.h"
59 #include "SDL_timer.h" 61 #include "SDL_timer.h"
60 #include "SDL_syswm.h" 62 #include "SDL_syswm.h"
61 #include "SDL_sysvideo.h" 63 #include "SDL_sysvideo.h"
135 io_connect_t power_connection; /* used with IOKit to detect wake from sleep */ 137 io_connect_t power_connection; /* used with IOKit to detect wake from sleep */
136 Uint8 expect_mouse_up; /* used to determine when to send mouse up events */ 138 Uint8 expect_mouse_up; /* used to determine when to send mouse up events */
137 Uint8 grab_state; /* used to manage grab behavior */ 139 Uint8 grab_state; /* used to manage grab behavior */
138 NSPoint cursor_loc; /* saved cursor coords, for activate/deactivate when grabbed */ 140 NSPoint cursor_loc; /* saved cursor coords, for activate/deactivate when grabbed */
139 BOOL cursor_visible; /* tells if cursor was hidden or not */ 141 BOOL cursor_visible; /* tells if cursor was hidden or not */
142 Uint8* sw_buffers[2]; /* pointers to the two software buffers for double-buffer emulation */
143 SDL_Thread *thread; /* thread for async updates to the screen */
144 SDL_sem *sem1, *sem2; /* synchronization for async screen updates */
145 Uint8 *current_buffer; /* the buffer being copied to the screen */
146 BOOL quit_thread; /* used to quit the async blitting thread */
140 147
141 ImageDescriptionHandle yuv_idh; 148 ImageDescriptionHandle yuv_idh;
142 MatrixRecordPtr yuv_matrix; 149 MatrixRecordPtr yuv_matrix;
143 DecompressorComponent yuv_codec; 150 DecompressorComponent yuv_codec;
144 ImageSequence yuv_seq; 151 ImageSequence yuv_seq;
174 #define power_connection (this->hidden->power_connection) 181 #define power_connection (this->hidden->power_connection)
175 #define expect_mouse_up (this->hidden->expect_mouse_up) 182 #define expect_mouse_up (this->hidden->expect_mouse_up)
176 #define grab_state (this->hidden->grab_state) 183 #define grab_state (this->hidden->grab_state)
177 #define cursor_loc (this->hidden->cursor_loc) 184 #define cursor_loc (this->hidden->cursor_loc)
178 #define cursor_visible (this->hidden->cursor_visible) 185 #define cursor_visible (this->hidden->cursor_visible)
186 #define sw_buffers (this->hidden->sw_buffers)
187 #define thread (this->hidden->thread)
188 #define sem1 (this->hidden->sem1)
189 #define sem2 (this->hidden->sem2)
190 #define current_buffer (this->hidden->current_buffer)
191 #define quit_thread (this->hidden->quit_thread)
179 192
180 #define yuv_idh (this->hidden->yuv_idh) 193 #define yuv_idh (this->hidden->yuv_idh)
181 #define yuv_matrix (this->hidden->yuv_matrix) 194 #define yuv_matrix (this->hidden->yuv_matrix)
182 #define yuv_codec (this->hidden->yuv_codec) 195 #define yuv_codec (this->hidden->yuv_codec)
183 #define yuv_seq (this->hidden->yuv_seq) 196 #define yuv_seq (this->hidden->yuv_seq)
260 273
261 extern CGSError CGSDisplayCanHWFill (CGDirectDisplayID id); 274 extern CGSError CGSDisplayCanHWFill (CGDirectDisplayID id);
262 275
263 extern CGSError CGSGetMouseEnabledFlags (CGSConnectionID cid, CGSWindowID wid, int *flags); 276 extern CGSError CGSGetMouseEnabledFlags (CGSConnectionID cid, CGSWindowID wid, int *flags);
264 277
278 int CGSDisplayHWSync (CGDirectDisplayID id);
279
265 /* Bootstrap functions */ 280 /* Bootstrap functions */
266 static int QZ_Available (); 281 static int QZ_Available ();
267 static SDL_VideoDevice* QZ_CreateDevice (int device_index); 282 static SDL_VideoDevice* QZ_CreateDevice (int device_index);
268 static void QZ_DeleteDevice (SDL_VideoDevice *device); 283 static void QZ_DeleteDevice (SDL_VideoDevice *device);
269 284
278 int width, int height, int bpp, 293 int width, int height, int bpp,
279 Uint32 flags); 294 Uint32 flags);
280 static int QZ_ToggleFullScreen (_THIS, int on); 295 static int QZ_ToggleFullScreen (_THIS, int on);
281 static int QZ_SetColors (_THIS, int first_color, 296 static int QZ_SetColors (_THIS, int first_color,
282 int num_colors, SDL_Color *colors); 297 int num_colors, SDL_Color *colors);
298
299 static int QZ_LockDoubleBuffer (_THIS, SDL_Surface *surface);
300 static void QZ_UnlockDoubleBuffer (_THIS, SDL_Surface *surface);
301 static int QZ_ThreadFlip (_THIS);
302 static int QZ_FlipDoubleBuffer (_THIS, SDL_Surface *surface);
303 static void QZ_DoubleBufferUpdate (_THIS, int num_rects, SDL_Rect *rects);
304
283 static void QZ_DirectUpdate (_THIS, int num_rects, SDL_Rect *rects); 305 static void QZ_DirectUpdate (_THIS, int num_rects, SDL_Rect *rects);
284 static int QZ_LockWindow (_THIS, SDL_Surface *surface); 306 static int QZ_LockWindow (_THIS, SDL_Surface *surface);
285 static void QZ_UnlockWindow (_THIS, SDL_Surface *surface); 307 static void QZ_UnlockWindow (_THIS, SDL_Surface *surface);
286 static void QZ_UpdateRects (_THIS, int num_rects, SDL_Rect *rects); 308 static void QZ_UpdateRects (_THIS, int num_rects, SDL_Rect *rects);
287 static void QZ_VideoQuit (_THIS); 309 static void QZ_VideoQuit (_THIS);