Commit 749ecd9953a2d624be9c52a3a12c915dd252274b
1 parent
6926be2a
Fix detection of 15 bit display depth
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4936 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
11 additions
and
0 deletions
sdl.c
@@ -89,6 +89,17 @@ static void sdl_resize(DisplayState *ds, int w, int h) | @@ -89,6 +89,17 @@ static void sdl_resize(DisplayState *ds, int w, int h) | ||
89 | ds->data = screen->pixels; | 89 | ds->data = screen->pixels; |
90 | ds->linesize = screen->pitch; | 90 | ds->linesize = screen->pitch; |
91 | ds->depth = screen->format->BitsPerPixel; | 91 | ds->depth = screen->format->BitsPerPixel; |
92 | + /* SDL BitsPerPixel never indicates any values other than | ||
93 | + multiples of 8, so we need to check for strange depths. */ | ||
94 | + if (ds->depth == 16) { | ||
95 | + uint32_t mask; | ||
96 | + | ||
97 | + mask = screen->format->Rmask; | ||
98 | + mask |= screen->format->Gmask; | ||
99 | + mask |= screen->format->Bmask; | ||
100 | + if ((mask & 0x8000) == 0) | ||
101 | + ds->depth = 15; | ||
102 | + } | ||
92 | if (ds->depth == 32 && screen->format->Rshift == 0) { | 103 | if (ds->depth == 32 && screen->format->Rshift == 0) { |
93 | ds->bgr = 1; | 104 | ds->bgr = 1; |
94 | } else { | 105 | } else { |