summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2015-03-03 12:25:27 -0500
committerGerd Hoffmann <kraxel@redhat.com>2015-05-05 10:48:26 +0200
commite444ea34f8ec27acfa9ead7eaa9904238c831e69 (patch)
tree530949bda5134c511cdd746fbaeb4ef03cb50e7c /ui
parent0b71a5d5caa4f709d37fa1d7786dffc2c94f8414 (diff)
sdl2: Fix RGB555
Reproducable with: $ x86_64-softmmu/qemu-system-x86_64 \ -kernel $vmlinuz_of_your_choice \ -append vga=0x313 -sdl Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/sdl2-2d.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c
index bb56747140..d0b340f956 100644
--- a/ui/sdl2-2d.c
+++ b/ui/sdl2-2d.c
@@ -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,