Return an error with color fills on less than 8 bpp surfaces.
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40533
This commit is contained in:
parent
d0b835b8ee
commit
9e98e499b1
1 changed files with 30 additions and 0 deletions
|
@ -524,6 +524,20 @@ int SDL_UpperBlit (SDL_Surface *src, SDL_Rect *srcrect,
|
||||||
return 0;
|
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'
|
* This function performs a fast fill of the given rectangle with 'color'
|
||||||
*/
|
*/
|
||||||
|
@ -534,6 +548,22 @@ int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color)
|
||||||
int x, y;
|
int x, y;
|
||||||
Uint8 *row;
|
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' == NULL, then fill the whole surface */
|
||||||
if ( dstrect ) {
|
if ( dstrect ) {
|
||||||
/* Perform clipping */
|
/* Perform clipping */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue