comparison src/video/SDL_pixels.c @ 3284:2b95b2c0b6d4

Fixed compatibility with SDL 1.2 pixel format (24 bits per pixel of color data with 4 bytes per pixel == 32 bpp)
author Sam Lantinga <slouken@libsdl.org>
date Sun, 20 Sep 2009 22:47:28 +0000
parents 9f82979eaaf0
children fed6d4c6c693
comparison
equal deleted inserted replaced
3283:1ed5d432e468 3284:2b95b2c0b6d4
37 Uint32 * Gmask, Uint32 * Bmask, Uint32 * Amask) 37 Uint32 * Gmask, Uint32 * Bmask, Uint32 * Amask)
38 { 38 {
39 Uint32 masks[4]; 39 Uint32 masks[4];
40 40
41 /* Initialize the values here */ 41 /* Initialize the values here */
42 if (SDL_BYTESPERPIXEL(format) == 3) { 42 if (SDL_BYTESPERPIXEL(format) <= 2) {
43 *bpp = SDL_BITSPERPIXEL(format);
44 } else {
43 *bpp = SDL_BYTESPERPIXEL(format) * 8; 45 *bpp = SDL_BYTESPERPIXEL(format) * 8;
44 } else {
45 *bpp = SDL_BITSPERPIXEL(format);
46 } 46 }
47 *Rmask = *Gmask = *Bmask = *Amask = 0; 47 *Rmask = *Gmask = *Bmask = *Amask = 0;
48 48
49 if (SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED8 && 49 if (SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED8 &&
50 SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED16 && 50 SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED16 &&