SDL_HWPALETTE fix (submitted by tehpola)

This commit is contained in:
dborth 2009-05-13 08:36:39 +00:00
parent 9b4b52aba7
commit b32c91e970

View file

@ -281,9 +281,9 @@ SDL_Surface *WII_SetVideoMode(_THIS, SDL_Surface *current,
return NULL; return NULL;
} }
if(bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32) if(bpp != 8 && bpp != 16 && bpp != 24)
{ {
SDL_SetError("Resolution (%d bpp) is unsupported (8 or 16 bpp only).", SDL_SetError("Resolution (%d bpp) is unsupported (8/16/24 bpp only).",
bpp); bpp);
return NULL; return NULL;
} }
@ -319,7 +319,7 @@ SDL_Surface *WII_SetVideoMode(_THIS, SDL_Surface *current,
SDL_memset(this->hidden->buffer, 0, width * height * bytes_per_pixel); SDL_memset(this->hidden->buffer, 0, width * height * bytes_per_pixel);
// Set up the new mode framebuffer // Set up the new mode framebuffer
current->flags = SDL_DOUBLEBUF |( flags & SDL_FULLSCREEN); current->flags = SDL_DOUBLEBUF | (flags & SDL_FULLSCREEN) | (flags & SDL_HWPALETTE);
current->w = width; current->w = width;
current->h = height; current->h = height;
current->pitch = current->w * bytes_per_pixel; current->pitch = current->w * bytes_per_pixel;
@ -380,7 +380,7 @@ static void flipHWSurface_8_16(_THIS, SDL_Surface *surface)
for (w = 0; w < this->hidden->width; w++) for (w = 0; w < this->hidden->width; w++)
{ {
Uint16 v = palette[*ptr]; Uint16 v = palette[*ptr];
*ptr_cv++ = v; *ptr_cv++ = v;
ptr++; ptr++;
} }
@ -484,7 +484,7 @@ static void flipHWSurface_24_16(_THIS, SDL_Surface *surface)
r = *ptr++; r = *ptr++;
g = *ptr++; g = *ptr++;
b = *ptr++; b = *ptr++;
*ptr_cv++ = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); *ptr_cv++ = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
} }
} }