Fixed window update problems on MacOS X 10.2 (thanks Darrell!)
authorSam Lantinga <slouken@libsdl.org>
Mon, 16 Sep 2002 18:38:09 +0000
changeset 498 4b8ff8ac2c07
parent 497 bb2d68294e81
child 499 f480ecd70499
Fixed window update problems on MacOS X 10.2 (thanks Darrell!)
src/video/quartz/SDL_QuartzVideo.h
src/video/quartz/SDL_QuartzVideo.m
--- a/src/video/quartz/SDL_QuartzVideo.h	Mon Sep 16 08:22:25 2002 +0000
+++ b/src/video/quartz/SDL_QuartzVideo.h	Mon Sep 16 18:38:09 2002 +0000
@@ -227,6 +227,8 @@
 static int          QZ_SetColors        (_THIS, int first_color,
                                          int num_colors, SDL_Color *colors);
 static void         QZ_DirectUpdate     (_THIS, int num_rects, SDL_Rect *rects);
+static int 	     QZ_LockWindow       (_THIS, SDL_Surface *surface);
+static void         QZ_UnlockWindow     (_THIS, SDL_Surface *surface);
 static void         QZ_UpdateRects      (_THIS, int num_rects, SDL_Rect *rects);
 static void         QZ_VideoQuit        (_THIS);
 
--- a/src/video/quartz/SDL_QuartzVideo.m	Mon Sep 16 08:22:25 2002 +0000
+++ b/src/video/quartz/SDL_QuartzVideo.m	Mon Sep 16 18:38:09 2002 +0000
@@ -576,10 +576,12 @@
         LockPortBits ( [ window_view qdPort ] );
         current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ window_view qdPort ] ) );
         current->pitch  = GetPixRowBytes ( GetPortPixMap ( [ window_view qdPort ] ) );
-
+        UnlockPortBits ( [ window_view qdPort ] );
+        
         current->flags |= SDL_SWSURFACE;
         current->flags |= SDL_PREALLOC;
-
+        current->flags |= SDL_ASYNCBLIT;
+        
         if ( flags & SDL_NOFRAME )
             current->flags |= SDL_NOFRAME;
         if ( flags & SDL_RESIZABLE )
@@ -590,7 +592,9 @@
             current->pixels += 22 * current->pitch;
         }
 
-        this->UpdateRects = QZ_UpdateRects;
+        this->UpdateRects     = QZ_UpdateRects;
+        this->LockHWSurface   = QZ_LockWindow;
+        this->UnlockHWSurface = QZ_UnlockWindow;
     }
 
     /* Save flags to ensure correct teardown */
@@ -913,6 +917,17 @@
 #endif
 }
 
+/* Locking functions for the software window buffer */
+static int QZ_LockWindow (_THIS, SDL_Surface *surface) {
+    
+    return LockPortBits ( [ window_view qdPort ] );
+}
+
+static void QZ_UnlockWindow (_THIS, SDL_Surface *surface) {
+
+    UnlockPortBits ( [ window_view qdPort ] );
+}
+
 static void QZ_UpdateRects (_THIS, int numRects, SDL_Rect *rects) {
 
     if (SDL_VideoSurface->flags & SDL_OPENGLBLIT) {