# HG changeset patch # User Sam Lantinga # Date 1034659370 0 # Node ID 058d47b7a3b4652553e46ac62f0819bff44952c4 # Parent 8450e66651ea7c03b2525c06e0f3eca169542422 Return an error with color fills on less than 8 bpp surfaces. diff -r 8450e66651ea -r 058d47b7a3b4 src/video/SDL_surface.c --- a/src/video/SDL_surface.c Tue Oct 15 04:26:20 2002 +0000 +++ b/src/video/SDL_surface.c Tue Oct 15 05:22:50 2002 +0000 @@ -524,6 +524,20 @@ return 0; } +static int SDL_FillRect1(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) +{ + /* FIXME: We have to worry about packing order.. *sigh* */ + SDL_SetError("1-bpp rect fill not yet implemented"); + return -1; +} + +static int SDL_FillRect4(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) +{ + /* FIXME: We have to worry about packing order.. *sigh* */ + SDL_SetError("4-bpp rect fill not yet implemented"); + return -1; +} + /* * This function performs a fast fill of the given rectangle with 'color' */ @@ -534,6 +548,22 @@ int x, y; Uint8 *row; + /* This function doesn't work on surfaces < 8 bpp */ + if ( dst->format->BitsPerPixel < 8 ) { + switch(dst->format->BitsPerPixel) { + case 1: + return SDL_FillRect1(dst, dstrect, color); + break; + case 4: + return SDL_FillRect4(dst, dstrect, color); + break; + default: + SDL_SetError("Fill rect on unsupported surface format"); + return(-1); + break; + } + } + /* If 'dstrect' == NULL, then fill the whole surface */ if ( dstrect ) { /* Perform clipping */