From 8927bcfd339510deedb89ff274ea9cd1d00a2668 Mon Sep 17 00:00:00 2001 From: aliguori Date: Thu, 15 Jan 2009 22:07:16 +0000 Subject: remove bgr (Stefano Stabellini) Do not handle bgr host displays in the backends. Right now a bgr flag exists so that sdl can set it, if the SDL_Surface is bgr. Afterwards the graphic device (e.g. vga.c) does the needed conversion. With this patch series is sdl that is responsible for rendering the format provided by the graphic device that must provide a DisplaySurface (ds->surface) in 16 or 32 bpp, rgb. Afterwards sdl creates a SDL_Surface from the given DisplaySurface and blits it into the main SDL_Surface using SDL_BlitSurface. Everything is handled by sdl transparently, because SDL_BlitSurface is perfectly capable of handling bgr displays by itself. Signed-off-by: Stefano Stabellini Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6335 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/sm501.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'hw/sm501.c') diff --git a/hw/sm501.c b/hw/sm501.c index 0d6b08b..0dfd08a 100644 --- a/hw/sm501.c +++ b/hw/sm501.c @@ -940,25 +940,16 @@ static draw_line_func * draw_line32_funcs[] = { static inline int get_depth_index(DisplayState *s) { - switch(s->depth) { + switch(ds_get_bits_per_pixel(s)) { default: case 8: return 0; case 15: - if (s->bgr) - return 5; - else - return 1; + return 1; case 16: - if (s->bgr) - return 6; - else - return 2; + return 2; case 32: - if (s->bgr) - return 4; - else - return 3; + return 3; } } @@ -970,7 +961,7 @@ static void sm501_draw_crt(SM501State * s) uint8_t * src = s->local_mem; int src_bpp = 0; - int dst_bpp = s->ds->depth / 8 + (s->ds->depth % 8 ? 1 : 0); + int dst_bpp = ds_get_bytes_per_pixel(s->ds) + (ds_get_bits_per_pixel(s->ds) % 8 ? 1 : 0); uint32_t * palette = (uint32_t *)&s->dc_palette[SM501_DC_CRT_PALETTE - SM501_DC_PANEL_PALETTE]; int ds_depth_index = get_depth_index(s->ds); @@ -1024,7 +1015,7 @@ static void sm501_draw_crt(SM501State * s) /* draw line and change status */ if (update) { - draw_line(&s->ds->data[y * width * dst_bpp], src, width, palette); + draw_line(&(ds_get_data(s->ds)[y * width * dst_bpp]), src, width, palette); if (y_start < 0) y_start = y; if (page0 < page_min) -- cgit v1.1