changeset 4983:b49d3869ebd2

Support the new 16-bit formats in SDL_MasksToPixelFormatEnum()
author Sam Lantinga <slouken@libsdl.org>
date Wed, 12 Jan 2011 15:21:12 -0800
parents 660d3a432102
children 889e6fef8fc5
files src/video/SDL_pixels.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_pixels.c	Wed Jan 12 14:53:23 2011 -0800
+++ b/src/video/SDL_pixels.c	Wed Jan 12 15:21:12 2011 -0800
@@ -265,6 +265,12 @@
         break;
     case 16:
         switch (Rmask) {
+        case 0xF000:
+            return SDL_PIXELFORMAT_RGBA4444;
+        case 0x0F00:
+            return SDL_PIXELFORMAT_ARGB4444;
+        case 0x00F0:
+            return SDL_PIXELFORMAT_BGRA4444;
         case 0x000F:
             return SDL_PIXELFORMAT_ABGR4444;
         case 0x001F:
@@ -272,12 +278,13 @@
                 return SDL_PIXELFORMAT_BGR565;
             }
             return SDL_PIXELFORMAT_ABGR1555;
-        case 0x0F00:
-            return SDL_PIXELFORMAT_ARGB4444;
         case 0x7C00:
             return SDL_PIXELFORMAT_ARGB1555;
         case 0xF800:
-            return SDL_PIXELFORMAT_RGB565;
+            if (Gmask == 0x07E0) {
+                return SDL_PIXELFORMAT_RGB565;
+            }
+            return SDL_PIXELFORMAT_RGBA5551;
         }
         break;
     case 24: