src/video/quartz/SDL_QuartzVideo.m
changeset 1756 eed7a3f396ce
parent 1629 ef4a796e7f24
child 1895 c121d94672cb
child 3877 81f66f258d77
equal deleted inserted replaced
1755:91063c450171 1756:eed7a3f396ce
   115 #pragma unused (device_index)
   115 #pragma unused (device_index)
   116 
   116 
   117     SDL_VideoDevice *device;
   117     SDL_VideoDevice *device;
   118     SDL_PrivateVideoData *hidden;
   118     SDL_PrivateVideoData *hidden;
   119 
   119 
   120     device = (SDL_VideoDevice*) malloc (sizeof (*device) );
   120     device = (SDL_VideoDevice*) SDL_malloc (sizeof (*device) );
   121     hidden = (SDL_PrivateVideoData*) malloc (sizeof (*hidden) );
   121     hidden = (SDL_PrivateVideoData*) SDL_malloc (sizeof (*hidden) );
   122 
   122 
   123     if (device == NULL || hidden == NULL)
   123     if (device == NULL || hidden == NULL)
   124         SDL_OutOfMemory ();
   124         SDL_OutOfMemory ();
   125 
   125 
   126     memset (device, 0, sizeof (*device) );
   126     SDL_memset (device, 0, sizeof (*device) );
   127     memset (hidden, 0, sizeof (*hidden) );
   127     SDL_memset (hidden, 0, sizeof (*hidden) );
   128 
   128 
   129     device->hidden = hidden;
   129     device->hidden = hidden;
   130 
   130 
   131     device->VideoInit        = QZ_VideoInit;
   131     device->VideoInit        = QZ_VideoInit;
   132     device->ListModes        = QZ_ListModes;
   132     device->ListModes        = QZ_ListModes;
   176     return device;
   176     return device;
   177 }
   177 }
   178 
   178 
   179 static void QZ_DeleteDevice (SDL_VideoDevice *device) {
   179 static void QZ_DeleteDevice (SDL_VideoDevice *device) {
   180 
   180 
   181     free (device->hidden);
   181     SDL_free (device->hidden);
   182     free (device);
   182     SDL_free (device);
   183 }
   183 }
   184 
   184 
   185 static int QZ_VideoInit (_THIS, SDL_PixelFormat *video_format) {
   185 static int QZ_VideoInit (_THIS, SDL_PixelFormat *video_format) {
   186 
   186 
   187     /* Initialize the video settings; this data persists between mode switches */
   187     /* Initialize the video settings; this data persists between mode switches */
   240     if ( client_mode_list != NULL ) {
   240     if ( client_mode_list != NULL ) {
   241 
   241 
   242         int i;
   242         int i;
   243 
   243 
   244         for (i = 0; client_mode_list[i] != NULL; i++)
   244         for (i = 0; client_mode_list[i] != NULL; i++)
   245             free (client_mode_list[i]);
   245             SDL_free (client_mode_list[i]);
   246 
   246 
   247         free (client_mode_list);
   247         SDL_free (client_mode_list);
   248         client_mode_list = NULL;
   248         client_mode_list = NULL;
   249     }
   249     }
   250 
   250 
   251     num_modes = CFArrayGetCount (mode_list);
   251     num_modes = CFArrayGetCount (mode_list);
   252 
   252 
   295 
   295 
   296                 list_size++;
   296                 list_size++;
   297 
   297 
   298                 if (client_mode_list == NULL)
   298                 if (client_mode_list == NULL)
   299                     client_mode_list = (SDL_Rect**) 
   299                     client_mode_list = (SDL_Rect**) 
   300                         malloc (sizeof(*client_mode_list) * (list_size+1) );
   300                         SDL_malloc (sizeof(*client_mode_list) * (list_size+1) );
   301                 else
   301                 else
   302                     client_mode_list = (SDL_Rect**) 
   302                     client_mode_list = (SDL_Rect**) 
   303                         realloc (client_mode_list, sizeof(*client_mode_list) * (list_size+1));
   303                         SDL_realloc (client_mode_list, sizeof(*client_mode_list) * (list_size+1));
   304 
   304 
   305                 rect = (SDL_Rect*) malloc (sizeof(**client_mode_list));
   305                 rect = (SDL_Rect*) SDL_malloc (sizeof(**client_mode_list));
   306 
   306 
   307                 if (client_mode_list == NULL || rect == NULL) {
   307                 if (client_mode_list == NULL || rect == NULL) {
   308                     SDL_OutOfMemory ();
   308                     SDL_OutOfMemory ();
   309                     return NULL;
   309                     return NULL;
   310                 }
   310                 }
   370             quit_thread = YES;
   370             quit_thread = YES;
   371             SDL_SemPost (sem1);
   371             SDL_SemPost (sem1);
   372             SDL_WaitThread (thread, NULL);
   372             SDL_WaitThread (thread, NULL);
   373             SDL_DestroySemaphore (sem1);
   373             SDL_DestroySemaphore (sem1);
   374             SDL_DestroySemaphore (sem2);
   374             SDL_DestroySemaphore (sem2);
   375             free (sw_buffers[0]);
   375             SDL_free (sw_buffers[0]);
   376         }
   376         }
   377         
   377         
   378         /* 
   378         /* 
   379             Release the OpenGL context
   379             Release the OpenGL context
   380             Do this first to avoid trash on the display before fade
   380             Do this first to avoid trash on the display before fade
   491         this->UpdateRects = QZ_DoubleBufferUpdate;
   491         this->UpdateRects = QZ_DoubleBufferUpdate;
   492         this->LockHWSurface = QZ_LockDoubleBuffer;
   492         this->LockHWSurface = QZ_LockDoubleBuffer;
   493         this->UnlockHWSurface = QZ_UnlockDoubleBuffer;
   493         this->UnlockHWSurface = QZ_UnlockDoubleBuffer;
   494         this->FlipHWSurface = QZ_FlipDoubleBuffer;
   494         this->FlipHWSurface = QZ_FlipDoubleBuffer;
   495 
   495 
   496         current->pixels = malloc (current->pitch * current->h * 2);
   496         current->pixels = SDL_malloc (current->pitch * current->h * 2);
   497         if (current->pixels == NULL) {
   497         if (current->pixels == NULL) {
   498             SDL_OutOfMemory ();
   498             SDL_OutOfMemory ();
   499             goto ERR_DOUBLEBUF;
   499             goto ERR_DOUBLEBUF;
   500         }
   500         }
   501         
   501         
   982         /* On error, skip VBL delay */
   982         /* On error, skip VBL delay */
   983         ERROR:
   983         ERROR:
   984         
   984         
   985         while ( h-- ) {
   985         while ( h-- ) {
   986         
   986         
   987             memcpy (dst, src, len);
   987             SDL_memcpy (dst, src, len);
   988             src += skip;
   988             src += skip;
   989             dst += skip;
   989             dst += skip;
   990         }
   990         }
   991         
   991         
   992         /* signal flip completion */
   992         /* signal flip completion */
  1209                         /* Create dock icon cache */
  1209                         /* Create dock icon cache */
  1210                         if (numCachedDockIcons != (i-firstDockIcon) ||
  1210                         if (numCachedDockIcons != (i-firstDockIcon) ||
  1211                             dockIconCacheMiss) {
  1211                             dockIconCacheMiss) {
  1212 
  1212 
  1213                             numCachedDockIcons = i - firstDockIcon;
  1213                             numCachedDockIcons = i - firstDockIcon;
  1214                             memcpy (dockIcons, &(windows[firstDockIcon]),
  1214                             SDL_memcpy (dockIcons, &(windows[firstDockIcon]),
  1215                                     numCachedDockIcons * sizeof(*windows));
  1215                                     numCachedDockIcons * sizeof(*windows));
  1216                         }
  1216                         }
  1217 
  1217 
  1218                         /* no shadow */
  1218                         /* no shadow */
  1219                         shadowSide = 0;
  1219                         shadowSide = 0;