mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-16 06:31:51 -06:00
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>
This commit is contained in:
parent
0b71a5d5ca
commit
e444ea34f8
2 changed files with 18 additions and 2 deletions
|
@ -280,6 +280,11 @@ static inline int surface_bytes_per_pixel(DisplaySurface *s)
|
||||||
return (bits + 7) / 8;
|
return (bits + 7) / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline pixman_format_code_t surface_format(DisplaySurface *s)
|
||||||
|
{
|
||||||
|
return s->format;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_CURSES
|
#ifdef CONFIG_CURSES
|
||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
typedef chtype console_ch_t;
|
typedef chtype console_ch_t;
|
||||||
|
|
15
ui/sdl2-2d.c
15
ui/sdl2-2d.c
|
@ -89,10 +89,21 @@ void sdl2_2d_switch(DisplayChangeListener *dcl,
|
||||||
surface_width(new_surface),
|
surface_width(new_surface),
|
||||||
surface_height(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;
|
format = SDL_PIXELFORMAT_RGB565;
|
||||||
} else if (surface_bits_per_pixel(scon->surface) == 32) {
|
break;
|
||||||
|
case PIXMAN_x8r8g8b8:
|
||||||
format = SDL_PIXELFORMAT_ARGB8888;
|
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,
|
scon->texture = SDL_CreateTexture(scon->real_renderer, format,
|
||||||
SDL_TEXTUREACCESS_STREAMING,
|
SDL_TEXTUREACCESS_STREAMING,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue