Skip to content

Commit

Permalink
Fixed bug reported here:
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Nov 22, 2005
1 parent a5e0fed commit 8b6f3d6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/video/quartz/SDL_QuartzVideo.m
Expand Up @@ -656,7 +656,7 @@ other blitting while waiting on the VBL (and hence results in higher framerates)
}

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;
NSRect contentRect;
BOOL isCustom = NO;
Expand Down Expand Up @@ -774,7 +774,7 @@ other blitting while waiting on the VBL (and hence results in higher framerates)
/* For OpenGL, we bind the context to a subview */
if ( flags & SDL_OPENGL ) {

if ( ! QZ_SetupOpenGL (this, bpp, flags) ) {
if ( ! QZ_SetupOpenGL (this, *bpp, flags) ) {
return NULL;
}

Expand All @@ -789,6 +789,7 @@ other blitting while waiting on the VBL (and hence results in higher framerates)
}
/* For 2D, we set the subview to an NSQuickDrawView */
else {
short qdbpp = 0;

/* Only recreate the view if it doesn't already exist */
if (window_view == nil) {
Expand All @@ -803,8 +804,12 @@ other blitting while waiting on the VBL (and hence results in higher framerates)
LockPortBits ( [ window_view qdPort ] );
current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ window_view qdPort ] ) );
current->pitch = GetPixRowBytes ( GetPortPixMap ( [ window_view qdPort ] ) );
qdbpp = GetPixDepth ( GetPortPixMap ( [ 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_PREALLOC;
current->flags |= SDL_ASYNCBLIT;
Expand All @@ -819,7 +824,7 @@ other blitting while waiting on the VBL (and hence results in higher framerates)

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->LockHWSurface = QZ_LockWindow;
Expand Down Expand Up @@ -848,7 +853,7 @@ other blitting while waiting on the VBL (and hence results in higher framerates)
else {
/* Force bpp to the device's 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)
return NULL;
}
Expand Down

0 comments on commit 8b6f3d6

Please sign in to comment.