comparison src/video/SDL_pixels.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 eef792d31de8
children 396a35389351
comparison
equal deleted inserted replaced
1681:80a5e6a4e1e2 1682:7ae8018b2e5d
384 #ifdef ENABLE_PALETTE_ALPHA 384 #ifdef ENABLE_PALETTE_ALPHA
385 a = (i & Amask) >> format->Ashift; 385 a = (i & Amask) >> format->Ashift;
386 a = (a << format->Aloss) | ((a * Am) >> Aw); 386 a = (a << format->Aloss) | ((a * Am) >> Aw);
387 format->palette->colors[i].unused = a; 387 format->palette->colors[i].unused = a;
388 #else 388 #else
389 format->palette->colors[i].unused = 0; 389 format->palette->colors[i].unused = SDL_ALPHA_OPAQUE;
390 #endif 390 #endif
391 } 391 }
392 } else if (ncolors == 2) { 392 } else if (ncolors == 2) {
393 /* Create a black and white bitmap palette */ 393 /* Create a black and white bitmap palette */
394 format->palette->colors[0].r = 0xFF; 394 format->palette->colors[0].r = 0xFF;
397 format->palette->colors[1].r = 0x00; 397 format->palette->colors[1].r = 0x00;
398 format->palette->colors[1].g = 0x00; 398 format->palette->colors[1].g = 0x00;
399 format->palette->colors[1].b = 0x00; 399 format->palette->colors[1].b = 0x00;
400 } else { 400 } else {
401 /* Create an empty palette */ 401 /* Create an empty palette */
402 SDL_memset((format->palette)->colors, 0, 402 SDL_memset((format->palette)->colors, 0xFF,
403 (format->palette)->ncolors * sizeof(SDL_Color)); 403 (format->palette)->ncolors * sizeof(SDL_Color));
404 } 404 }
405 } 405 }
406 return (format); 406 return (format);
407 } 407 }
472 colors[i].g = g; 472 colors[i].g = g;
473 b = i & 0x3; 473 b = i & 0x3;
474 b |= b << 2; 474 b |= b << 2;
475 b |= b << 4; 475 b |= b << 4;
476 colors[i].b = b; 476 colors[i].b = b;
477 colors[i].unused = SDL_ALPHA_OPAQUE;
477 } 478 }
478 } 479 }
479 480
480 /* 481 /*
481 * Calculate the pad-aligned scanline width of a surface 482 * Calculate the pad-aligned scanline width of a surface
694 SDL_Color colors[256]; 695 SDL_Color colors[256];
695 SDL_Palette *pal = dst->palette; 696 SDL_Palette *pal = dst->palette;
696 697
697 /* SDL_DitherColors does not initialize the 'unused' component of colors, 698 /* SDL_DitherColors does not initialize the 'unused' component of colors,
698 but Map1to1 compares it against pal, so we should initialize it. */ 699 but Map1to1 compares it against pal, so we should initialize it. */
699 SDL_memset(colors, 0, sizeof(colors)); 700 SDL_memset(colors, 0xFF, sizeof(colors));
700 701
701 dithered.ncolors = 256; 702 dithered.ncolors = 256;
702 SDL_DitherColors(colors, 8); 703 SDL_DitherColors(colors, 8);
703 dithered.colors = colors; 704 dithered.colors = colors;
704 return (Map1to1(&dithered, pal, identical)); 705 return (Map1to1(&dithered, pal, identical));