comparison src/video/SDL_surface.c @ 1682:7ae8018b2e5d SDL-1.3

Default palette entries to white, instead of black. More palettized video mode support...
author Sam Lantinga <slouken@libsdl.org>
date Fri, 16 Jun 2006 06:00:31 +0000
parents 90bf530ced8e
children 396a35389351
comparison
equal deleted inserted replaced
1681:80a5e6a4e1e2 1682:7ae8018b2e5d
37 SDL_Surface * 37 SDL_Surface *
38 SDL_CreateRGBSurface(Uint32 flags, 38 SDL_CreateRGBSurface(Uint32 flags,
39 int width, int height, int depth, 39 int width, int height, int depth,
40 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) 40 Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
41 { 41 {
42 SDL_VideoDevice *_this = SDL_GetVideoDevice();
43 SDL_Surface *screen; 42 SDL_Surface *screen;
44 SDL_Surface *surface; 43 SDL_Surface *surface;
45 44
46 /* FIXME!! */ 45 /* FIXME!! */
47 /* Make sure the size requested doesn't overflow our datatypes */ 46 /* Make sure the size requested doesn't overflow our datatypes */
168 167
169 /* 168 /*
170 * Set the palette in a blittable surface 169 * Set the palette in a blittable surface
171 */ 170 */
172 int 171 int
173 SDL_SetColors(SDL_Surface * surface, SDL_Color * colors, int firstcolor, 172 SDL_SetColors(SDL_Surface * surface, const SDL_Color * colors, int firstcolor,
174 int ncolors) 173 int ncolors)
175 { 174 {
176 SDL_Palette *pal; 175 SDL_Palette *pal;
177 int gotall; 176 int gotall;
178 int palsize; 177 int palsize;
555 * This function performs a fast fill of the given rectangle with 'color' 554 * This function performs a fast fill of the given rectangle with 'color'
556 */ 555 */
557 int 556 int
558 SDL_FillRect(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color) 557 SDL_FillRect(SDL_Surface * dst, SDL_Rect * dstrect, Uint32 color)
559 { 558 {
560 SDL_VideoDevice *_this = SDL_GetVideoDevice();
561 int x, y; 559 int x, y;
562 Uint8 *row; 560 Uint8 *row;
563 561
564 /* This function doesn't work on surfaces < 8 bpp */ 562 /* This function doesn't work on surfaces < 8 bpp */
565 if (dst->format->BitsPerPixel < 8) { 563 if (dst->format->BitsPerPixel < 8) {
787 785
788 /* Check for empty destination palette! (results in empty image) */ 786 /* Check for empty destination palette! (results in empty image) */
789 if (format->palette != NULL) { 787 if (format->palette != NULL) {
790 int i; 788 int i;
791 for (i = 0; i < format->palette->ncolors; ++i) { 789 for (i = 0; i < format->palette->ncolors; ++i) {
792 if ((format->palette->colors[i].r != 0) || 790 if ((format->palette->colors[i].r != 0xFF) ||
793 (format->palette->colors[i].g != 0) || 791 (format->palette->colors[i].g != 0xFF) ||
794 (format->palette->colors[i].b != 0)) 792 (format->palette->colors[i].b != 0xFF))
795 break; 793 break;
796 } 794 }
797 if (i == format->palette->ncolors) { 795 if (i == format->palette->ncolors) {
798 SDL_SetError("Empty destination palette"); 796 SDL_SetError("Empty destination palette");
799 return (NULL); 797 return (NULL);