aboutsummaryrefslogtreecommitdiff
path: root/hw/jazz_led.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/jazz_led.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/jazz_led.c')
-rw-r--r--hw/jazz_led.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/hw/jazz_led.c b/hw/jazz_led.c
index 8460bfcd59..c8ac26372f 100644
--- a/hw/jazz_led.c
+++ b/hw/jazz_led.c
@@ -155,8 +155,8 @@ static void draw_horizontal_line(DisplayState *ds, int posy, int posx1, int posx
uint8_t *d;
int x, bpp;
- bpp = (ds->depth + 7) >> 3;
- d = ds->data + ds->linesize * posy + bpp * posx1;
+ bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
+ d = ds_get_data(ds) + ds_get_linesize(ds) * posy + bpp * posx1;
switch(bpp) {
case 1:
for (x = posx1; x <= posx2; x++) {
@@ -184,25 +184,25 @@ static void draw_vertical_line(DisplayState *ds, int posx, int posy1, int posy2,
uint8_t *d;
int y, bpp;
- bpp = (ds->depth + 7) >> 3;
- d = ds->data + ds->linesize * posy1 + bpp * posx;
+ bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
+ d = ds_get_data(ds) + ds_get_linesize(ds) * posy1 + bpp * posx;
switch(bpp) {
case 1:
for (y = posy1; y <= posy2; y++) {
*((uint8_t *)d) = color;
- d += ds->linesize;
+ d += ds_get_linesize(ds);
}
break;
case 2:
for (y = posy1; y <= posy2; y++) {
*((uint16_t *)d) = color;
- d += ds->linesize;
+ d += ds_get_linesize(ds);
}
break;
case 4:
for (y = posy1; y <= posy2; y++) {
*((uint32_t *)d) = color;
- d += ds->linesize;
+ d += ds_get_linesize(ds);
}
break;
}
@@ -218,17 +218,17 @@ static void jazz_led_update_display(void *opaque)
if (s->state & REDRAW_BACKGROUND) {
/* clear screen */
- bpp = (ds->depth + 7) >> 3;
- d1 = ds->data;
- for (y = 0; y < ds->height; y++) {
- memset(d1, 0x00, ds->width * bpp);
- d1 += ds->linesize;
+ bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
+ d1 = ds_get_data(ds);
+ for (y = 0; y < ds_get_height(ds); y++) {
+ memset(d1, 0x00, ds_get_width(ds) * bpp);
+ d1 += ds_get_linesize(ds);
}
}
if (s->state & REDRAW_SEGMENTS) {
/* set colors according to bpp */
- switch (ds->depth) {
+ switch (ds_get_bits_per_pixel(ds)) {
case 8:
color_segment = rgb_to_pixel8(0xaa, 0xaa, 0xaa);
color_led = rgb_to_pixel8(0x00, 0xff, 0x00);
@@ -272,7 +272,7 @@ static void jazz_led_update_display(void *opaque)
}
s->state = REDRAW_NONE;
- dpy_update(ds, 0, 0, ds->width, ds->height);
+ dpy_update(ds, 0, 0, ds_get_width(ds), ds_get_height(ds));
}
static void jazz_led_invalidate_display(void *opaque)