fix vga draw_text duplications
PATCH 1/1 fix vga draw_text duplications
Hi all,
the last qemu merge left some code dups in vga_draw_text, this patch fixes them.
Signed-off-by Stefano Stabellini <[email protected]>
---
hw/vga.c +9 -44
@@ -1248,48 +1248,6 @@ static void vga_draw_text(VGAState *s, int full_update)/* Disable dirty bit tracking */ xc_hvm_track_dirty_vram (xc_handle, domid,0 ,0 ,NULL ); -/* total width & height */ - cheight = (s->cr[9 ] &0x1f ) +1 ; - cw =8 ; -if (!(s->sr[1 ] &0x01 )) - cw =9 ; -if (s->sr[1 ] &0x08 ) - cw =16 ;/* NOTE: no 18 pixel wide */ - width = (s->cr[0x01 ] +1 ); -if (s->cr[0x06 ] ==100 ) { -/* ugly hack for CGA 160x100x16 - explain me the logic */ - height =100 ; - }else { - height = s->cr[0x12 ] | - ((s->cr[0x07 ] &0x02 ) <<7 ) | - ((s->cr[0x07 ] &0x40 ) <<3 ); - height = (height +1 ) / cheight; - } -if ((height * width) >CH_ATTR_SIZE ) { -/* better than nothing: exit if transient size is too big */ -return ; - } - -if (width != s->last_width || height != s->last_height || - cw != s->last_cw || cheight != s->last_ch || s->last_depth) { - s->last_scr_width = width * cw; - s->last_scr_height = height * cheight; -qemu_console_resize (s->ds, s->last_scr_width, s->last_scr_height); - s->last_depth =0 ; - s->last_width = width; - s->last_height = height; - s->last_ch = cheight; - s->last_cw = cw; - full_update =1 ; - } - - s->rgb_to_pixel = - rgb_to_pixel_dup_table[get_depth_index (s->ds)]; - - full_update |=update_palette16 (s); - palette = s->last_palette; - - x_incr = cw *ds_get_bytes_per_pixel (s->ds);/* compute font data address (in plane 2) */ v = s->sr[3 ]; offset = (((v >>4 ) &1 ) | ((v <<1 ) &6 )) *8192 *4 +2 ;
@@ -1323,7 +1281,6 @@ static void vga_draw_text(VGAState *s, int full_update) cw =9 ;if (s->sr[1 ] &0x08 ) cw =16 ;/* NOTE: no 18 pixel wide */ - x_incr = cw *ds_get_bytes_per_pixel (s->ds); width = (s->cr[0x01 ] +1 );if (s->cr[0x06 ] ==100 ) {/* ugly hack for CGA 160x100x16 - explain me the logic */
@@ -1340,16 +1297,24 @@ static void vga_draw_text(VGAState *s, int full_update) }if (width != s->last_width || height != s->last_height || - cw != s->last_cw || cheight != s->last_ch) { + cw != s->last_cw || cheight != s->last_ch || s->last_depth) { s->last_scr_width = width * cw; s->last_scr_height = height * cheight;qemu_console_resize (s->ds, s->last_scr_width, s->last_scr_height); + s->last_depth =0 ; s->last_width = width; s->last_height = height; s->last_ch = cheight; s->last_cw = cw; full_update =1 ; } + + s->rgb_to_pixel = + rgb_to_pixel_dup_table[get_depth_index (s->ds)]; + full_update |=update_palette16 (s); + palette = s->last_palette; + x_incr = cw *ds_get_bytes_per_pixel (s->ds); + cursor_offset = ((s->cr[0x0e ] <<8 ) | s->cr[0x0f ]) - s->start_addr; if (cursor_offset != s->cursor_offset || s->cr[0xa] != s->cursor_start ||