Skip to contentSkip to conversation

[4936] Fix detection of 15 bit display depth

Qemu-devel Blue Swirl 1 participant 1 message Jul 24, 2008

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

Revision: 4936

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4936
Author:   blueswir1
Date:     2008-07-24 11:25:30 +0000 (Thu, 24 Jul 2008)

Log Message:
-----------
Fix detection of 15 bit display depth

Modified Paths:
--------------
trunk/sdl.c

Modified: trunk/sdl.c
===================================================================

sdl.c +11 -0
@@ -89,6 +89,17 @@
     ds->data = screen->pixels;
     ds->linesize = screen->pitch;
     ds->depth = screen->format->BitsPerPixel;
+    /* SDL BitsPerPixel never indicates any values other than
+       multiples of 8, so we need to check for strange depths. */
+    if (ds->depth == 16) {
+        uint32_t mask;
+
+        mask = screen->format->Rmask;
+        mask |= screen->format->Gmask;
+        mask |= screen->format->Bmask;
+        if ((mask & 0x8000) == 0)
+            ds->depth = 15;
+    }
     if (ds->depth == 32 && screen->format->Rshift == 0) {
         ds->bgr = 1;
     } else {