mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
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
This commit is contained in:
parent
cab3bee2d6
commit
0e1f5a0c49
20 changed files with 205 additions and 180 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue