typedef enum {
GRAPHIC_CONSOLE,
- TEXT_CONSOLE
+ TEXT_CONSOLE,
+ TEXT_CONSOLE_FIXED_SIZE
} console_type_t;
/* ??? This is mis-named.
previous_active_console = active_console;
active_console = consoles[0];
/* There is currently no way of specifying which screen we want to dump,
- so always dump the dirst one. */
+ so always dump the first one. */
if (consoles[0]->hw_screen_dump)
consoles[0]->hw_screen_dump(consoles[0]->hw, filename);
active_console = previous_active_console;
{
unsigned int r, g, b, color;
- switch(ds->depth) {
+ switch(ds_get_bits_per_pixel(ds)) {
#if 0
case 8:
r = (rgba >> 16) & 0xff;
uint8_t *d, *d1;
int x, y, bpp;
- bpp = (ds->depth + 7) >> 3;
- d1 = ds->data +
- ds->linesize * posy + bpp * posx;
+ bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
+ d1 = ds_get_data(ds) +
+ ds_get_linesize(ds) * posy + bpp * posx;
for (y = 0; y < height; y++) {
d = d1;
switch(bpp) {
}
break;
}
- d1 += ds->linesize;
+ d1 += ds_get_linesize(ds);
}
}
uint8_t *d;
int wb, y, bpp;
- bpp = (ds->depth + 7) >> 3;
+ bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
wb = w * bpp;
if (yd <= ys) {
- s = ds->data +
- ds->linesize * ys + bpp * xs;
- d = ds->data +
- ds->linesize * yd + bpp * xd;
+ s = ds_get_data(ds) +
+ ds_get_linesize(ds) * ys + bpp * xs;
+ d = ds_get_data(ds) +
+ ds_get_linesize(ds) * yd + bpp * xd;
for (y = 0; y < h; y++) {
memmove(d, s, wb);
- d += ds->linesize;
- s += ds->linesize;
+ d += ds_get_linesize(ds);
+ s += ds_get_linesize(ds);
}
} else {
- s = ds->data +
- ds->linesize * (ys + h - 1) + bpp * xs;
- d = ds->data +
- ds->linesize * (yd + h - 1) + bpp * xd;
+ s = ds_get_data(ds) +
+ ds_get_linesize(ds) * (ys + h - 1) + bpp * xs;
+ d = ds_get_data(ds) +
+ ds_get_linesize(ds) * (yd + h - 1) + bpp * xd;
for (y = 0; y < h; y++) {
memmove(d, s, wb);
- d -= ds->linesize;
- s -= ds->linesize;
+ d -= ds_get_linesize(ds);
+ s -= ds_get_linesize(ds);
}
}
}
static inline unsigned int col_expand(DisplayState *ds, unsigned int col)
{
- switch(ds->depth) {
+ switch(ds_get_bits_per_pixel(ds)) {
case 8:
col |= col << 8;
col |= col << 16;
bgcol = color_table[t_attrib->bold][t_attrib->bgcol];
}
- bpp = (ds->depth + 7) >> 3;
- d = ds->data +
- ds->linesize * y * FONT_HEIGHT + bpp * x * FONT_WIDTH;
- linesize = ds->linesize;
+ bpp = (ds_get_bits_per_pixel(ds) + 7) >> 3;
+ d = ds_get_data(ds) +
+ ds_get_linesize(ds) * y * FONT_HEIGHT + bpp * x * FONT_WIDTH;
+ linesize = ds_get_linesize(ds);
font_ptr = vgafont16 + FONT_HEIGHT * ch;
xorcol = bgcol ^ fgcol;
- switch(ds->depth) {
+ switch(ds_get_bits_per_pixel(ds)) {
case 8:
for(i = 0; i < FONT_HEIGHT; i++) {
font_data = *font_ptr++;
int y1, y2;
if (s == active_console) {
- if (!s->ds->depth) {
+ if (!ds_get_bits_per_pixel(s->ds)) {
text_update_xy(s, x, y);
return;
}
if (s == active_console) {
int x = s->x;
- if (!s->ds->depth) {
+ if (!ds_get_bits_per_pixel(s->ds)) {
s->cursor_invalidate = 1;
return;
}
if (s != active_console)
return;
- if (!s->ds->depth) {
+ if (!ds_get_bits_per_pixel(s->ds)) {
s->text_x[0] = 0;
s->text_y[0] = 0;
s->text_x[1] = s->width - 1;
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]);
y1 = s->y_displayed;
for(y = 0; y < s->height; y++) {
if (++y1 == s->total_height)
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);
}
c++;
}
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_y[0] = 0;
s->text_x[1] = s->width - 1;
s = consoles[index];
if (s) {
active_console = s;
- if (s->g_width && s->g_height
- && (s->g_width != s->ds->width || s->g_height != s->ds->height))
+ if (s->console_type != TEXT_CONSOLE && s->g_width && s->g_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);
vga_hw_invalidate();
}
{
TextConsole *s = (TextConsole *) opaque;
+ 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)
+ dpy_resize(s->ds, s->g_width, s->g_height);
+ else {
+ s->g_width = ds_get_width(s->ds);
+ s->g_height = ds_get_height(s->ds);
+ text_console_resize(s);
+ }
+ }
console_refresh(s);
}
return active_console && active_console->console_type == GRAPHIC_CONSOLE;
}
+int is_fixedsize_console(void)
+{
+ return active_console && active_console->console_type != TEXT_CONSOLE;
+}
+
void console_color_init(DisplayState *ds)
{
int i, j;
chr = qemu_mallocz(sizeof(CharDriverState));
if (!chr)
return NULL;
- s = new_console(ds, TEXT_CONSOLE);
+ s = new_console(ds, (p == 0) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE);
if (!s) {
free(chr);
return NULL;
}
- if (!p)
- p = DEFAULT_MONITOR_SIZE;
-
chr->opaque = s;
chr->chr_write = console_puts;
chr->chr_send_event = console_send_event;
s->total_height = DEFAULT_BACKSCROLL;
s->x = 0;
s->y = 0;
- width = s->ds->width;
- height = s->ds->height;
+ width = ds_get_width(s->ds);
+ height = ds_get_height(s->ds);
if (p != 0) {
width = strtoul(p, (char **)&p, 10);
if (*p == 'C') {
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
+ || !ds_get_data(console->ds)) {
console->g_width = width;
console->g_height = height;
if (active_console == console) {
}
}
}
+
+void qemu_console_copy(QEMUConsole *console, int src_x, int src_y,
+ int dst_x, int dst_y, int w, int h)
+{
+ if (active_console == console) {
+ if (console->ds->dpy_copy)
+ console->ds->dpy_copy(console->ds,
+ src_x, src_y, dst_x, dst_y, w, h);
+ else {
+ /* TODO */
+ console->ds->dpy_update(console->ds, dst_x, dst_y, w, h);
+ }
+ }
+}