Commit 95fae084 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Fixed bug reported here:

   http://www.devolution.com/pipermail/sdl/2005-October/070998.html

--ryan.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401186
parent f682111c
...@@ -656,7 +656,7 @@ ERR_NO_MATCH: return NULL; ...@@ -656,7 +656,7 @@ ERR_NO_MATCH: return NULL;
} }
static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width, static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
int height, int bpp, Uint32 flags) { int height, int *bpp, Uint32 flags) {
unsigned int style; unsigned int style;
NSRect contentRect; NSRect contentRect;
BOOL isCustom = NO; BOOL isCustom = NO;
...@@ -774,7 +774,7 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width, ...@@ -774,7 +774,7 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
/* For OpenGL, we bind the context to a subview */ /* For OpenGL, we bind the context to a subview */
if ( flags & SDL_OPENGL ) { if ( flags & SDL_OPENGL ) {
if ( ! QZ_SetupOpenGL (this, bpp, flags) ) { if ( ! QZ_SetupOpenGL (this, *bpp, flags) ) {
return NULL; return NULL;
} }
...@@ -789,6 +789,7 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width, ...@@ -789,6 +789,7 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
} }
/* For 2D, we set the subview to an NSQuickDrawView */ /* For 2D, we set the subview to an NSQuickDrawView */
else { else {
short qdbpp = 0;
/* Only recreate the view if it doesn't already exist */ /* Only recreate the view if it doesn't already exist */
if (window_view == nil) { if (window_view == nil) {
...@@ -803,8 +804,12 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width, ...@@ -803,8 +804,12 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
LockPortBits ( [ window_view qdPort ] ); LockPortBits ( [ window_view qdPort ] );
current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ window_view qdPort ] ) ); current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ window_view qdPort ] ) );
current->pitch = GetPixRowBytes ( GetPortPixMap ( [ window_view qdPort ] ) ); current->pitch = GetPixRowBytes ( GetPortPixMap ( [ window_view qdPort ] ) );
qdbpp = GetPixDepth ( GetPortPixMap ( [ window_view qdPort ] ) );
UnlockPortBits ( [ window_view qdPort ] ); UnlockPortBits ( [ window_view qdPort ] );
/* QuickDraw may give a 16-bit shadow surface on 8-bit displays! */
*bpp = qdbpp;
current->flags |= SDL_SWSURFACE; current->flags |= SDL_SWSURFACE;
current->flags |= SDL_PREALLOC; current->flags |= SDL_PREALLOC;
current->flags |= SDL_ASYNCBLIT; current->flags |= SDL_ASYNCBLIT;
...@@ -819,7 +824,7 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width, ...@@ -819,7 +824,7 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
int hOffset = [ window_view frame ].origin.x; int hOffset = [ window_view frame ].origin.x;
current->pixels += (vOffset * current->pitch) + hOffset * (device_bpp/8); current->pixels += (vOffset * current->pitch) + hOffset * (qdbpp/8);
} }
this->UpdateRects = QZ_UpdateRects; this->UpdateRects = QZ_UpdateRects;
this->LockHWSurface = QZ_LockWindow; this->LockHWSurface = QZ_LockWindow;
...@@ -848,7 +853,7 @@ static SDL_Surface* QZ_SetVideoMode (_THIS, SDL_Surface *current, int width, ...@@ -848,7 +853,7 @@ static SDL_Surface* QZ_SetVideoMode (_THIS, SDL_Surface *current, int width,
else { else {
/* Force bpp to the device's bpp */ /* Force bpp to the device's bpp */
bpp = device_bpp; bpp = device_bpp;
current = QZ_SetVideoWindowed (this, current, width, height, bpp, flags); current = QZ_SetVideoWindowed (this, current, width, height, &bpp, flags);
if (current == NULL) if (current == NULL)
return NULL; return NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment