Mercurial > sdl-ios-xcode
comparison src/video/SDL_pixels.c @ 50:eda2f15ffb70
Oops, back it out...
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Thu, 07 Jun 2001 15:04:04 +0000 |
parents | f97decee03a9 |
children | e8157fcb3114 |
comparison
equal
deleted
inserted
replaced
49:6f3c474f9abd | 50:eda2f15ffb70 |
---|---|
462 static Uint8 *Map1toN(SDL_Palette *src, SDL_PixelFormat *dst) | 462 static Uint8 *Map1toN(SDL_Palette *src, SDL_PixelFormat *dst) |
463 { | 463 { |
464 Uint8 *map; | 464 Uint8 *map; |
465 int i; | 465 int i; |
466 int bpp; | 466 int bpp; |
467 unsigned alpha; | |
467 | 468 |
468 bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel); | 469 bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel); |
469 map = (Uint8 *)malloc(src->ncolors*bpp); | 470 map = (Uint8 *)malloc(src->ncolors*bpp); |
470 if ( map == NULL ) { | 471 if ( map == NULL ) { |
471 SDL_OutOfMemory(); | 472 SDL_OutOfMemory(); |
472 return(NULL); | 473 return(NULL); |
473 } | 474 } |
474 | 475 |
476 alpha = dst->Amask ? SDL_ALPHA_OPAQUE : 0; | |
475 /* We memory copy to the pixel map so the endianness is preserved */ | 477 /* We memory copy to the pixel map so the endianness is preserved */ |
476 for ( i=0; i<src->ncolors; ++i ) { | 478 for ( i=0; i<src->ncolors; ++i ) { |
477 ASSEMBLE_RGBA(&map[i*bpp], dst->BytesPerPixel, dst, | 479 ASSEMBLE_RGBA(&map[i*bpp], dst->BytesPerPixel, dst, |
478 src->colors[i].r, src->colors[i].g, | 480 src->colors[i].r, src->colors[i].g, |
479 src->colors[i].b, SDL_ALPHA_OPAQUE); | 481 src->colors[i].b, alpha); |
480 } | 482 } |
481 return(map); | 483 return(map); |
482 } | 484 } |
483 /* Map from BitField to Dithered-Palette to Palette */ | 485 /* Map from BitField to Dithered-Palette to Palette */ |
484 static Uint8 *MapNto1(SDL_PixelFormat *src, SDL_Palette *dst, int *identical) | 486 static Uint8 *MapNto1(SDL_PixelFormat *src, SDL_Palette *dst, int *identical) |