Support the new 16-bit formats in SDL_MasksToPixelFormatEnum()
authorSam Lantinga <slouken@libsdl.org>
Wed, 12 Jan 2011 15:21:12 -0800
changeset 4983 b49d3869ebd2
parent 4982 660d3a432102
child 4984 889e6fef8fc5
Support the new 16-bit formats in SDL_MasksToPixelFormatEnum()
src/video/SDL_pixels.c
--- 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: