]> Git Repo - qemu.git/commitdiff
sdl2: Fix RGB555
authorMax Reitz <[email protected]>
Tue, 3 Mar 2015 17:25:27 +0000 (12:25 -0500)
committerGerd Hoffmann <[email protected]>
Tue, 5 May 2015 08:48:26 +0000 (10:48 +0200)
Reproducable with:

$ x86_64-softmmu/qemu-system-x86_64 \
    -kernel $vmlinuz_of_your_choice \
    -append vga=0x313 -sdl

Signed-off-by: Max Reitz <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
include/ui/console.h
ui/sdl2-2d.c

index d2116927f9bfaa65f282cf05ff8d8f24eff5c648..0b7589600b6e7f4ed5c60c9cc42f40b79de3ed66 100644 (file)
@@ -280,6 +280,11 @@ static inline int surface_bytes_per_pixel(DisplaySurface *s)
     return (bits + 7) / 8;
 }
 
+static inline pixman_format_code_t surface_format(DisplaySurface *s)
+{
+    return s->format;
+}
+
 #ifdef CONFIG_CURSES
 #include <curses.h>
 typedef chtype console_ch_t;
index bb567471400a7fcbd487d5e4ae553b188bed98b0..d0b340f956392bed969a7a1c7e5722e905a4fdf4 100644 (file)
@@ -89,10 +89,21 @@ void sdl2_2d_switch(DisplayChangeListener *dcl,
                              surface_width(new_surface),
                              surface_height(new_surface));
 
-    if (surface_bits_per_pixel(scon->surface) == 16) {
+    switch (surface_format(scon->surface)) {
+    case PIXMAN_x1r5g5b5:
+        format = SDL_PIXELFORMAT_ARGB1555;
+        break;
+    case PIXMAN_r5g6b5:
         format = SDL_PIXELFORMAT_RGB565;
-    } else if (surface_bits_per_pixel(scon->surface) == 32) {
+        break;
+    case PIXMAN_x8r8g8b8:
         format = SDL_PIXELFORMAT_ARGB8888;
+        break;
+    case PIXMAN_r8g8b8x8:
+        format = SDL_PIXELFORMAT_RGBA8888;
+        break;
+    default:
+        g_assert_not_reached();
     }
     scon->texture = SDL_CreateTexture(scon->real_renderer, format,
                                       SDL_TEXTUREACCESS_STREAMING,
This page took 0.041114 seconds and 4 git commands to generate.