Mercurial > sdl-ios-xcode
comparison src/video/quartz/SDL_QuartzVideo.m @ 1120:8e1fde455471
Patch by me to fix crash described below.
--ryan.
To: sdl@libsdl.org
From: Rainer Deyke <rainerd@eldwood.com>
Date: Tue, 16 Aug 2005 01:08:18 -0600
Subject: [SDL] Bug report: SDL_CreateRGBSurface with SDL_HWSURFACE crashes
If SDL is in full-screen mode with a hardware video surface on OS X,
SDL_CreateRGBSurface with SDL_HWSURFACE crashes. The crash occurs on
line 109 of SDL_Surface.c. This was tested on OS X 10.3.9 with both SDL
1.2.8 and the latest CVS. Here is a small C++ program that demonstrates
the problem:
#include "SDL.h"
#include <stdio.h>
namespace {
void wait_for_key()
{
SDL_Event e;
printf("%d\n", SDL_GetAppState());
while (SDL_WaitEvent(&e)) {
if (e.type == SDL_KEYDOWN || e.type == SDL_QUIT) return;
}
}
}
int main(int, char *[])
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Surface *screen
= SDL_SetVideoMode(640, 480, 32, SDL_FULLSCREEN | SDL_HWSURFACE);
SDL_Surface *s = SDL_CreateRGBSurface(SDL_HWSURFACE, 640, 480, 32,
screen->format->Rmask, screen->format->Gmask,
screen->format->Bmask, screen->format->Amask);
wait_for_key();
if (s) SDL_FreeSurface(s);
SDL_Quit();
printf("Success!\n");
return 0;
}
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Thu, 18 Aug 2005 06:46:32 +0000 |
parents | 430d8d701f69 |
children | 509295d5a023 |
comparison
equal
deleted
inserted
replaced
1119:430d8d701f69 | 1120:8e1fde455471 |
---|---|
93 #if 0 /* Not used (apparently, it's really slow) */ | 93 #if 0 /* Not used (apparently, it's really slow) */ |
94 static int QZ_FillHWRect (_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color); | 94 static int QZ_FillHWRect (_THIS, SDL_Surface *dst, SDL_Rect *rect, Uint32 color); |
95 #endif | 95 #endif |
96 static int QZ_LockHWSurface(_THIS, SDL_Surface *surface); | 96 static int QZ_LockHWSurface(_THIS, SDL_Surface *surface); |
97 static void QZ_UnlockHWSurface(_THIS, SDL_Surface *surface); | 97 static void QZ_UnlockHWSurface(_THIS, SDL_Surface *surface); |
98 static int QZ_AllocHWSurface(_THIS, SDL_Surface *surface); | |
98 static void QZ_FreeHWSurface (_THIS, SDL_Surface *surface); | 99 static void QZ_FreeHWSurface (_THIS, SDL_Surface *surface); |
99 /* static int QZ_FlipHWSurface (_THIS, SDL_Surface *surface); */ | 100 /* static int QZ_FlipHWSurface (_THIS, SDL_Surface *surface); */ |
100 | 101 |
101 /* Bootstrap binding, enables entry point into the driver */ | 102 /* Bootstrap binding, enables entry point into the driver */ |
102 VideoBootStrap QZ_bootstrap = { | 103 VideoBootStrap QZ_bootstrap = { |
135 /* device->UpdateRects = QZ_UpdateRects; this is determined by SetVideoMode() */ | 136 /* device->UpdateRects = QZ_UpdateRects; this is determined by SetVideoMode() */ |
136 device->VideoQuit = QZ_VideoQuit; | 137 device->VideoQuit = QZ_VideoQuit; |
137 | 138 |
138 device->LockHWSurface = QZ_LockHWSurface; | 139 device->LockHWSurface = QZ_LockHWSurface; |
139 device->UnlockHWSurface = QZ_UnlockHWSurface; | 140 device->UnlockHWSurface = QZ_UnlockHWSurface; |
141 device->AllocHWSurface = QZ_AllocHWSurface; | |
140 device->FreeHWSurface = QZ_FreeHWSurface; | 142 device->FreeHWSurface = QZ_FreeHWSurface; |
141 /* device->FlipHWSurface = QZ_FlipHWSurface */; | 143 /* device->FlipHWSurface = QZ_FlipHWSurface */; |
142 | 144 |
143 device->SetGamma = QZ_SetGamma; | 145 device->SetGamma = QZ_SetGamma; |
144 device->GetGamma = QZ_GetGamma; | 146 device->GetGamma = QZ_GetGamma; |
1504 | 1506 |
1505 static void QZ_UnlockHWSurface(_THIS, SDL_Surface *surface) { | 1507 static void QZ_UnlockHWSurface(_THIS, SDL_Surface *surface) { |
1506 | 1508 |
1507 } | 1509 } |
1508 | 1510 |
1511 static int QZ_AllocHWSurface(_THIS, SDL_Surface *surface) { | |
1512 return(-1); /* unallowed (no HWSURFACE support here). */ | |
1513 } | |
1514 | |
1509 static void QZ_FreeHWSurface (_THIS, SDL_Surface *surface) { | 1515 static void QZ_FreeHWSurface (_THIS, SDL_Surface *surface) { |
1510 } | 1516 } |
1511 | 1517 |
1512 /* | 1518 /* |
1513 int QZ_FlipHWSurface (_THIS, SDL_Surface *surface) { | 1519 int QZ_FlipHWSurface (_THIS, SDL_Surface *surface) { |