Mercurial > sdl-ios-xcode
comparison src/video/SDL_pixels.c @ 3182:9f82979eaaf0
Support for 24 bpp pixel formats has been added.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Wed, 10 Jun 2009 05:51:44 +0000 |
parents | a252014ce27d |
children | 2b95b2c0b6d4 |
comparison
equal
deleted
inserted
replaced
3181:030899df1af5 | 3182:9f82979eaaf0 |
---|---|
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_BITSPERPIXEL(format) == 24) { | 42 if (SDL_BYTESPERPIXEL(format) == 3) { |
43 *bpp = SDL_BYTESPERPIXEL(format) * 8; | 43 *bpp = SDL_BYTESPERPIXEL(format) * 8; |
44 } else { | 44 } else { |
45 *bpp = SDL_BITSPERPIXEL(format); | 45 *bpp = SDL_BITSPERPIXEL(format); |
46 } | 46 } |
47 *Rmask = *Gmask = *Bmask = *Amask = 0; | 47 *Rmask = *Gmask = *Bmask = *Amask = 0; |
201 return SDL_PIXELFORMAT_ARGB1555; | 201 return SDL_PIXELFORMAT_ARGB1555; |
202 case 0xF800: | 202 case 0xF800: |
203 return SDL_PIXELFORMAT_RGB565; | 203 return SDL_PIXELFORMAT_RGB565; |
204 } | 204 } |
205 break; | 205 break; |
206 case 24: | |
207 switch (Rmask) { | |
208 case 0x00FF0000: | |
209 return SDL_PIXELFORMAT_RGB888; | |
210 case 0x000000FF: | |
211 return SDL_PIXELFORMAT_BGR888; | |
212 case 0x00000000: | |
213 /* FIXME: At this point we can't distinguish */ | |
214 /* if this format is RGB24 or BGR24 */ | |
215 return SDL_PIXELFORMAT_RGB24; | |
216 } | |
206 case 32: | 217 case 32: |
207 switch (Rmask) { | 218 switch (Rmask) { |
208 case 0xFF000000: | 219 case 0xFF000000: |
209 if (Amask == 0x000000FF) { | 220 if (Amask == 0x000000FF) { |
210 return SDL_PIXELFORMAT_RGBA8888; | 221 return SDL_PIXELFORMAT_RGBA8888; |