aboutsummaryrefslogtreecommitdiff
path: root/hw/vga.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-24 19:29:13 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-24 19:29:13 +0000
commit0e1f5a0c495dd7a5c72c9321a29541bdde8f423a (patch)
tree374c5da7054c16f764a1cb2b5079d612cf417dac /hw/vga.c
parentcab3bee2d6f1d6eb6ad74006b8a63562cda9ba4d (diff)
Introduce accessors for DisplayState (Stefano Stabellini)
Introducing some accessors: ds_get_linesize ds_get_bits_per_pixel ds_get_width ds_get_height ds_get_data Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5789 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/vga.c')
-rw-r--r--hw/vga.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/hw/vga.c b/hw/vga.c
index bd59aae264..27d9e913c6 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1151,7 +1151,7 @@ static int update_basic_params(VGAState *s)
static inline int get_depth_index(DisplayState *s)
{
- switch(s->depth) {
+ switch(ds_get_bits_per_pixel(s)) {
default:
case 8:
return 0;
@@ -1279,7 +1279,7 @@ 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 * ((s->ds->depth + 7) >> 3);
+ x_incr = cw * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);
width = (s->cr[0x01] + 1);
if (s->cr[0x06] == 100) {
/* ugly hack for CGA 160x100x16 - explain me the logic */
@@ -1329,8 +1329,8 @@ static void vga_draw_text(VGAState *s, int full_update)
vga_draw_glyph8 = vga_draw_glyph8_table[depth_index];
vga_draw_glyph9 = vga_draw_glyph9_table[depth_index];
- dest = s->ds->data;
- linesize = s->ds->linesize;
+ dest = ds_get_data(s->ds);
+ linesize = ds_get_linesize(s->ds);
ch_attr_ptr = s->last_ch_attr;
for(cy = 0; cy < height; cy++) {
d1 = dest;
@@ -1663,8 +1663,8 @@ static void vga_draw_graphic(VGAState *s, int full_update)
y_start = -1;
page_min = 0x7fffffff;
page_max = -1;
- d = s->ds->data;
- linesize = s->ds->linesize;
+ d = ds_get_data(s->ds);
+ linesize = ds_get_linesize(s->ds);
y1 = 0;
for(y = 0; y < height; y++) {
addr = addr1;
@@ -1743,15 +1743,15 @@ static void vga_draw_blank(VGAState *s, int full_update)
return;
if (s->last_scr_width <= 0 || s->last_scr_height <= 0)
return;
- if (s->ds->depth == 8)
+ if (ds_get_bits_per_pixel(s->ds) == 8)
val = s->rgb_to_pixel(0, 0, 0);
else
val = 0;
- w = s->last_scr_width * ((s->ds->depth + 7) >> 3);
- d = s->ds->data;
+ w = s->last_scr_width * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);
+ d = ds_get_data(s->ds);
for(i = 0; i < s->last_scr_height; i++) {
memset(d, val, w);
- d += s->ds->linesize;
+ d += ds_get_linesize(s->ds);
}
dpy_update(s->ds, 0, 0,
s->last_scr_width, s->last_scr_height);
@@ -1766,7 +1766,7 @@ static void vga_update_display(void *opaque)
VGAState *s = (VGAState *)opaque;
int full_update, graphic_mode;
- if (s->ds->depth == 0) {
+ if (ds_get_bits_per_pixel(s->ds) == 0) {
/* nothing to do */
} else {
s->rgb_to_pixel =
@@ -2455,10 +2455,10 @@ static void vga_screen_dump(void *opaque, const char *filename)
s->graphic_mode = -1;
vga_update_display(s);
- if (ds->data) {
- ppm_save(filename, ds->data, vga_save_w, vga_save_h,
- s->ds->linesize);
- qemu_free(ds->data);
+ if (ds_get_data(ds)) {
+ ppm_save(filename, ds_get_data(ds), vga_save_w, vga_save_h,
+ ds_get_linesize(s->ds));
+ qemu_free(ds_get_data(ds));
}
s->ds = saved_ds;
}