changeset 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 1ed5d432e468
children 0d7b20a4a629
files src/video/SDL_pixels.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_pixels.c	Sun Sep 20 04:15:19 2009 +0000
+++ b/src/video/SDL_pixels.c	Sun Sep 20 22:47:28 2009 +0000
@@ -39,10 +39,10 @@
     Uint32 masks[4];
 
     /* Initialize the values here */
-    if (SDL_BYTESPERPIXEL(format) == 3) {
+    if (SDL_BYTESPERPIXEL(format) <= 2) {
+        *bpp = SDL_BITSPERPIXEL(format);
+    } else {
         *bpp = SDL_BYTESPERPIXEL(format) * 8;
-    } else {
-        *bpp = SDL_BITSPERPIXEL(format);
     }
     *Rmask = *Gmask = *Bmask = *Amask = 0;