Mercurial > sdl-ios-xcode
comparison src/video/SDL_pixels.c @ 3557:7184580ab756
Added support for SDL_PIXELFORMAT_RGB24 and SDL_PIXELFORMAT_BGR24 to SDL_PixelFormatEnumToMasks()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 14 Dec 2009 06:35:27 +0000 |
parents | 7549b986ccb1 |
children | 7dec3fe9b580 |
comparison
equal
deleted
inserted
replaced
3556:9c2e92de786a | 3557:7184580ab756 |
---|---|
50 *bpp = SDL_BITSPERPIXEL(format); | 50 *bpp = SDL_BITSPERPIXEL(format); |
51 } else { | 51 } else { |
52 *bpp = SDL_BYTESPERPIXEL(format) * 8; | 52 *bpp = SDL_BYTESPERPIXEL(format) * 8; |
53 } | 53 } |
54 *Rmask = *Gmask = *Bmask = *Amask = 0; | 54 *Rmask = *Gmask = *Bmask = *Amask = 0; |
55 | |
56 if (format == SDL_PIXELFORMAT_RGB24) { | |
57 #if SDL_BYTEORDER == SDL_BIG_ENDIAN | |
58 *Rmask = 0x00FF0000; | |
59 *Gmask = 0x0000FF00; | |
60 *Bmask = 0x000000FF; | |
61 #else | |
62 *Rmask = 0x000000FF; | |
63 *Gmask = 0x0000FF00; | |
64 *Bmask = 0x00FF0000; | |
65 #endif | |
66 return SDL_TRUE; | |
67 } | |
68 | |
69 if (format == SDL_PIXELFORMAT_BGR24) { | |
70 #if SDL_BYTEORDER == SDL_BIG_ENDIAN | |
71 *Rmask = 0x000000FF; | |
72 *Gmask = 0x0000FF00; | |
73 *Bmask = 0x00FF0000; | |
74 #else | |
75 *Rmask = 0x00FF0000; | |
76 *Gmask = 0x0000FF00; | |
77 *Bmask = 0x000000FF; | |
78 #endif | |
79 return SDL_TRUE; | |
80 } | |
55 | 81 |
56 if (SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED8 && | 82 if (SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED8 && |
57 SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED16 && | 83 SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED16 && |
58 SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED32) { | 84 SDL_PIXELTYPE(format) != SDL_PIXELTYPE_PACKED32) { |
59 /* Not a format that uses masks */ | 85 /* Not a format that uses masks */ |