Revision 2aebb3eb hw/vga.c
b/hw/vga.c | ||
---|---|---|
109 | 109 |
uint32_t line_compare; |
110 | 110 |
uint32_t start_addr; |
111 | 111 |
uint8_t last_cw, last_ch; |
112 |
uint32_t last_width, last_height; |
|
112 |
uint32_t last_width, last_height; /* in chars or pixels */ |
|
113 |
uint32_t last_scr_width, last_scr_height; /* in pixels */ |
|
113 | 114 |
uint8_t cursor_start, cursor_end; |
114 | 115 |
uint32_t cursor_offset; |
115 | 116 |
unsigned int (*rgb_to_pixel)(unsigned int r, unsigned int g, unsigned b); |
... | ... | |
1155 | 1156 |
} |
1156 | 1157 |
if (width != s->last_width || height != s->last_height || |
1157 | 1158 |
cw != s->last_cw || cheight != s->last_ch) { |
1158 |
dpy_resize(s->ds, width * cw, height * cheight); |
|
1159 |
s->last_scr_width = width * cw; |
|
1160 |
s->last_scr_height = height * cheight; |
|
1161 |
dpy_resize(s->ds, s->last_scr_width, s->last_scr_height); |
|
1159 | 1162 |
s->last_width = width; |
1160 | 1163 |
s->last_height = height; |
1161 | 1164 |
s->last_ch = cheight; |
... | ... | |
1412 | 1415 |
if (disp_width != s->last_width || |
1413 | 1416 |
height != s->last_height) { |
1414 | 1417 |
dpy_resize(s->ds, disp_width, height); |
1418 |
s->last_scr_width = disp_width; |
|
1419 |
s->last_scr_height = height; |
|
1415 | 1420 |
s->last_width = disp_width; |
1416 | 1421 |
s->last_height = height; |
1417 | 1422 |
full_update = 1; |
... | ... | |
1494 | 1499 |
} |
1495 | 1500 |
} |
1496 | 1501 |
|
1502 |
static void vga_draw_blank(VGAState *s, int full_update) |
|
1503 |
{ |
|
1504 |
int i, w, val; |
|
1505 |
uint8_t *d; |
|
1506 |
|
|
1507 |
if (!full_update) |
|
1508 |
return; |
|
1509 |
if (s->last_scr_width <= 0 || s->last_scr_height <= 0) |
|
1510 |
return; |
|
1511 |
if (s->ds->depth == 8) |
|
1512 |
val = s->rgb_to_pixel(0, 0, 0); |
|
1513 |
else |
|
1514 |
val = 0; |
|
1515 |
w = s->last_scr_width * ((s->ds->depth + 7) >> 3); |
|
1516 |
d = s->ds->data; |
|
1517 |
for(i = 0; i < s->last_scr_height; i++) { |
|
1518 |
memset(d, val, w); |
|
1519 |
d += s->ds->linesize; |
|
1520 |
} |
|
1521 |
dpy_update(s->ds, 0, 0, |
|
1522 |
s->last_scr_width, s->last_scr_height); |
|
1523 |
} |
|
1524 |
|
|
1525 |
#define GMODE_TEXT 0 |
|
1526 |
#define GMODE_GRAPH 1 |
|
1527 |
#define GMODE_BLANK 2 |
|
1528 |
|
|
1497 | 1529 |
void vga_update_display(void) |
1498 | 1530 |
{ |
1499 | 1531 |
VGAState *s = &vga_state; |
... | ... | |
1519 | 1551 |
} |
1520 | 1552 |
|
1521 | 1553 |
full_update = 0; |
1522 |
graphic_mode = s->gr[6] & 1; |
|
1554 |
if (!(s->ar_index & 0x20)) { |
|
1555 |
graphic_mode = GMODE_BLANK; |
|
1556 |
} else { |
|
1557 |
graphic_mode = s->gr[6] & 1; |
|
1558 |
} |
|
1523 | 1559 |
if (graphic_mode != s->graphic_mode) { |
1524 | 1560 |
s->graphic_mode = graphic_mode; |
1525 | 1561 |
full_update = 1; |
1526 | 1562 |
} |
1527 |
if (graphic_mode) |
|
1528 |
vga_draw_graphic(s, full_update); |
|
1529 |
else |
|
1563 |
switch(graphic_mode) { |
|
1564 |
case GMODE_TEXT: |
|
1530 | 1565 |
vga_draw_text(s, full_update); |
1566 |
break; |
|
1567 |
case GMODE_GRAPH: |
|
1568 |
vga_draw_graphic(s, full_update); |
|
1569 |
break; |
|
1570 |
case GMODE_BLANK: |
|
1571 |
default: |
|
1572 |
vga_draw_blank(s, full_update); |
|
1573 |
break; |
|
1574 |
} |
|
1531 | 1575 |
} |
1532 | 1576 |
} |
1533 | 1577 |
|
Also available in: Unified diff