X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=ui%2Fsdl2-2d.c;h=06468cd493eade8a43f17bb9708f9d23e9ee1449;hb=4789f9d3a16dbd8139d935ec3c5008d0fbd40f88;hp=85484407bea10c65cba427760b96b01317662dac;hpb=dba0f15a3b3a2e72a526be665efad73f3c34a5dd;p=qmiga%2Fqemu.git diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c index 85484407be..06468cd493 100644 --- a/ui/sdl2-2d.c +++ b/ui/sdl2-2d.c @@ -24,24 +24,19 @@ /* Ported SDL 1.2 code to 2.0 by Dave Airlie. */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "ui/console.h" #include "ui/input.h" #include "ui/sdl2.h" -#include "sysemu/sysemu.h" void sdl2_2d_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl); - DisplaySurface *surf = qemu_console_surface(dcl->con); + DisplaySurface *surf = scon->surface; SDL_Rect rect; size_t surface_data_offset; assert(!scon->opengl); - if (!surf) { - return; - } if (!scon->texture) { return; } @@ -77,7 +72,7 @@ void sdl2_2d_switch(DisplayChangeListener *dcl, scon->texture = NULL; } - if (!new_surface) { + if (is_placeholder(new_surface) && qemu_console_get_index(dcl->con)) { sdl2_window_destroy(scon); return; } @@ -101,15 +96,24 @@ void sdl2_2d_switch(DisplayChangeListener *dcl, case PIXMAN_r5g6b5: format = SDL_PIXELFORMAT_RGB565; break; + case PIXMAN_a8r8g8b8: case PIXMAN_x8r8g8b8: format = SDL_PIXELFORMAT_ARGB8888; break; + case PIXMAN_a8b8g8r8: + case PIXMAN_x8b8g8r8: + format = SDL_PIXELFORMAT_ABGR8888; + break; + case PIXMAN_r8g8b8a8: case PIXMAN_r8g8b8x8: format = SDL_PIXELFORMAT_RGBA8888; break; case PIXMAN_b8g8r8x8: format = SDL_PIXELFORMAT_BGRX8888; break; + case PIXMAN_b8g8r8a8: + format = SDL_PIXELFORMAT_BGRA8888; + break; default: g_assert_not_reached(); } @@ -146,10 +150,16 @@ bool sdl2_2d_check_format(DisplayChangeListener *dcl, { /* * We let SDL convert for us a few more formats than, - * the native ones. Thes are the ones I have tested. + * the native ones. These are the ones I have tested. */ return (format == PIXMAN_x8r8g8b8 || + format == PIXMAN_a8r8g8b8 || + format == PIXMAN_a8b8g8r8 || + format == PIXMAN_x8b8g8r8 || format == PIXMAN_b8g8r8x8 || + format == PIXMAN_b8g8r8a8 || + format == PIXMAN_r8g8b8x8 || + format == PIXMAN_r8g8b8a8 || format == PIXMAN_x1r5g5b5 || format == PIXMAN_r5g6b5); }