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
74
console.c
74
console.c
@ -190,7 +190,7 @@ static unsigned int vga_get_color(DisplayState *ds, unsigned int rgba)
|
|||||||
{
|
{
|
||||||
unsigned int r, g, b, color;
|
unsigned int r, g, b, color;
|
||||||
|
|
||||||
switch(ds->depth) {
|
switch(ds_get_bits_per_pixel(ds)) {
|
||||||
#if 0
|
#if 0
|
||||||
case 8:
|
case 8:
|
||||||
r = (rgba >> 16) & 0xff;
|
r = (rgba >> 16) & 0xff;
|
||||||
@ -227,9 +227,9 @@ static void vga_fill_rect (DisplayState *ds,
|
|||||||
uint8_t *d, *d1;
|
uint8_t *d, *d1;
|
||||||
int x, y, bpp;
|
int x, y, bpp;
|
||||||
|
|
||||||
bpp = (ds->depth + 7) >> 3;
|
bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
|
||||||
d1 = ds->data +
|
d1 = ds_get_data(ds) +
|
||||||
ds->linesize * posy + bpp * posx;
|
ds_get_linesize(ds) * posy + bpp * posx;
|
||||||
for (y = 0; y < height; y++) {
|
for (y = 0; y < height; y++) {
|
||||||
d = d1;
|
d = d1;
|
||||||
switch(bpp) {
|
switch(bpp) {
|
||||||
@ -252,7 +252,7 @@ static void vga_fill_rect (DisplayState *ds,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
d1 += ds->linesize;
|
d1 += ds_get_linesize(ds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,27 +263,27 @@ static void vga_bitblt(DisplayState *ds, int xs, int ys, int xd, int yd, int w,
|
|||||||
uint8_t *d;
|
uint8_t *d;
|
||||||
int wb, y, bpp;
|
int wb, y, bpp;
|
||||||
|
|
||||||
bpp = (ds->depth + 7) >> 3;
|
bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
|
||||||
wb = w * bpp;
|
wb = w * bpp;
|
||||||
if (yd <= ys) {
|
if (yd <= ys) {
|
||||||
s = ds->data +
|
s = ds_get_data(ds) +
|
||||||
ds->linesize * ys + bpp * xs;
|
ds_get_linesize(ds) * ys + bpp * xs;
|
||||||
d = ds->data +
|
d = ds_get_data(ds) +
|
||||||
ds->linesize * yd + bpp * xd;
|
ds_get_linesize(ds) * yd + bpp * xd;
|
||||||
for (y = 0; y < h; y++) {
|
for (y = 0; y < h; y++) {
|
||||||
memmove(d, s, wb);
|
memmove(d, s, wb);
|
||||||
d += ds->linesize;
|
d += ds_get_linesize(ds);
|
||||||
s += ds->linesize;
|
s += ds_get_linesize(ds);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s = ds->data +
|
s = ds_get_data(ds) +
|
||||||
ds->linesize * (ys + h - 1) + bpp * xs;
|
ds_get_linesize(ds) * (ys + h - 1) + bpp * xs;
|
||||||
d = ds->data +
|
d = ds_get_data(ds) +
|
||||||
ds->linesize * (yd + h - 1) + bpp * xd;
|
ds_get_linesize(ds) * (yd + h - 1) + bpp * xd;
|
||||||
for (y = 0; y < h; y++) {
|
for (y = 0; y < h; y++) {
|
||||||
memmove(d, s, wb);
|
memmove(d, s, wb);
|
||||||
d -= ds->linesize;
|
d -= ds_get_linesize(ds);
|
||||||
s -= ds->linesize;
|
s -= ds_get_linesize(ds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,7 +373,7 @@ static const uint32_t color_table_rgb[2][8] = {
|
|||||||
|
|
||||||
static inline unsigned int col_expand(DisplayState *ds, unsigned int col)
|
static inline unsigned int col_expand(DisplayState *ds, unsigned int col)
|
||||||
{
|
{
|
||||||
switch(ds->depth) {
|
switch(ds_get_bits_per_pixel(ds)) {
|
||||||
case 8:
|
case 8:
|
||||||
col |= col << 8;
|
col |= col << 8;
|
||||||
col |= col << 16;
|
col |= col << 16;
|
||||||
@ -443,13 +443,13 @@ static void vga_putcharxy(DisplayState *ds, int x, int y, int ch,
|
|||||||
bgcol = color_table[t_attrib->bold][t_attrib->bgcol];
|
bgcol = color_table[t_attrib->bold][t_attrib->bgcol];
|
||||||
}
|
}
|
||||||
|
|
||||||
bpp = (ds->depth + 7) >> 3;
|
bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
|
||||||
d = ds->data +
|
d = ds_get_data(ds) +
|
||||||
ds->linesize * y * FONT_HEIGHT + bpp * x * FONT_WIDTH;
|
ds_get_linesize(ds) * y * FONT_HEIGHT + bpp * x * FONT_WIDTH;
|
||||||
linesize = ds->linesize;
|
linesize = ds_get_linesize(ds);
|
||||||
font_ptr = vgafont16 + FONT_HEIGHT * ch;
|
font_ptr = vgafont16 + FONT_HEIGHT * ch;
|
||||||
xorcol = bgcol ^ fgcol;
|
xorcol = bgcol ^ fgcol;
|
||||||
switch(ds->depth) {
|
switch(ds_get_bits_per_pixel(ds)) {
|
||||||
case 8:
|
case 8:
|
||||||
for(i = 0; i < FONT_HEIGHT; i++) {
|
for(i = 0; i < FONT_HEIGHT; i++) {
|
||||||
font_data = *font_ptr++;
|
font_data = *font_ptr++;
|
||||||
@ -543,7 +543,7 @@ static void update_xy(TextConsole *s, int x, int y)
|
|||||||
int y1, y2;
|
int y1, y2;
|
||||||
|
|
||||||
if (s == active_console) {
|
if (s == active_console) {
|
||||||
if (!s->ds->depth) {
|
if (!ds_get_bits_per_pixel(s->ds)) {
|
||||||
text_update_xy(s, x, y);
|
text_update_xy(s, x, y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -570,7 +570,7 @@ static void console_show_cursor(TextConsole *s, int show)
|
|||||||
if (s == active_console) {
|
if (s == active_console) {
|
||||||
int x = s->x;
|
int x = s->x;
|
||||||
|
|
||||||
if (!s->ds->depth) {
|
if (!ds_get_bits_per_pixel(s->ds)) {
|
||||||
s->cursor_invalidate = 1;
|
s->cursor_invalidate = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -604,7 +604,7 @@ static void console_refresh(TextConsole *s)
|
|||||||
|
|
||||||
if (s != active_console)
|
if (s != active_console)
|
||||||
return;
|
return;
|
||||||
if (!s->ds->depth) {
|
if (!ds_get_bits_per_pixel(s->ds)) {
|
||||||
s->text_x[0] = 0;
|
s->text_x[0] = 0;
|
||||||
s->text_y[0] = 0;
|
s->text_y[0] = 0;
|
||||||
s->text_x[1] = s->width - 1;
|
s->text_x[1] = s->width - 1;
|
||||||
@ -613,7 +613,7 @@ static void console_refresh(TextConsole *s)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vga_fill_rect(s->ds, 0, 0, s->ds->width, s->ds->height,
|
vga_fill_rect(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds),
|
||||||
color_table[0][COLOR_BLACK]);
|
color_table[0][COLOR_BLACK]);
|
||||||
y1 = s->y_displayed;
|
y1 = s->y_displayed;
|
||||||
for(y = 0; y < s->height; y++) {
|
for(y = 0; y < s->height; y++) {
|
||||||
@ -626,7 +626,7 @@ static void console_refresh(TextConsole *s)
|
|||||||
if (++y1 == s->total_height)
|
if (++y1 == s->total_height)
|
||||||
y1 = 0;
|
y1 = 0;
|
||||||
}
|
}
|
||||||
dpy_update(s->ds, 0, 0, s->ds->width, s->ds->height);
|
dpy_update(s->ds, 0, 0, ds_get_width(s->ds), ds_get_height(s->ds));
|
||||||
console_show_cursor(s, 1);
|
console_show_cursor(s, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,7 +689,7 @@ static void console_put_lf(TextConsole *s)
|
|||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
if (s == active_console && s->y_displayed == s->y_base) {
|
if (s == active_console && s->y_displayed == s->y_base) {
|
||||||
if (!s->ds->depth) {
|
if (!ds_get_bits_per_pixel(s->ds)) {
|
||||||
s->text_x[0] = 0;
|
s->text_x[0] = 0;
|
||||||
s->text_y[0] = 0;
|
s->text_y[0] = 0;
|
||||||
s->text_x[1] = s->width - 1;
|
s->text_x[1] = s->width - 1;
|
||||||
@ -1048,7 +1048,7 @@ void console_select(unsigned int index)
|
|||||||
if (s) {
|
if (s) {
|
||||||
active_console = s;
|
active_console = s;
|
||||||
if (s->console_type != TEXT_CONSOLE && s->g_width && s->g_height
|
if (s->console_type != TEXT_CONSOLE && s->g_width && s->g_height
|
||||||
&& (s->g_width != s->ds->width || s->g_height != s->ds->height))
|
&& (s->g_width != ds_get_width(s->ds) || s->g_height != ds_get_height(s->ds)))
|
||||||
dpy_resize(s->ds, s->g_width, s->g_height);
|
dpy_resize(s->ds, s->g_width, s->g_height);
|
||||||
vga_hw_invalidate();
|
vga_hw_invalidate();
|
||||||
}
|
}
|
||||||
@ -1158,12 +1158,12 @@ static void text_console_invalidate(void *opaque)
|
|||||||
{
|
{
|
||||||
TextConsole *s = (TextConsole *) opaque;
|
TextConsole *s = (TextConsole *) opaque;
|
||||||
|
|
||||||
if (s->g_width != s->ds->width || s->g_height != s->ds->height) {
|
if (s->g_width != ds_get_width(s->ds) || s->g_height != ds_get_height(s->ds)) {
|
||||||
if (s->console_type == TEXT_CONSOLE_FIXED_SIZE)
|
if (s->console_type == TEXT_CONSOLE_FIXED_SIZE)
|
||||||
dpy_resize(s->ds, s->g_width, s->g_height);
|
dpy_resize(s->ds, s->g_width, s->g_height);
|
||||||
else {
|
else {
|
||||||
s->g_width = s->ds->width;
|
s->g_width = ds_get_width(s->ds);
|
||||||
s->g_height = s->ds->height;
|
s->g_height = ds_get_height(s->ds);
|
||||||
text_console_resize(s);
|
text_console_resize(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1302,8 +1302,8 @@ CharDriverState *text_console_init(DisplayState *ds, const char *p)
|
|||||||
s->total_height = DEFAULT_BACKSCROLL;
|
s->total_height = DEFAULT_BACKSCROLL;
|
||||||
s->x = 0;
|
s->x = 0;
|
||||||
s->y = 0;
|
s->y = 0;
|
||||||
width = s->ds->width;
|
width = ds_get_width(s->ds);
|
||||||
height = s->ds->height;
|
height = ds_get_height(s->ds);
|
||||||
if (p != 0) {
|
if (p != 0) {
|
||||||
width = strtoul(p, (char **)&p, 10);
|
width = strtoul(p, (char **)&p, 10);
|
||||||
if (*p == 'C') {
|
if (*p == 'C') {
|
||||||
@ -1347,7 +1347,7 @@ CharDriverState *text_console_init(DisplayState *ds, const char *p)
|
|||||||
void qemu_console_resize(QEMUConsole *console, int width, int height)
|
void qemu_console_resize(QEMUConsole *console, int width, int height)
|
||||||
{
|
{
|
||||||
if (console->g_width != width || console->g_height != height
|
if (console->g_width != width || console->g_height != height
|
||||||
|| !console->ds->data) {
|
|| !ds_get_data(console->ds)) {
|
||||||
console->g_width = width;
|
console->g_width = width;
|
||||||
console->g_height = height;
|
console->g_height = height;
|
||||||
if (active_console == console) {
|
if (active_console == console) {
|
||||||
|
25
console.h
25
console.h
@ -114,6 +114,31 @@ static inline void dpy_cursor(DisplayState *s, int x, int y)
|
|||||||
s->dpy_text_cursor(s, x, y);
|
s->dpy_text_cursor(s, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int ds_get_linesize(DisplayState *ds)
|
||||||
|
{
|
||||||
|
return ds->linesize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint8_t* ds_get_data(DisplayState *ds)
|
||||||
|
{
|
||||||
|
return ds->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ds_get_width(DisplayState *ds)
|
||||||
|
{
|
||||||
|
return ds->width;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ds_get_height(DisplayState *ds)
|
||||||
|
{
|
||||||
|
return ds->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int ds_get_bits_per_pixel(DisplayState *ds)
|
||||||
|
{
|
||||||
|
return ds->depth;
|
||||||
|
}
|
||||||
|
|
||||||
typedef unsigned long console_ch_t;
|
typedef unsigned long console_ch_t;
|
||||||
static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
|
static inline void console_write_ch(console_ch_t *dest, uint32_t ch)
|
||||||
{
|
{
|
||||||
|
@ -166,7 +166,7 @@ static void blizzard_window(struct blizzard_s *s)
|
|||||||
s->my[1] = s->data.y + s->data.dy;
|
s->my[1] = s->data.y + s->data.dy;
|
||||||
|
|
||||||
bypp[0] = s->bpp;
|
bypp[0] = s->bpp;
|
||||||
bypp[1] = (s->state->depth + 7) >> 3;
|
bypp[1] = (ds_get_bits_per_pixel(s->state) + 7) >> 3;
|
||||||
bypl[0] = bypp[0] * s->data.pitch;
|
bypl[0] = bypp[0] * s->data.pitch;
|
||||||
bypl[1] = bypp[1] * s->x;
|
bypl[1] = bypp[1] * s->x;
|
||||||
bypl[2] = bypp[0] * s->data.dx;
|
bypl[2] = bypp[0] * s->data.dx;
|
||||||
@ -895,7 +895,7 @@ static void blizzard_update_display(void *opaque)
|
|||||||
if (!s->enable)
|
if (!s->enable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (s->x != s->state->width || s->y != s->state->height) {
|
if (s->x != ds_get_width(s->state) || s->y != ds_get_height(s->state)) {
|
||||||
s->invalidate = 1;
|
s->invalidate = 1;
|
||||||
qemu_console_resize(s->console, s->x, s->y);
|
qemu_console_resize(s->console, s->x, s->y);
|
||||||
}
|
}
|
||||||
@ -904,8 +904,8 @@ static void blizzard_update_display(void *opaque)
|
|||||||
s->invalidate = 0;
|
s->invalidate = 0;
|
||||||
|
|
||||||
if (s->blank) {
|
if (s->blank) {
|
||||||
bypp = (s->state->depth + 7) >> 3;
|
bypp = (ds_get_bits_per_pixel(s->state) + 7) >> 3;
|
||||||
memset(s->state->data, 0, bypp * s->x * s->y);
|
memset(ds_get_data(s->state), 0, bypp * s->x * s->y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -918,12 +918,12 @@ static void blizzard_update_display(void *opaque)
|
|||||||
if (s->mx[1] <= s->mx[0])
|
if (s->mx[1] <= s->mx[0])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bypp = (s->state->depth + 7) >> 3;
|
bypp = (ds_get_bits_per_pixel(s->state) + 7) >> 3;
|
||||||
bypl = bypp * s->x;
|
bypl = bypp * s->x;
|
||||||
bwidth = bypp * (s->mx[1] - s->mx[0]);
|
bwidth = bypp * (s->mx[1] - s->mx[0]);
|
||||||
y = s->my[0];
|
y = s->my[0];
|
||||||
src = s->fb + bypl * y + bypp * s->mx[0];
|
src = s->fb + bypl * y + bypp * s->mx[0];
|
||||||
dst = s->state->data + bypl * y + bypp * s->mx[0];
|
dst = ds_get_data(s->state) + bypl * y + bypp * s->mx[0];
|
||||||
for (; y < s->my[1]; y ++, src += bypl, dst += bypl)
|
for (; y < s->my[1]; y ++, src += bypl, dst += bypl)
|
||||||
memcpy(dst, src, bwidth);
|
memcpy(dst, src, bwidth);
|
||||||
|
|
||||||
@ -940,8 +940,8 @@ static void blizzard_screen_dump(void *opaque, const char *filename) {
|
|||||||
struct blizzard_s *s = (struct blizzard_s *) opaque;
|
struct blizzard_s *s = (struct blizzard_s *) opaque;
|
||||||
|
|
||||||
blizzard_update_display(opaque);
|
blizzard_update_display(opaque);
|
||||||
if (s && s->state->data)
|
if (s && ds_get_data(s->state))
|
||||||
ppm_save(filename, s->state->data, s->x, s->y, s->state->linesize);
|
ppm_save(filename, ds_get_data(s->state), s->x, s->y, ds_get_linesize(s->state));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEPTH 8
|
#define DEPTH 8
|
||||||
@ -962,7 +962,7 @@ void *s1d13745_init(qemu_irq gpio_int, DisplayState *ds)
|
|||||||
s->state = ds;
|
s->state = ds;
|
||||||
s->fb = qemu_malloc(0x180000);
|
s->fb = qemu_malloc(0x180000);
|
||||||
|
|
||||||
switch (s->state->depth) {
|
switch (ds_get_bits_per_pixel(s->state)) {
|
||||||
case 0:
|
case 0:
|
||||||
s->line_fn_tab[0] = s->line_fn_tab[1] =
|
s->line_fn_tab[0] = s->line_fn_tab[1] =
|
||||||
qemu_mallocz(sizeof(blizzard_fn_t) * 0x10);
|
qemu_mallocz(sizeof(blizzard_fn_t) * 0x10);
|
||||||
|
@ -2321,9 +2321,9 @@ static void cirrus_cursor_draw_line(VGAState *s1, uint8_t *d1, int scr_y)
|
|||||||
color1 = s->rgb_to_pixel(c6_to_8(palette[0xf * 3]),
|
color1 = s->rgb_to_pixel(c6_to_8(palette[0xf * 3]),
|
||||||
c6_to_8(palette[0xf * 3 + 1]),
|
c6_to_8(palette[0xf * 3 + 1]),
|
||||||
c6_to_8(palette[0xf * 3 + 2]));
|
c6_to_8(palette[0xf * 3 + 2]));
|
||||||
bpp = ((s->ds->depth + 7) >> 3);
|
bpp = ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);
|
||||||
d1 += x1 * bpp;
|
d1 += x1 * bpp;
|
||||||
switch(s->ds->depth) {
|
switch(ds_get_bits_per_pixel(s->ds)) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
|
12
hw/g364fb.c
12
hw/g364fb.c
@ -72,7 +72,7 @@ typedef struct G364State {
|
|||||||
|
|
||||||
static void g364fb_draw_graphic(G364State *s, int full_update)
|
static void g364fb_draw_graphic(G364State *s, int full_update)
|
||||||
{
|
{
|
||||||
switch (s->ds->depth) {
|
switch (ds_get_bits_per_pixel(s->ds)) {
|
||||||
case 8:
|
case 8:
|
||||||
g364fb_draw_graphic8(s, full_update);
|
g364fb_draw_graphic8(s, full_update);
|
||||||
break;
|
break;
|
||||||
@ -86,7 +86,7 @@ static void g364fb_draw_graphic(G364State *s, int full_update)
|
|||||||
g364fb_draw_graphic32(s, full_update);
|
g364fb_draw_graphic32(s, full_update);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("g364fb: unknown depth %d\n", s->ds->depth);
|
printf("g364fb: unknown depth %d\n", ds_get_bits_per_pixel(s->ds));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,11 +101,11 @@ static void g364fb_draw_blank(G364State *s, int full_update)
|
|||||||
if (!full_update)
|
if (!full_update)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
w = s->scr_width * ((s->ds->depth + 7) >> 3);
|
w = s->scr_width * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);
|
||||||
d = s->ds->data;
|
d = ds_get_data(s->ds);
|
||||||
for(i = 0; i < s->scr_height; i++) {
|
for(i = 0; i < s->scr_height; i++) {
|
||||||
memset(d, 0, w);
|
memset(d, 0, w);
|
||||||
d += s->ds->linesize;
|
d += ds_get_linesize(s->ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height);
|
dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height);
|
||||||
@ -131,7 +131,7 @@ static void g364fb_update_display(void *opaque)
|
|||||||
s->graphic_mode = graphic_mode;
|
s->graphic_mode = graphic_mode;
|
||||||
full_update = 1;
|
full_update = 1;
|
||||||
}
|
}
|
||||||
if (s->scr_width != s->ds->width || s->scr_height != s->ds->height) {
|
if (s->scr_width != ds_get_width(s->ds) || s->scr_height != ds_get_height(s->ds)) {
|
||||||
qemu_console_resize(s->console, s->scr_width, s->scr_height);
|
qemu_console_resize(s->console, s->scr_width, s->scr_height);
|
||||||
full_update = 1;
|
full_update = 1;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ static void glue(g364fb_draw_graphic, BPP)(G364State *s, int full_update)
|
|||||||
|
|
||||||
data_buffer = s->vram_buffer;
|
data_buffer = s->vram_buffer;
|
||||||
w_display = s->scr_width * PIXEL_WIDTH / 8;
|
w_display = s->scr_width * PIXEL_WIDTH / 8;
|
||||||
data_display = s->ds->data;
|
data_display = ds_get_data(s->ds);
|
||||||
for(i = 0; i < s->scr_height; i++) {
|
for(i = 0; i < s->scr_height; i++) {
|
||||||
dd = data_display;
|
dd = data_display;
|
||||||
for (j = 0; j < s->scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) {
|
for (j = 0; j < s->scr_width; j++, dd += PIXEL_WIDTH / 8, data_buffer++) {
|
||||||
@ -38,6 +38,6 @@ static void glue(g364fb_draw_graphic, BPP)(G364State *s, int full_update)
|
|||||||
s->palette[index][1],
|
s->palette[index][1],
|
||||||
s->palette[index][2]);
|
s->palette[index][2]);
|
||||||
}
|
}
|
||||||
data_display += s->ds->linesize;
|
data_display += ds_get_linesize(s->ds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,8 +155,8 @@ static void draw_horizontal_line(DisplayState *ds, int posy, int posx1, int posx
|
|||||||
uint8_t *d;
|
uint8_t *d;
|
||||||
int x, bpp;
|
int x, bpp;
|
||||||
|
|
||||||
bpp = (ds->depth + 7) >> 3;
|
bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
|
||||||
d = ds->data + ds->linesize * posy + bpp * posx1;
|
d = ds_get_data(ds) + ds_get_linesize(ds) * posy + bpp * posx1;
|
||||||
switch(bpp) {
|
switch(bpp) {
|
||||||
case 1:
|
case 1:
|
||||||
for (x = posx1; x <= posx2; x++) {
|
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;
|
uint8_t *d;
|
||||||
int y, bpp;
|
int y, bpp;
|
||||||
|
|
||||||
bpp = (ds->depth + 7) >> 3;
|
bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
|
||||||
d = ds->data + ds->linesize * posy1 + bpp * posx;
|
d = ds_get_data(ds) + ds_get_linesize(ds) * posy1 + bpp * posx;
|
||||||
switch(bpp) {
|
switch(bpp) {
|
||||||
case 1:
|
case 1:
|
||||||
for (y = posy1; y <= posy2; y++) {
|
for (y = posy1; y <= posy2; y++) {
|
||||||
*((uint8_t *)d) = color;
|
*((uint8_t *)d) = color;
|
||||||
d += ds->linesize;
|
d += ds_get_linesize(ds);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
for (y = posy1; y <= posy2; y++) {
|
for (y = posy1; y <= posy2; y++) {
|
||||||
*((uint16_t *)d) = color;
|
*((uint16_t *)d) = color;
|
||||||
d += ds->linesize;
|
d += ds_get_linesize(ds);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
for (y = posy1; y <= posy2; y++) {
|
for (y = posy1; y <= posy2; y++) {
|
||||||
*((uint32_t *)d) = color;
|
*((uint32_t *)d) = color;
|
||||||
d += ds->linesize;
|
d += ds_get_linesize(ds);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -218,17 +218,17 @@ static void jazz_led_update_display(void *opaque)
|
|||||||
|
|
||||||
if (s->state & REDRAW_BACKGROUND) {
|
if (s->state & REDRAW_BACKGROUND) {
|
||||||
/* clear screen */
|
/* clear screen */
|
||||||
bpp = (ds->depth + 7) >> 3;
|
bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
|
||||||
d1 = ds->data;
|
d1 = ds_get_data(ds);
|
||||||
for (y = 0; y < ds->height; y++) {
|
for (y = 0; y < ds_get_height(ds); y++) {
|
||||||
memset(d1, 0x00, ds->width * bpp);
|
memset(d1, 0x00, ds_get_width(ds) * bpp);
|
||||||
d1 += ds->linesize;
|
d1 += ds_get_linesize(ds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->state & REDRAW_SEGMENTS) {
|
if (s->state & REDRAW_SEGMENTS) {
|
||||||
/* set colors according to bpp */
|
/* set colors according to bpp */
|
||||||
switch (ds->depth) {
|
switch (ds_get_bits_per_pixel(ds)) {
|
||||||
case 8:
|
case 8:
|
||||||
color_segment = rgb_to_pixel8(0xaa, 0xaa, 0xaa);
|
color_segment = rgb_to_pixel8(0xaa, 0xaa, 0xaa);
|
||||||
color_led = rgb_to_pixel8(0x00, 0xff, 0x00);
|
color_led = rgb_to_pixel8(0x00, 0xff, 0x00);
|
||||||
@ -272,7 +272,7 @@ static void jazz_led_update_display(void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
s->state = REDRAW_NONE;
|
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)
|
static void jazz_led_invalidate_display(void *opaque)
|
||||||
|
@ -801,7 +801,7 @@ static inline void glue(set_lcd_pixel, depth) \
|
|||||||
(musicpal_lcd_state *s, int x, int y, type col) \
|
(musicpal_lcd_state *s, int x, int y, type col) \
|
||||||
{ \
|
{ \
|
||||||
int dx, dy; \
|
int dx, dy; \
|
||||||
type *pixel = &((type *) s->ds->data)[(y * 128 * 3 + x) * 3]; \
|
type *pixel = &((type *) ds_get_data(s->ds))[(y * 128 * 3 + x) * 3]; \
|
||||||
\
|
\
|
||||||
for (dy = 0; dy < 3; dy++, pixel += 127 * 3) \
|
for (dy = 0; dy < 3; dy++, pixel += 127 * 3) \
|
||||||
for (dx = 0; dx < 3; dx++, pixel++) \
|
for (dx = 0; dx < 3; dx++, pixel++) \
|
||||||
@ -818,7 +818,7 @@ static void lcd_refresh(void *opaque)
|
|||||||
musicpal_lcd_state *s = opaque;
|
musicpal_lcd_state *s = opaque;
|
||||||
int x, y, col;
|
int x, y, col;
|
||||||
|
|
||||||
switch (s->ds->depth) {
|
switch (ds_get_bits_per_pixel(s->ds)) {
|
||||||
case 0:
|
case 0:
|
||||||
return;
|
return;
|
||||||
#define LCD_REFRESH(depth, func) \
|
#define LCD_REFRESH(depth, func) \
|
||||||
@ -838,7 +838,7 @@ static void lcd_refresh(void *opaque)
|
|||||||
LCD_REFRESH(32, (s->ds->bgr ? rgb_to_pixel32bgr : rgb_to_pixel32))
|
LCD_REFRESH(32, (s->ds->bgr ? rgb_to_pixel32bgr : rgb_to_pixel32))
|
||||||
default:
|
default:
|
||||||
cpu_abort(cpu_single_env, "unsupported colour depth %i\n",
|
cpu_abort(cpu_single_env, "unsupported colour depth %i\n",
|
||||||
s->ds->depth);
|
ds_get_bits_per_pixel(s->ds));
|
||||||
}
|
}
|
||||||
|
|
||||||
dpy_update(s->ds, 0, 0, 128*3, 64*3);
|
dpy_update(s->ds, 0, 0, 128*3, 64*3);
|
||||||
|
@ -125,7 +125,7 @@ static void omap_update_display(void *opaque)
|
|||||||
uint8_t *s, *d;
|
uint8_t *s, *d;
|
||||||
|
|
||||||
if (!omap_lcd || omap_lcd->plm == 1 ||
|
if (!omap_lcd || omap_lcd->plm == 1 ||
|
||||||
!omap_lcd->enable || !omap_lcd->state->depth)
|
!omap_lcd->enable || !ds_get_bits_per_pixel(omap_lcd->state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
frame_offset = 0;
|
frame_offset = 0;
|
||||||
@ -145,25 +145,25 @@ static void omap_update_display(void *opaque)
|
|||||||
/* Colour depth */
|
/* Colour depth */
|
||||||
switch ((omap_lcd->palette[0] >> 12) & 7) {
|
switch ((omap_lcd->palette[0] >> 12) & 7) {
|
||||||
case 1:
|
case 1:
|
||||||
draw_line = draw_line_table2[omap_lcd->state->depth];
|
draw_line = draw_line_table2[ds_get_bits_per_pixel(omap_lcd->state)];
|
||||||
bpp = 2;
|
bpp = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
draw_line = draw_line_table4[omap_lcd->state->depth];
|
draw_line = draw_line_table4[ds_get_bits_per_pixel(omap_lcd->state)];
|
||||||
bpp = 4;
|
bpp = 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
draw_line = draw_line_table8[omap_lcd->state->depth];
|
draw_line = draw_line_table8[ds_get_bits_per_pixel(omap_lcd->state)];
|
||||||
bpp = 8;
|
bpp = 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4 ... 7:
|
case 4 ... 7:
|
||||||
if (!omap_lcd->tft)
|
if (!omap_lcd->tft)
|
||||||
draw_line = draw_line_table12[omap_lcd->state->depth];
|
draw_line = draw_line_table12[ds_get_bits_per_pixel(omap_lcd->state)];
|
||||||
else
|
else
|
||||||
draw_line = draw_line_table16[omap_lcd->state->depth];
|
draw_line = draw_line_table16[ds_get_bits_per_pixel(omap_lcd->state)];
|
||||||
bpp = 16;
|
bpp = 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -174,8 +174,8 @@ static void omap_update_display(void *opaque)
|
|||||||
|
|
||||||
/* Resolution */
|
/* Resolution */
|
||||||
width = omap_lcd->width;
|
width = omap_lcd->width;
|
||||||
if (width != omap_lcd->state->width ||
|
if (width != ds_get_width(omap_lcd->state) ||
|
||||||
omap_lcd->height != omap_lcd->state->height) {
|
omap_lcd->height != ds_get_height(omap_lcd->state)) {
|
||||||
qemu_console_resize(omap_lcd->console,
|
qemu_console_resize(omap_lcd->console,
|
||||||
omap_lcd->width, omap_lcd->height);
|
omap_lcd->width, omap_lcd->height);
|
||||||
omap_lcd->invalidate = 1;
|
omap_lcd->invalidate = 1;
|
||||||
@ -202,7 +202,7 @@ static void omap_update_display(void *opaque)
|
|||||||
if (omap_lcd->dma->dual)
|
if (omap_lcd->dma->dual)
|
||||||
omap_lcd->dma->current_frame ^= 1;
|
omap_lcd->dma->current_frame ^= 1;
|
||||||
|
|
||||||
if (!omap_lcd->state->depth)
|
if (!ds_get_bits_per_pixel(omap_lcd->state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
line = 0;
|
line = 0;
|
||||||
@ -217,8 +217,8 @@ static void omap_update_display(void *opaque)
|
|||||||
step = width * bpp >> 3;
|
step = width * bpp >> 3;
|
||||||
scanline = frame_base + step * line;
|
scanline = frame_base + step * line;
|
||||||
s = (uint8_t *) (phys_ram_base + scanline);
|
s = (uint8_t *) (phys_ram_base + scanline);
|
||||||
d = omap_lcd->state->data;
|
d = ds_get_data(omap_lcd->state);
|
||||||
linesize = omap_lcd->state->linesize;
|
linesize = ds_get_linesize(omap_lcd->state);
|
||||||
|
|
||||||
dirty[0] = dirty[1] =
|
dirty[0] = dirty[1] =
|
||||||
cpu_physical_memory_get_dirty(scanline, VGA_DIRTY_FLAG);
|
cpu_physical_memory_get_dirty(scanline, VGA_DIRTY_FLAG);
|
||||||
@ -293,10 +293,10 @@ static int ppm_save(const char *filename, uint8_t *data,
|
|||||||
static void omap_screen_dump(void *opaque, const char *filename) {
|
static void omap_screen_dump(void *opaque, const char *filename) {
|
||||||
struct omap_lcd_panel_s *omap_lcd = opaque;
|
struct omap_lcd_panel_s *omap_lcd = opaque;
|
||||||
omap_update_display(opaque);
|
omap_update_display(opaque);
|
||||||
if (omap_lcd && omap_lcd->state->data)
|
if (omap_lcd && ds_get_data(omap_lcd->state))
|
||||||
ppm_save(filename, omap_lcd->state->data,
|
ppm_save(filename, ds_get_data(omap_lcd->state),
|
||||||
omap_lcd->width, omap_lcd->height,
|
omap_lcd->width, omap_lcd->height,
|
||||||
omap_lcd->state->linesize);
|
ds_get_linesize(omap_lcd->state));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void omap_invalidate_display(void *opaque) {
|
static void omap_invalidate_display(void *opaque) {
|
||||||
|
@ -124,7 +124,7 @@ static void pl110_update_display(void *opaque)
|
|||||||
if (!pl110_enabled(s))
|
if (!pl110_enabled(s))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (s->ds->depth) {
|
switch (ds_get_bits_per_pixel(s->ds)) {
|
||||||
case 0:
|
case 0:
|
||||||
return;
|
return;
|
||||||
case 8:
|
case 8:
|
||||||
@ -190,7 +190,7 @@ static void pl110_update_display(void *opaque)
|
|||||||
if (base > 0x80000000)
|
if (base > 0x80000000)
|
||||||
base -= 0x80000000;
|
base -= 0x80000000;
|
||||||
src = phys_ram_base + base;
|
src = phys_ram_base + base;
|
||||||
dest = s->ds->data;
|
dest = ds_get_data(s->ds);
|
||||||
first = -1;
|
first = -1;
|
||||||
addr = base;
|
addr = base;
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ static void pl110_update_pallette(pl110_state *s, int n)
|
|||||||
b = (raw & 0x1f) << 3;
|
b = (raw & 0x1f) << 3;
|
||||||
/* The I bit is ignored. */
|
/* The I bit is ignored. */
|
||||||
raw >>= 6;
|
raw >>= 6;
|
||||||
switch (s->ds->depth) {
|
switch (ds_get_bits_per_pixel(s->ds)) {
|
||||||
case 8:
|
case 8:
|
||||||
s->pallette[n] = rgb_to_pixel8(r, g, b);
|
s->pallette[n] = rgb_to_pixel8(r, g, b);
|
||||||
break;
|
break;
|
||||||
|
@ -650,7 +650,7 @@ static void pxa2xx_palette_parse(struct pxa2xx_lcdc_s *s, int ch, int bpp)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (s->ds->depth) {
|
switch (ds_get_bits_per_pixel(s->ds)) {
|
||||||
case 8:
|
case 8:
|
||||||
*dest = rgb_to_pixel8(r, g, b) | alpha;
|
*dest = rgb_to_pixel8(r, g, b) | alpha;
|
||||||
break;
|
break;
|
||||||
@ -693,7 +693,7 @@ static void pxa2xx_lcdc_dma0_redraw_horiz(struct pxa2xx_lcdc_s *s,
|
|||||||
else if (s->bpp > pxa_lcdc_8bpp)
|
else if (s->bpp > pxa_lcdc_8bpp)
|
||||||
src_width *= 2;
|
src_width *= 2;
|
||||||
|
|
||||||
dest = s->ds->data;
|
dest = ds_get_data(s->ds);
|
||||||
dest_width = s->xres * s->dest_width;
|
dest_width = s->xres * s->dest_width;
|
||||||
|
|
||||||
addr = (ram_addr_t) (fb - phys_ram_base);
|
addr = (ram_addr_t) (fb - phys_ram_base);
|
||||||
@ -750,7 +750,7 @@ static void pxa2xx_lcdc_dma0_redraw_vert(struct pxa2xx_lcdc_s *s,
|
|||||||
src_width *= 2;
|
src_width *= 2;
|
||||||
|
|
||||||
dest_width = s->yres * s->dest_width;
|
dest_width = s->yres * s->dest_width;
|
||||||
dest = s->ds->data + dest_width * (s->xres - 1);
|
dest = ds_get_data(s->ds) + dest_width * (s->xres - 1);
|
||||||
|
|
||||||
addr = (ram_addr_t) (fb - phys_ram_base);
|
addr = (ram_addr_t) (fb - phys_ram_base);
|
||||||
start = addr + s->yres * src_width;
|
start = addr + s->yres * src_width;
|
||||||
@ -1006,7 +1006,7 @@ struct pxa2xx_lcdc_s *pxa2xx_lcdc_init(target_phys_addr_t base, qemu_irq irq,
|
|||||||
pxa2xx_invalidate_display,
|
pxa2xx_invalidate_display,
|
||||||
pxa2xx_screen_dump, NULL, s);
|
pxa2xx_screen_dump, NULL, s);
|
||||||
|
|
||||||
switch (s->ds->depth) {
|
switch (ds_get_bits_per_pixel(s->ds)) {
|
||||||
case 0:
|
case 0:
|
||||||
s->dest_width = 0;
|
s->dest_width = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -206,7 +206,7 @@ static void ssd0303_update_display(void *opaque)
|
|||||||
if (!s->redraw)
|
if (!s->redraw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (s->ds->depth) {
|
switch (ds_get_bits_per_pixel(s->ds)) {
|
||||||
case 0:
|
case 0:
|
||||||
return;
|
return;
|
||||||
case 15:
|
case 15:
|
||||||
@ -238,7 +238,7 @@ static void ssd0303_update_display(void *opaque)
|
|||||||
colors[0] = colortab + dest_width;
|
colors[0] = colortab + dest_width;
|
||||||
colors[1] = colortab;
|
colors[1] = colortab;
|
||||||
}
|
}
|
||||||
dest = s->ds->data;
|
dest = ds_get_data(s->ds);
|
||||||
for (y = 0; y < 16; y++) {
|
for (y = 0; y < 16; y++) {
|
||||||
line = (y + s->start_line) & 63;
|
line = (y + s->start_line) & 63;
|
||||||
src = s->framebuffer + 132 * (line >> 3) + 36;
|
src = s->framebuffer + 132 * (line >> 3) + 36;
|
||||||
|
@ -187,7 +187,7 @@ static void ssd0323_update_display(void *opaque)
|
|||||||
if (!s->redraw)
|
if (!s->redraw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (s->ds->depth) {
|
switch (ds_get_bits_per_pixel(s->ds)) {
|
||||||
case 0:
|
case 0:
|
||||||
return;
|
return;
|
||||||
case 15:
|
case 15:
|
||||||
@ -210,7 +210,7 @@ static void ssd0323_update_display(void *opaque)
|
|||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
int n;
|
int n;
|
||||||
colors[i] = p;
|
colors[i] = p;
|
||||||
switch (s->ds->depth) {
|
switch (ds_get_bits_per_pixel(s->ds)) {
|
||||||
case 15:
|
case 15:
|
||||||
n = i * 2 + (i >> 3);
|
n = i * 2 + (i >> 3);
|
||||||
p[0] = n | (n << 5);
|
p[0] = n | (n << 5);
|
||||||
@ -233,7 +233,7 @@ static void ssd0323_update_display(void *opaque)
|
|||||||
p += dest_width;
|
p += dest_width;
|
||||||
}
|
}
|
||||||
/* TODO: Implement row/column remapping. */
|
/* TODO: Implement row/column remapping. */
|
||||||
dest = s->ds->data;
|
dest = ds_get_data(s->ds);
|
||||||
for (y = 0; y < 64; y++) {
|
for (y = 0; y < 64; y++) {
|
||||||
line = y;
|
line = y;
|
||||||
src = s->framebuffer + 64 * line;
|
src = s->framebuffer + 64 * line;
|
||||||
|
@ -430,7 +430,7 @@ static void tc6393xb_nand_writeb(struct tc6393xb_s *s, target_phys_addr_t addr,
|
|||||||
|
|
||||||
static void tc6393xb_draw_graphic(struct tc6393xb_s *s, int full_update)
|
static void tc6393xb_draw_graphic(struct tc6393xb_s *s, int full_update)
|
||||||
{
|
{
|
||||||
switch (s->ds->depth) {
|
switch (ds_get_bits_per_pixel(s->ds)) {
|
||||||
case 8:
|
case 8:
|
||||||
tc6393xb_draw_graphic8(s);
|
tc6393xb_draw_graphic8(s);
|
||||||
break;
|
break;
|
||||||
@ -447,7 +447,7 @@ static void tc6393xb_draw_graphic(struct tc6393xb_s *s, int full_update)
|
|||||||
tc6393xb_draw_graphic32(s);
|
tc6393xb_draw_graphic32(s);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("tc6393xb: unknown depth %d\n", s->ds->depth);
|
printf("tc6393xb: unknown depth %d\n", ds_get_bits_per_pixel(s->ds));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,11 +462,11 @@ static void tc6393xb_draw_blank(struct tc6393xb_s *s, int full_update)
|
|||||||
if (!full_update)
|
if (!full_update)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
w = s->scr_width * ((s->ds->depth + 7) >> 3);
|
w = s->scr_width * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);
|
||||||
d = s->ds->data;
|
d = ds_get_data(s->ds);
|
||||||
for(i = 0; i < s->scr_height; i++) {
|
for(i = 0; i < s->scr_height; i++) {
|
||||||
memset(d, 0, w);
|
memset(d, 0, w);
|
||||||
d += s->ds->linesize;
|
d += ds_get_linesize(s->ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height);
|
dpy_update(s->ds, 0, 0, s->scr_width, s->scr_height);
|
||||||
@ -485,7 +485,7 @@ static void tc6393xb_update_display(void *opaque)
|
|||||||
s->blanked = s->blank;
|
s->blanked = s->blank;
|
||||||
full_update = 1;
|
full_update = 1;
|
||||||
}
|
}
|
||||||
if (s->scr_width != s->ds->width || s->scr_height != s->ds->height) {
|
if (s->scr_width != ds_get_width(s->ds) || s->scr_height != ds_get_height(s->ds)) {
|
||||||
qemu_console_resize(s->console, s->scr_width, s->scr_height);
|
qemu_console_resize(s->console, s->scr_width, s->scr_height);
|
||||||
full_update = 1;
|
full_update = 1;
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,12 @@ static void glue(tc6393xb_draw_graphic, BITS)(struct tc6393xb_s *s)
|
|||||||
|
|
||||||
data_buffer = (uint16_t*)(phys_ram_base + s->vram_addr);
|
data_buffer = (uint16_t*)(phys_ram_base + s->vram_addr);
|
||||||
w_display = s->scr_width * BITS / 8;
|
w_display = s->scr_width * BITS / 8;
|
||||||
data_display = s->ds->data;
|
data_display = ds_get_data(s->ds);
|
||||||
for(i = 0; i < s->scr_height; i++) {
|
for(i = 0; i < s->scr_height; i++) {
|
||||||
#if (BITS == 16)
|
#if (BITS == 16)
|
||||||
memcpy(data_display, data_buffer, s->scr_width * 2);
|
memcpy(data_display, data_buffer, s->scr_width * 2);
|
||||||
data_buffer += s->scr_width;
|
data_buffer += s->scr_width;
|
||||||
data_display += s->ds->linesize;
|
data_display += ds_get_linesize(s->ds);
|
||||||
#else
|
#else
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < s->scr_width; j++, data_display += BITS / 8, data_buffer++) {
|
for (j = 0; j < s->scr_width; j++, data_display += BITS / 8, data_buffer++) {
|
||||||
|
16
hw/tcx.c
16
hw/tcx.c
@ -55,7 +55,7 @@ static void update_palette_entries(TCXState *s, int start, int end)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = start; i < end; i++) {
|
for(i = start; i < end; i++) {
|
||||||
switch(s->ds->depth) {
|
switch(ds_get_bits_per_pixel(s->ds)) {
|
||||||
default:
|
default:
|
||||||
case 8:
|
case 8:
|
||||||
s->palette[i] = rgb_to_pixel8(s->r[i], s->g[i], s->b[i]);
|
s->palette[i] = rgb_to_pixel8(s->r[i], s->g[i], s->b[i]);
|
||||||
@ -200,18 +200,18 @@ static void tcx_update_display(void *opaque)
|
|||||||
uint8_t *d, *s;
|
uint8_t *d, *s;
|
||||||
void (*f)(TCXState *s1, uint8_t *dst, const uint8_t *src, int width);
|
void (*f)(TCXState *s1, uint8_t *dst, const uint8_t *src, int width);
|
||||||
|
|
||||||
if (ts->ds->depth == 0)
|
if (ds_get_bits_per_pixel(ts->ds) == 0)
|
||||||
return;
|
return;
|
||||||
page = ts->vram_offset;
|
page = ts->vram_offset;
|
||||||
y_start = -1;
|
y_start = -1;
|
||||||
page_min = 0xffffffff;
|
page_min = 0xffffffff;
|
||||||
page_max = 0;
|
page_max = 0;
|
||||||
d = ts->ds->data;
|
d = ds_get_data(ts->ds);
|
||||||
s = ts->vram;
|
s = ts->vram;
|
||||||
dd = ts->ds->linesize;
|
dd = ds_get_linesize(ts->ds);
|
||||||
ds = 1024;
|
ds = 1024;
|
||||||
|
|
||||||
switch (ts->ds->depth) {
|
switch (ds_get_bits_per_pixel(ts->ds)) {
|
||||||
case 32:
|
case 32:
|
||||||
f = tcx_draw_line32;
|
f = tcx_draw_line32;
|
||||||
break;
|
break;
|
||||||
@ -278,7 +278,7 @@ static void tcx24_update_display(void *opaque)
|
|||||||
uint8_t *d, *s;
|
uint8_t *d, *s;
|
||||||
uint32_t *cptr, *s24;
|
uint32_t *cptr, *s24;
|
||||||
|
|
||||||
if (ts->ds->depth != 32)
|
if (ds_get_bits_per_pixel(ts->ds) != 32)
|
||||||
return;
|
return;
|
||||||
page = ts->vram_offset;
|
page = ts->vram_offset;
|
||||||
page24 = ts->vram24_offset;
|
page24 = ts->vram24_offset;
|
||||||
@ -286,11 +286,11 @@ static void tcx24_update_display(void *opaque)
|
|||||||
y_start = -1;
|
y_start = -1;
|
||||||
page_min = 0xffffffff;
|
page_min = 0xffffffff;
|
||||||
page_max = 0;
|
page_max = 0;
|
||||||
d = ts->ds->data;
|
d = ds_get_data(ts->ds);
|
||||||
s = ts->vram;
|
s = ts->vram;
|
||||||
s24 = ts->vram24;
|
s24 = ts->vram24;
|
||||||
cptr = ts->cplane;
|
cptr = ts->cplane;
|
||||||
dd = ts->ds->linesize;
|
dd = ds_get_linesize(ts->ds);
|
||||||
ds = 1024;
|
ds = 1024;
|
||||||
|
|
||||||
for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE,
|
for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE,
|
||||||
|
30
hw/vga.c
30
hw/vga.c
@ -1151,7 +1151,7 @@ static int update_basic_params(VGAState *s)
|
|||||||
|
|
||||||
static inline int get_depth_index(DisplayState *s)
|
static inline int get_depth_index(DisplayState *s)
|
||||||
{
|
{
|
||||||
switch(s->depth) {
|
switch(ds_get_bits_per_pixel(s)) {
|
||||||
default:
|
default:
|
||||||
case 8:
|
case 8:
|
||||||
return 0;
|
return 0;
|
||||||
@ -1279,7 +1279,7 @@ static void vga_draw_text(VGAState *s, int full_update)
|
|||||||
cw = 9;
|
cw = 9;
|
||||||
if (s->sr[1] & 0x08)
|
if (s->sr[1] & 0x08)
|
||||||
cw = 16; /* NOTE: no 18 pixel wide */
|
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);
|
width = (s->cr[0x01] + 1);
|
||||||
if (s->cr[0x06] == 100) {
|
if (s->cr[0x06] == 100) {
|
||||||
/* ugly hack for CGA 160x100x16 - explain me the logic */
|
/* 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_glyph8 = vga_draw_glyph8_table[depth_index];
|
||||||
vga_draw_glyph9 = vga_draw_glyph9_table[depth_index];
|
vga_draw_glyph9 = vga_draw_glyph9_table[depth_index];
|
||||||
|
|
||||||
dest = s->ds->data;
|
dest = ds_get_data(s->ds);
|
||||||
linesize = s->ds->linesize;
|
linesize = ds_get_linesize(s->ds);
|
||||||
ch_attr_ptr = s->last_ch_attr;
|
ch_attr_ptr = s->last_ch_attr;
|
||||||
for(cy = 0; cy < height; cy++) {
|
for(cy = 0; cy < height; cy++) {
|
||||||
d1 = dest;
|
d1 = dest;
|
||||||
@ -1663,8 +1663,8 @@ static void vga_draw_graphic(VGAState *s, int full_update)
|
|||||||
y_start = -1;
|
y_start = -1;
|
||||||
page_min = 0x7fffffff;
|
page_min = 0x7fffffff;
|
||||||
page_max = -1;
|
page_max = -1;
|
||||||
d = s->ds->data;
|
d = ds_get_data(s->ds);
|
||||||
linesize = s->ds->linesize;
|
linesize = ds_get_linesize(s->ds);
|
||||||
y1 = 0;
|
y1 = 0;
|
||||||
for(y = 0; y < height; y++) {
|
for(y = 0; y < height; y++) {
|
||||||
addr = addr1;
|
addr = addr1;
|
||||||
@ -1743,15 +1743,15 @@ static void vga_draw_blank(VGAState *s, int full_update)
|
|||||||
return;
|
return;
|
||||||
if (s->last_scr_width <= 0 || s->last_scr_height <= 0)
|
if (s->last_scr_width <= 0 || s->last_scr_height <= 0)
|
||||||
return;
|
return;
|
||||||
if (s->ds->depth == 8)
|
if (ds_get_bits_per_pixel(s->ds) == 8)
|
||||||
val = s->rgb_to_pixel(0, 0, 0);
|
val = s->rgb_to_pixel(0, 0, 0);
|
||||||
else
|
else
|
||||||
val = 0;
|
val = 0;
|
||||||
w = s->last_scr_width * ((s->ds->depth + 7) >> 3);
|
w = s->last_scr_width * ((ds_get_bits_per_pixel(s->ds) + 7) >> 3);
|
||||||
d = s->ds->data;
|
d = ds_get_data(s->ds);
|
||||||
for(i = 0; i < s->last_scr_height; i++) {
|
for(i = 0; i < s->last_scr_height; i++) {
|
||||||
memset(d, val, w);
|
memset(d, val, w);
|
||||||
d += s->ds->linesize;
|
d += ds_get_linesize(s->ds);
|
||||||
}
|
}
|
||||||
dpy_update(s->ds, 0, 0,
|
dpy_update(s->ds, 0, 0,
|
||||||
s->last_scr_width, s->last_scr_height);
|
s->last_scr_width, s->last_scr_height);
|
||||||
@ -1766,7 +1766,7 @@ static void vga_update_display(void *opaque)
|
|||||||
VGAState *s = (VGAState *)opaque;
|
VGAState *s = (VGAState *)opaque;
|
||||||
int full_update, graphic_mode;
|
int full_update, graphic_mode;
|
||||||
|
|
||||||
if (s->ds->depth == 0) {
|
if (ds_get_bits_per_pixel(s->ds) == 0) {
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
} else {
|
} else {
|
||||||
s->rgb_to_pixel =
|
s->rgb_to_pixel =
|
||||||
@ -2455,10 +2455,10 @@ static void vga_screen_dump(void *opaque, const char *filename)
|
|||||||
s->graphic_mode = -1;
|
s->graphic_mode = -1;
|
||||||
vga_update_display(s);
|
vga_update_display(s);
|
||||||
|
|
||||||
if (ds->data) {
|
if (ds_get_data(ds)) {
|
||||||
ppm_save(filename, ds->data, vga_save_w, vga_save_h,
|
ppm_save(filename, ds_get_data(ds), vga_save_w, vga_save_h,
|
||||||
s->ds->linesize);
|
ds_get_linesize(s->ds));
|
||||||
qemu_free(ds->data);
|
qemu_free(ds_get_data(ds));
|
||||||
}
|
}
|
||||||
s->ds = saved_ds;
|
s->ds = saved_ds;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ static inline void vmsvga_update_rect(struct vmsvga_state_s *s,
|
|||||||
width = s->bypp * w;
|
width = s->bypp * w;
|
||||||
start = s->bypp * x + bypl * y;
|
start = s->bypp * x + bypl * y;
|
||||||
src = s->vram + start;
|
src = s->vram + start;
|
||||||
dst = s->ds->data + start;
|
dst = ds_get_data(s->ds) + start;
|
||||||
|
|
||||||
for (; line > 0; line --, src += bypl, dst += bypl)
|
for (; line > 0; line --, src += bypl, dst += bypl)
|
||||||
memcpy(dst, src, width);
|
memcpy(dst, src, width);
|
||||||
@ -331,7 +331,7 @@ static inline void vmsvga_update_rect(struct vmsvga_state_s *s,
|
|||||||
static inline void vmsvga_update_screen(struct vmsvga_state_s *s)
|
static inline void vmsvga_update_screen(struct vmsvga_state_s *s)
|
||||||
{
|
{
|
||||||
#ifndef DIRECT_VRAM
|
#ifndef DIRECT_VRAM
|
||||||
memcpy(s->ds->data, s->vram, s->bypp * s->width * s->height);
|
memcpy(ds_get_data(s->ds), s->vram, s->bypp * s->width * s->height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dpy_update(s->ds, 0, 0, s->width, s->height);
|
dpy_update(s->ds, 0, 0, s->width, s->height);
|
||||||
@ -373,7 +373,7 @@ static inline void vmsvga_copy_rect(struct vmsvga_state_s *s,
|
|||||||
int x0, int y0, int x1, int y1, int w, int h)
|
int x0, int y0, int x1, int y1, int w, int h)
|
||||||
{
|
{
|
||||||
# ifdef DIRECT_VRAM
|
# ifdef DIRECT_VRAM
|
||||||
uint8_t *vram = s->ds->data;
|
uint8_t *vram = ds_get_data(s->ds);
|
||||||
# else
|
# else
|
||||||
uint8_t *vram = s->vram;
|
uint8_t *vram = s->vram;
|
||||||
# endif
|
# endif
|
||||||
@ -410,7 +410,7 @@ static inline void vmsvga_fill_rect(struct vmsvga_state_s *s,
|
|||||||
uint32_t c, int x, int y, int w, int h)
|
uint32_t c, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
# ifdef DIRECT_VRAM
|
# ifdef DIRECT_VRAM
|
||||||
uint8_t *vram = s->ds->data;
|
uint8_t *vram = ds_get_data(s->ds);
|
||||||
# else
|
# else
|
||||||
uint8_t *vram = s->vram;
|
uint8_t *vram = s->vram;
|
||||||
# endif
|
# endif
|
||||||
@ -915,7 +915,7 @@ static void vmsvga_reset(struct vmsvga_state_s *s)
|
|||||||
s->width = -1;
|
s->width = -1;
|
||||||
s->height = -1;
|
s->height = -1;
|
||||||
s->svgaid = SVGA_ID;
|
s->svgaid = SVGA_ID;
|
||||||
s->depth = s->ds->depth ? s->ds->depth : 24;
|
s->depth = ds_get_bits_per_pixel(s->ds) ? ds_get_bits_per_pixel(s->ds) : 24;
|
||||||
s->bypp = (s->depth + 7) >> 3;
|
s->bypp = (s->depth + 7) >> 3;
|
||||||
s->cursor.on = 0;
|
s->cursor.on = 0;
|
||||||
s->redraw_fifo_first = 0;
|
s->redraw_fifo_first = 0;
|
||||||
@ -976,7 +976,7 @@ static void vmsvga_screen_dump(void *opaque, const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (s->depth == 32) {
|
if (s->depth == 32) {
|
||||||
ppm_save(filename, s->vram, s->width, s->height, s->ds->linesize);
|
ppm_save(filename, s->vram, s->width, s->height, ds_get_linesize(s->ds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -994,7 +994,7 @@ static uint32_t vmsvga_vram_readb(void *opaque, target_phys_addr_t addr)
|
|||||||
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
||||||
addr -= s->vram_base;
|
addr -= s->vram_base;
|
||||||
if (addr < s->fb_size)
|
if (addr < s->fb_size)
|
||||||
return *(uint8_t *) (s->ds->data + addr);
|
return *(uint8_t *) (ds_get_data(s->ds) + addr);
|
||||||
else
|
else
|
||||||
return *(uint8_t *) (s->vram + addr);
|
return *(uint8_t *) (s->vram + addr);
|
||||||
}
|
}
|
||||||
@ -1004,7 +1004,7 @@ static uint32_t vmsvga_vram_readw(void *opaque, target_phys_addr_t addr)
|
|||||||
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
||||||
addr -= s->vram_base;
|
addr -= s->vram_base;
|
||||||
if (addr < s->fb_size)
|
if (addr < s->fb_size)
|
||||||
return *(uint16_t *) (s->ds->data + addr);
|
return *(uint16_t *) (ds_get_data(s->ds) + addr);
|
||||||
else
|
else
|
||||||
return *(uint16_t *) (s->vram + addr);
|
return *(uint16_t *) (s->vram + addr);
|
||||||
}
|
}
|
||||||
@ -1014,7 +1014,7 @@ static uint32_t vmsvga_vram_readl(void *opaque, target_phys_addr_t addr)
|
|||||||
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
||||||
addr -= s->vram_base;
|
addr -= s->vram_base;
|
||||||
if (addr < s->fb_size)
|
if (addr < s->fb_size)
|
||||||
return *(uint32_t *) (s->ds->data + addr);
|
return *(uint32_t *) (ds_get_data(s->ds) + addr);
|
||||||
else
|
else
|
||||||
return *(uint32_t *) (s->vram + addr);
|
return *(uint32_t *) (s->vram + addr);
|
||||||
}
|
}
|
||||||
@ -1025,7 +1025,7 @@ static void vmsvga_vram_writeb(void *opaque, target_phys_addr_t addr,
|
|||||||
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
||||||
addr -= s->vram_base;
|
addr -= s->vram_base;
|
||||||
if (addr < s->fb_size)
|
if (addr < s->fb_size)
|
||||||
*(uint8_t *) (s->ds->data + addr) = value;
|
*(uint8_t *) (ds_get_data(s->ds) + addr) = value;
|
||||||
else
|
else
|
||||||
*(uint8_t *) (s->vram + addr) = value;
|
*(uint8_t *) (s->vram + addr) = value;
|
||||||
}
|
}
|
||||||
@ -1036,7 +1036,7 @@ static void vmsvga_vram_writew(void *opaque, target_phys_addr_t addr,
|
|||||||
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
||||||
addr -= s->vram_base;
|
addr -= s->vram_base;
|
||||||
if (addr < s->fb_size)
|
if (addr < s->fb_size)
|
||||||
*(uint16_t *) (s->ds->data + addr) = value;
|
*(uint16_t *) (ds_get_data(s->ds) + addr) = value;
|
||||||
else
|
else
|
||||||
*(uint16_t *) (s->vram + addr) = value;
|
*(uint16_t *) (s->vram + addr) = value;
|
||||||
}
|
}
|
||||||
@ -1047,7 +1047,7 @@ static void vmsvga_vram_writel(void *opaque, target_phys_addr_t addr,
|
|||||||
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
struct vmsvga_state_s *s = (struct vmsvga_state_s *) opaque;
|
||||||
addr -= s->vram_base;
|
addr -= s->vram_base;
|
||||||
if (addr < s->fb_size)
|
if (addr < s->fb_size)
|
||||||
*(uint32_t *) (s->ds->data + addr) = value;
|
*(uint32_t *) (ds_get_data(s->ds) + addr) = value;
|
||||||
else
|
else
|
||||||
*(uint32_t *) (s->vram + addr) = value;
|
*(uint32_t *) (s->vram + addr) = value;
|
||||||
}
|
}
|
||||||
|
66
vnc.c
66
vnc.c
@ -321,7 +321,7 @@ static void vnc_dpy_resize(DisplayState *ds, int w, int h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));
|
memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));
|
||||||
memset(vs->old_data, 42, vs->ds->linesize * vs->ds->height);
|
memset(vs->old_data, 42, ds_get_linesize(vs->ds) * ds_get_height(vs->ds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fastest code */
|
/* fastest code */
|
||||||
@ -414,10 +414,10 @@ static void send_framebuffer_update_raw(VncState *vs, int x, int y, int w, int h
|
|||||||
|
|
||||||
vnc_framebuffer_update(vs, x, y, w, h, 0);
|
vnc_framebuffer_update(vs, x, y, w, h, 0);
|
||||||
|
|
||||||
row = vs->ds->data + y * vs->ds->linesize + x * vs->depth;
|
row = ds_get_data(vs->ds) + y * ds_get_linesize(vs->ds) + x * vs->depth;
|
||||||
for (i = 0; i < h; i++) {
|
for (i = 0; i < h; i++) {
|
||||||
vs->write_pixels(vs, row, w * vs->depth);
|
vs->write_pixels(vs, row, w * vs->depth);
|
||||||
row += vs->ds->linesize;
|
row += ds_get_linesize(vs->ds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,7 +495,7 @@ static void vnc_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_
|
|||||||
uint8_t *dst_row;
|
uint8_t *dst_row;
|
||||||
char *old_row;
|
char *old_row;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int pitch = ds->linesize;
|
int pitch = ds_get_linesize(ds);
|
||||||
VncState *vs = ds->opaque;
|
VncState *vs = ds->opaque;
|
||||||
|
|
||||||
vnc_update_client(vs);
|
vnc_update_client(vs);
|
||||||
@ -505,11 +505,11 @@ static void vnc_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_
|
|||||||
pitch = -pitch;
|
pitch = -pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
src = (ds->linesize * (src_y + y) + vs->depth * src_x);
|
src = (ds_get_linesize(ds) * (src_y + y) + vs->depth * src_x);
|
||||||
dst = (ds->linesize * (dst_y + y) + vs->depth * dst_x);
|
dst = (ds_get_linesize(ds) * (dst_y + y) + vs->depth * dst_x);
|
||||||
|
|
||||||
src_row = ds->data + src;
|
src_row = ds_get_data(ds) + src;
|
||||||
dst_row = ds->data + dst;
|
dst_row = ds_get_data(ds) + dst;
|
||||||
old_row = vs->old_data + dst;
|
old_row = vs->old_data + dst;
|
||||||
|
|
||||||
for (y = 0; y < h; y++) {
|
for (y = 0; y < h; y++) {
|
||||||
@ -563,7 +563,7 @@ static void vnc_update_client(void *opaque)
|
|||||||
|
|
||||||
/* Walk through the dirty map and eliminate tiles that
|
/* Walk through the dirty map and eliminate tiles that
|
||||||
really aren't dirty */
|
really aren't dirty */
|
||||||
row = vs->ds->data;
|
row = ds_get_data(vs->ds);
|
||||||
old_row = vs->old_data;
|
old_row = vs->old_data;
|
||||||
|
|
||||||
for (y = 0; y < vs->height; y++) {
|
for (y = 0; y < vs->height; y++) {
|
||||||
@ -575,7 +575,7 @@ static void vnc_update_client(void *opaque)
|
|||||||
ptr = row;
|
ptr = row;
|
||||||
old_ptr = (char*)old_row;
|
old_ptr = (char*)old_row;
|
||||||
|
|
||||||
for (x = 0; x < vs->ds->width; x += 16) {
|
for (x = 0; x < ds_get_width(vs->ds); x += 16) {
|
||||||
if (memcmp(old_ptr, ptr, 16 * vs->depth) == 0) {
|
if (memcmp(old_ptr, ptr, 16 * vs->depth) == 0) {
|
||||||
vnc_clear_bit(vs->dirty_row[y], (x / 16));
|
vnc_clear_bit(vs->dirty_row[y], (x / 16));
|
||||||
} else {
|
} else {
|
||||||
@ -588,8 +588,8 @@ static void vnc_update_client(void *opaque)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
row += vs->ds->linesize;
|
row += ds_get_linesize(vs->ds);
|
||||||
old_row += vs->ds->linesize;
|
old_row += ds_get_linesize(vs->ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_dirty) {
|
if (!has_dirty) {
|
||||||
@ -918,7 +918,7 @@ static void check_pointer_type_change(VncState *vs, int absolute)
|
|||||||
vnc_write_u8(vs, 0);
|
vnc_write_u8(vs, 0);
|
||||||
vnc_write_u16(vs, 1);
|
vnc_write_u16(vs, 1);
|
||||||
vnc_framebuffer_update(vs, absolute, 0,
|
vnc_framebuffer_update(vs, absolute, 0,
|
||||||
vs->ds->width, vs->ds->height, -257);
|
ds_get_width(vs->ds), ds_get_height(vs->ds), -257);
|
||||||
vnc_flush(vs);
|
vnc_flush(vs);
|
||||||
}
|
}
|
||||||
vs->absolute = absolute;
|
vs->absolute = absolute;
|
||||||
@ -941,8 +941,8 @@ static void pointer_event(VncState *vs, int button_mask, int x, int y)
|
|||||||
dz = 1;
|
dz = 1;
|
||||||
|
|
||||||
if (vs->absolute) {
|
if (vs->absolute) {
|
||||||
kbd_mouse_event(x * 0x7FFF / (vs->ds->width - 1),
|
kbd_mouse_event(x * 0x7FFF / (ds_get_width(vs->ds) - 1),
|
||||||
y * 0x7FFF / (vs->ds->height - 1),
|
y * 0x7FFF / (ds_get_height(vs->ds) - 1),
|
||||||
dz, buttons);
|
dz, buttons);
|
||||||
} else if (vs->has_pointer_type_change) {
|
} else if (vs->has_pointer_type_change) {
|
||||||
x -= 0x7FFF;
|
x -= 0x7FFF;
|
||||||
@ -1106,25 +1106,25 @@ static void framebuffer_update_request(VncState *vs, int incremental,
|
|||||||
int x_position, int y_position,
|
int x_position, int y_position,
|
||||||
int w, int h)
|
int w, int h)
|
||||||
{
|
{
|
||||||
if (x_position > vs->ds->width)
|
if (x_position > ds_get_width(vs->ds))
|
||||||
x_position = vs->ds->width;
|
x_position = ds_get_width(vs->ds);
|
||||||
if (y_position > vs->ds->height)
|
if (y_position > ds_get_height(vs->ds))
|
||||||
y_position = vs->ds->height;
|
y_position = ds_get_height(vs->ds);
|
||||||
if (x_position + w >= vs->ds->width)
|
if (x_position + w >= ds_get_width(vs->ds))
|
||||||
w = vs->ds->width - x_position;
|
w = ds_get_width(vs->ds) - x_position;
|
||||||
if (y_position + h >= vs->ds->height)
|
if (y_position + h >= ds_get_height(vs->ds))
|
||||||
h = vs->ds->height - y_position;
|
h = ds_get_height(vs->ds) - y_position;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
vs->need_update = 1;
|
vs->need_update = 1;
|
||||||
if (!incremental) {
|
if (!incremental) {
|
||||||
char *old_row = vs->old_data + y_position * vs->ds->linesize;
|
char *old_row = vs->old_data + y_position * ds_get_linesize(vs->ds);
|
||||||
|
|
||||||
for (i = 0; i < h; i++) {
|
for (i = 0; i < h; i++) {
|
||||||
vnc_set_bits(vs->dirty_row[y_position + i],
|
vnc_set_bits(vs->dirty_row[y_position + i],
|
||||||
(vs->ds->width / 16), VNC_DIRTY_WORDS);
|
(ds_get_width(vs->ds) / 16), VNC_DIRTY_WORDS);
|
||||||
memset(old_row, 42, vs->ds->width * vs->depth);
|
memset(old_row, 42, ds_get_width(vs->ds) * vs->depth);
|
||||||
old_row += vs->ds->linesize;
|
old_row += ds_get_linesize(vs->ds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1134,7 +1134,7 @@ static void send_ext_key_event_ack(VncState *vs)
|
|||||||
vnc_write_u8(vs, 0);
|
vnc_write_u8(vs, 0);
|
||||||
vnc_write_u8(vs, 0);
|
vnc_write_u8(vs, 0);
|
||||||
vnc_write_u16(vs, 1);
|
vnc_write_u16(vs, 1);
|
||||||
vnc_framebuffer_update(vs, 0, 0, vs->ds->width, vs->ds->height, -258);
|
vnc_framebuffer_update(vs, 0, 0, ds_get_width(vs->ds), ds_get_height(vs->ds), -258);
|
||||||
vnc_flush(vs);
|
vnc_flush(vs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1497,10 +1497,10 @@ static int protocol_client_init(VncState *vs, uint8_t *data, size_t len)
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
vs->width = vs->ds->width;
|
vs->width = ds_get_width(vs->ds);
|
||||||
vs->height = vs->ds->height;
|
vs->height = ds_get_height(vs->ds);
|
||||||
vnc_write_u16(vs, vs->ds->width);
|
vnc_write_u16(vs, ds_get_width(vs->ds));
|
||||||
vnc_write_u16(vs, vs->ds->height);
|
vnc_write_u16(vs, ds_get_height(vs->ds));
|
||||||
|
|
||||||
pixel_format_message(vs);
|
pixel_format_message(vs);
|
||||||
|
|
||||||
@ -2116,7 +2116,7 @@ static void vnc_connect(VncState *vs)
|
|||||||
vnc_write(vs, "RFB 003.008\n", 12);
|
vnc_write(vs, "RFB 003.008\n", 12);
|
||||||
vnc_flush(vs);
|
vnc_flush(vs);
|
||||||
vnc_read_when(vs, protocol_version, 12);
|
vnc_read_when(vs, protocol_version, 12);
|
||||||
memset(vs->old_data, 0, vs->ds->linesize * vs->ds->height);
|
memset(vs->old_data, 0, ds_get_linesize(vs->ds) * ds_get_height(vs->ds));
|
||||||
memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));
|
memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));
|
||||||
vs->has_resize = 0;
|
vs->has_resize = 0;
|
||||||
vs->has_hextile = 0;
|
vs->has_hextile = 0;
|
||||||
|
10
vnchextile.h
10
vnchextile.h
@ -13,7 +13,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
|
|||||||
void *last_fg_,
|
void *last_fg_,
|
||||||
int *has_bg, int *has_fg)
|
int *has_bg, int *has_fg)
|
||||||
{
|
{
|
||||||
uint8_t *row = (vs->ds->data + y * vs->ds->linesize + x * vs->depth);
|
uint8_t *row = (ds_get_data(vs->ds) + y * ds_get_linesize(vs->ds) + x * vs->depth);
|
||||||
pixel_t *irow = (pixel_t *)row;
|
pixel_t *irow = (pixel_t *)row;
|
||||||
int j, i;
|
int j, i;
|
||||||
pixel_t *last_bg = (pixel_t *)last_bg_;
|
pixel_t *last_bg = (pixel_t *)last_bg_;
|
||||||
@ -57,7 +57,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
|
|||||||
}
|
}
|
||||||
if (n_colors > 2)
|
if (n_colors > 2)
|
||||||
break;
|
break;
|
||||||
irow += vs->ds->linesize / sizeof(pixel_t);
|
irow += ds_get_linesize(vs->ds) / sizeof(pixel_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_colors > 1 && fg_count > bg_count) {
|
if (n_colors > 1 && fg_count > bg_count) {
|
||||||
@ -105,7 +105,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
|
|||||||
n_data += 2;
|
n_data += 2;
|
||||||
n_subtiles++;
|
n_subtiles++;
|
||||||
}
|
}
|
||||||
irow += vs->ds->linesize / sizeof(pixel_t);
|
irow += ds_get_linesize(vs->ds) / sizeof(pixel_t);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@ -161,7 +161,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
|
|||||||
n_data += 2;
|
n_data += 2;
|
||||||
n_subtiles++;
|
n_subtiles++;
|
||||||
}
|
}
|
||||||
irow += vs->ds->linesize / sizeof(pixel_t);
|
irow += ds_get_linesize(vs->ds) / sizeof(pixel_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A SubrectsColoured subtile invalidates the foreground color */
|
/* A SubrectsColoured subtile invalidates the foreground color */
|
||||||
@ -198,7 +198,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
|
|||||||
} else {
|
} else {
|
||||||
for (j = 0; j < h; j++) {
|
for (j = 0; j < h; j++) {
|
||||||
vs->write_pixels(vs, row, w * vs->depth);
|
vs->write_pixels(vs, row, w * vs->depth);
|
||||||
row += vs->ds->linesize;
|
row += ds_get_linesize(vs->ds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user