Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Support for 24 bpp pixel formats has been added.
Browse files Browse the repository at this point in the history
  • Loading branch information
llmike committed Jun 10, 2009
1 parent aa2cdd7 commit c941ffd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/video/SDL_pixels.c
Expand Up @@ -39,7 +39,7 @@ SDL_PixelFormatEnumToMasks(Uint32 format, int *bpp, Uint32 * Rmask,
Uint32 masks[4];

/* Initialize the values here */
if (SDL_BITSPERPIXEL(format) == 24) {
if (SDL_BYTESPERPIXEL(format) == 3) {
*bpp = SDL_BYTESPERPIXEL(format) * 8;
} else {
*bpp = SDL_BITSPERPIXEL(format);
Expand Down Expand Up @@ -203,6 +203,17 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
return SDL_PIXELFORMAT_RGB565;
}
break;
case 24:
switch (Rmask) {
case 0x00FF0000:
return SDL_PIXELFORMAT_RGB888;
case 0x000000FF:
return SDL_PIXELFORMAT_BGR888;
case 0x00000000:
/* FIXME: At this point we can't distinguish */
/* if this format is RGB24 or BGR24 */
return SDL_PIXELFORMAT_RGB24;
}
case 32:
switch (Rmask) {
case 0xFF000000:
Expand Down

0 comments on commit c941ffd

Please sign in to comment.