Some code cleanup after implementing new text update API.
This commit is contained in:
parent
db02efc65f
commit
08b120c5f8
@ -139,7 +139,8 @@ bx_gui_c::bx_gui_c(void): disp_mode(DISP_MODE_SIM)
|
||||
led_timer_index = BX_NULL_TIMER_HANDLE;
|
||||
framebuffer = NULL;
|
||||
guest_textmode = 1;
|
||||
guest_fsize = (16 << 8) | 8;
|
||||
guest_fwidth = 8;
|
||||
guest_fheight = 16;
|
||||
guest_xres = 640;
|
||||
guest_yres = 480;
|
||||
guest_bpp = 8;
|
||||
@ -1141,13 +1142,12 @@ void bx_gui_c::draw_char_common(Bit8u ch, Bit8u fc, Bit8u bc, Bit16u xc,
|
||||
Bit8u fy, bx_bool gfxcharw9, Bit8u cs, Bit8u ce,
|
||||
bx_bool curs)
|
||||
{
|
||||
Bit8u *buf, *font_ptr, fwidth, fontpixels;
|
||||
Bit8u *buf, *font_ptr, fontpixels;
|
||||
Bit16u font_row, mask;
|
||||
bx_bool dwidth;
|
||||
|
||||
buf = BX_GUI_THIS snapshot_buffer + yc * BX_GUI_THIS guest_xres + xc;
|
||||
fwidth = BX_GUI_THIS guest_fsize & 0x1f;
|
||||
dwidth = (fwidth > 9);
|
||||
dwidth = (BX_GUI_THIS guest_fwidth > 9);
|
||||
font_ptr = &vga_charmap[(ch << 5) + fy];
|
||||
do {
|
||||
font_row = *font_ptr++;
|
||||
@ -1183,16 +1183,15 @@ void bx_gui_c::text_update_common(Bit8u *old_text, Bit8u *new_text,
|
||||
{
|
||||
Bit16u curs, cursor_x, cursor_y, xc, yc, rows, hchars, text_cols;
|
||||
Bit16u offset, loffset;
|
||||
Bit8u fheight, fwidth, cfheight, cfwidth, cfrow, cfcol, fgcolor, bgcolor;
|
||||
Bit8u cfheight, cfwidth, cfrow, cfcol, fgcolor, bgcolor;
|
||||
Bit8u split_textrow, split_fontrows, x, y;
|
||||
Bit8u *new_line, *old_line, *text_base;
|
||||
bx_bool cursor_visible, gfxcharw9, split_screen;
|
||||
bx_bool forceUpdate = 0, blink_mode = 0, blink_state = 0;
|
||||
|
||||
if (BX_GUI_THIS snapshot_mode || BX_GUI_THIS new_text_api) {
|
||||
fheight = BX_GUI_THIS guest_fsize >> 8;
|
||||
fwidth = BX_GUI_THIS guest_fsize & 0x1f;
|
||||
cursor_visible = ((tm_info->cs_start <= tm_info->cs_end) && (tm_info->cs_start < fheight));
|
||||
cursor_visible = ((tm_info->cs_start <= tm_info->cs_end) &&
|
||||
(tm_info->cs_start < BX_GUI_THIS guest_fheight));
|
||||
if (BX_GUI_THIS snapshot_mode && (BX_GUI_THIS snapshot_buffer != NULL)) {
|
||||
forceUpdate = 1;
|
||||
} else if (BX_GUI_THIS new_text_api) {
|
||||
@ -1225,17 +1224,17 @@ void bx_gui_c::text_update_common(Bit8u *old_text, Bit8u *new_text,
|
||||
old_text[cursor_address] = ~new_text[cursor_address];
|
||||
}
|
||||
}
|
||||
rows = BX_GUI_THIS guest_yres / fheight;
|
||||
rows = BX_GUI_THIS guest_yres / BX_GUI_THIS guest_fheight;
|
||||
if (tm_info->v_panning > 0) rows++;
|
||||
text_cols = BX_GUI_THIS guest_xres / fwidth;
|
||||
text_cols = BX_GUI_THIS guest_xres / BX_GUI_THIS guest_fwidth;
|
||||
if (cursor_visible) {
|
||||
curs = cursor_address;
|
||||
} else {
|
||||
curs = 0xffff;
|
||||
}
|
||||
if (tm_info->line_compare < 0x3ff) {
|
||||
split_textrow = (tm_info->line_compare + tm_info->v_panning) / fheight;
|
||||
split_fontrows = ((tm_info->line_compare + tm_info->v_panning) % fheight) + 1;
|
||||
split_textrow = (tm_info->line_compare + tm_info->v_panning) / BX_GUI_THIS guest_fheight;
|
||||
split_fontrows = ((tm_info->line_compare + tm_info->v_panning) % BX_GUI_THIS guest_fheight) + 1;
|
||||
} else {
|
||||
split_textrow = 0xff;
|
||||
split_fontrows = 0;
|
||||
@ -1250,12 +1249,12 @@ void bx_gui_c::text_update_common(Bit8u *old_text, Bit8u *new_text,
|
||||
do {
|
||||
hchars = text_cols;
|
||||
if (tm_info->h_panning > 0) hchars++;
|
||||
cfheight = fheight;
|
||||
cfheight = BX_GUI_THIS guest_fheight;
|
||||
cfrow = 0;
|
||||
if (split_screen) {
|
||||
if (rows == 1) {
|
||||
cfheight = (guest_yres - tm_info->line_compare - 1) % fheight;
|
||||
if (cfheight == 0) cfheight = fheight;
|
||||
cfheight = (guest_yres - tm_info->line_compare - 1) % BX_GUI_THIS guest_fheight;
|
||||
if (cfheight == 0) cfheight = BX_GUI_THIS guest_fheight;
|
||||
}
|
||||
} else if (tm_info->v_panning > 0) {
|
||||
if (y == 0) {
|
||||
@ -1274,7 +1273,7 @@ void bx_gui_c::text_update_common(Bit8u *old_text, Bit8u *new_text,
|
||||
x = 0;
|
||||
xc = 0;
|
||||
do {
|
||||
cfwidth = fwidth;
|
||||
cfwidth = BX_GUI_THIS guest_fwidth;
|
||||
cfcol = 0;
|
||||
if (tm_info->h_panning > 0) {
|
||||
if (x == 0) {
|
||||
@ -1318,7 +1317,7 @@ void bx_gui_c::text_update_common(Bit8u *old_text, Bit8u *new_text,
|
||||
new_text = text_base;
|
||||
forceUpdate = 1;
|
||||
loffset = 0;
|
||||
rows = ((guest_yres - tm_info->line_compare + fheight - 2) / fheight) + 1;
|
||||
rows = ((guest_yres - tm_info->line_compare + BX_GUI_THIS guest_fheight - 2) / BX_GUI_THIS guest_fheight) + 1;
|
||||
if (tm_info->split_hpanning) tm_info->h_panning = 0;
|
||||
split_screen = 1;
|
||||
} else {
|
||||
@ -1412,7 +1411,8 @@ void bx_gui_c::console_init(void)
|
||||
console.saved_xres = guest_xres;
|
||||
console.saved_yres = guest_yres;
|
||||
console.saved_bpp = guest_bpp;
|
||||
console.saved_fsize = guest_fsize;
|
||||
console.saved_fwidth = guest_fwidth;
|
||||
console.saved_fheight = guest_fheight;
|
||||
memcpy(console.saved_charmap, BX_GUI_THIS vga_charmap, 0x2000);
|
||||
for (i = 0; i < 256; i++) {
|
||||
memcpy(&BX_GUI_THIS vga_charmap[0]+i*32, &sdl_font8x16[i], 16);
|
||||
@ -1444,8 +1444,8 @@ void bx_gui_c::console_cleanup(void)
|
||||
console.saved_palette[0]);
|
||||
palette_change_common(0x07, console.saved_palette[30], console.saved_palette[29],
|
||||
console.saved_palette[28]);
|
||||
unsigned fheight = (console.saved_fsize >> 8);
|
||||
unsigned fwidth = (console.saved_fsize & 0x1f);
|
||||
unsigned fheight = (console.saved_fheight);
|
||||
unsigned fwidth = (console.saved_fwidth);
|
||||
set_text_charmap(console.saved_charmap);
|
||||
dimension_update(console.saved_xres, console.saved_yres, fheight, fwidth,
|
||||
console.saved_bpp);
|
||||
|
@ -308,7 +308,8 @@ protected:
|
||||
unsigned y_tilesize;
|
||||
// current guest display settings
|
||||
bx_bool guest_textmode;
|
||||
Bit16u guest_fsize;
|
||||
Bit8u guest_fwidth;
|
||||
Bit8u guest_fheight;
|
||||
Bit16u guest_xres;
|
||||
Bit16u guest_yres;
|
||||
Bit8u guest_bpp;
|
||||
@ -339,7 +340,8 @@ protected:
|
||||
bx_bool running;
|
||||
Bit8u *screen;
|
||||
Bit8u *oldscreen;
|
||||
Bit16u saved_fsize;
|
||||
Bit8u saved_fwidth;
|
||||
Bit8u saved_fheight;
|
||||
Bit16u saved_xres;
|
||||
Bit16u saved_yres;
|
||||
Bit8u saved_bpp;
|
||||
|
@ -172,9 +172,6 @@ static unsigned rfbStatusitemPos[12] = {
|
||||
};
|
||||
static bx_bool rfbStatusitemActive[12];
|
||||
|
||||
static unsigned int text_rows = 25, text_cols = 80;
|
||||
static unsigned int font_height = 16, font_width = 8;
|
||||
|
||||
static SOCKET sGlobal;
|
||||
|
||||
static Bit32u clientEncodingsCount = 0;
|
||||
@ -440,15 +437,10 @@ void bx_rfb_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, un
|
||||
BX_PANIC(("%d bpp graphics mode not supported yet", bpp));
|
||||
}
|
||||
guest_textmode = (fheight > 0);
|
||||
guest_fsize = (fheight << 8) | fwidth;
|
||||
guest_fwidth = fwidth;
|
||||
guest_fheight = fheight;
|
||||
guest_xres = x;
|
||||
guest_yres = y;
|
||||
if (guest_textmode) {
|
||||
font_height = fheight;
|
||||
font_width = fwidth;
|
||||
text_cols = x / fwidth;
|
||||
text_rows = y / fheight;
|
||||
}
|
||||
if ((x != rfbDimensionX) || (y != rfbDimensionY)) {
|
||||
if (desktop_resizable) {
|
||||
if ((x > BX_RFB_MAX_XDIM) || (y > BX_RFB_MAX_YDIM)) {
|
||||
|
@ -95,8 +95,6 @@ unsigned half_res_x, half_res_y;
|
||||
int headerbar_height;
|
||||
static unsigned bx_bitmap_left_xorigin = 0; // pixels from left
|
||||
static unsigned bx_bitmap_right_xorigin = 0; // pixels from right
|
||||
static unsigned int text_rows = 25, text_cols = 80;
|
||||
int fontwidth = 8, fontheight = 16;
|
||||
static unsigned disp_bpp=8;
|
||||
unsigned char menufont[256][8];
|
||||
Uint32 sdl_palette[256];
|
||||
@ -592,7 +590,7 @@ void bx_sdl_gui_c::draw_char(Bit8u ch, Bit8u fc, Bit8u bc, Bit16u xc, Bit16u yc,
|
||||
{
|
||||
Uint32 *buf, pitch, fgcolor, bgcolor;
|
||||
Bit16u font_row, mask;
|
||||
Bit8u *font_ptr, fwidth, fontpixels;
|
||||
Bit8u *font_ptr, fontpixels;
|
||||
bx_bool dwidth;
|
||||
|
||||
if (sdl_screen) {
|
||||
@ -604,8 +602,7 @@ void bx_sdl_gui_c::draw_char(Bit8u ch, Bit8u fc, Bit8u bc, Bit16u xc, Bit16u yc,
|
||||
}
|
||||
fgcolor = sdl_palette[fc];
|
||||
bgcolor = sdl_palette[bc];
|
||||
fwidth = guest_fsize & 0x1f;
|
||||
dwidth = (fwidth > 9);
|
||||
dwidth = (guest_fwidth > 9);
|
||||
font_ptr = &vga_charmap[(ch << 5) + fy];
|
||||
do {
|
||||
font_row = *font_ptr++;
|
||||
@ -1058,15 +1055,10 @@ void bx_sdl_gui_c::dimension_update(unsigned x, unsigned y,
|
||||
BX_PANIC(("%d bpp graphics mode not supported", bpp));
|
||||
}
|
||||
guest_textmode = (fheight > 0);
|
||||
guest_fsize = (fheight << 8) | fwidth;
|
||||
guest_fwidth = fwidth;
|
||||
guest_fheight = fheight;
|
||||
guest_xres = x;
|
||||
guest_yres = y;
|
||||
if (guest_textmode) {
|
||||
fontheight = fheight;
|
||||
fontwidth = fwidth;
|
||||
text_cols = x / fontwidth;
|
||||
text_rows = y / fontheight;
|
||||
}
|
||||
|
||||
if ((x == res_x) && (y == res_y)) return;
|
||||
#ifndef ANDROID
|
||||
|
@ -97,8 +97,6 @@ unsigned half_res_x, half_res_y;
|
||||
int headerbar_height;
|
||||
static unsigned bx_bitmap_left_xorigin = 0; // pixels from left
|
||||
static unsigned bx_bitmap_right_xorigin = 0; // pixels from right
|
||||
static unsigned int text_rows = 25, text_cols = 80;
|
||||
int fontwidth = 8, fontheight = 16;
|
||||
static unsigned disp_bpp=8;
|
||||
unsigned char menufont[256][8];
|
||||
Uint32 sdl_palette[256];
|
||||
@ -525,7 +523,7 @@ void bx_sdl2_gui_c::draw_char(Bit8u ch, Bit8u fc, Bit8u bc, Bit16u xc, Bit16u yc
|
||||
{
|
||||
Uint32 *buf, pitch, fgcolor, bgcolor;
|
||||
Bit16u font_row, mask;
|
||||
Bit8u *font_ptr, fwidth, fontpixels;
|
||||
Bit8u *font_ptr, fontpixels;
|
||||
bx_bool dwidth;
|
||||
|
||||
if (sdl_screen) {
|
||||
@ -537,8 +535,7 @@ void bx_sdl2_gui_c::draw_char(Bit8u ch, Bit8u fc, Bit8u bc, Bit16u xc, Bit16u yc
|
||||
}
|
||||
fgcolor = sdl_palette[fc];
|
||||
bgcolor = sdl_palette[bc];
|
||||
fwidth = guest_fsize & 0x1f;
|
||||
dwidth = (fwidth > 9);
|
||||
dwidth = (guest_fwidth > 9);
|
||||
font_ptr = &vga_charmap[(ch << 5) + fy];
|
||||
do {
|
||||
font_row = *font_ptr++;
|
||||
@ -973,15 +970,10 @@ void bx_sdl2_gui_c::dimension_update(unsigned x, unsigned y,
|
||||
BX_PANIC(("%d bpp graphics mode not supported", bpp));
|
||||
}
|
||||
guest_textmode = (fheight > 0);
|
||||
guest_fsize = (fheight << 8) | fwidth;
|
||||
guest_fwidth = fwidth;
|
||||
guest_fheight = fheight;
|
||||
guest_xres = x;
|
||||
guest_yres = y;
|
||||
if (guest_textmode) {
|
||||
fontheight = fheight;
|
||||
fontwidth = fwidth;
|
||||
text_cols = x / fontwidth;
|
||||
text_rows = y / fontheight;
|
||||
}
|
||||
|
||||
if ((x == res_x) && (y == res_y)) return;
|
||||
|
||||
|
@ -178,9 +178,6 @@ static unsigned rfbStatusitemPos[12] = {
|
||||
};
|
||||
static bx_bool rfbStatusitemActive[12];
|
||||
|
||||
static unsigned int text_rows = 25, text_cols = 80;
|
||||
static unsigned int font_height = 16, font_width = 8;
|
||||
|
||||
inline rfbPixel rfbMapRGB(U32 red, U32 green, U32 blue) {
|
||||
U16 redMax = theGui->screen->serverFormat.redMax;
|
||||
U16 greenMax = theGui->screen->serverFormat.greenMax;
|
||||
@ -457,15 +454,10 @@ void bx_vncsrv_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight,
|
||||
BX_PANIC(("%d bpp graphics mode not supported", bpp));
|
||||
}
|
||||
guest_textmode = (fheight > 0);
|
||||
guest_fsize = (fheight << 8) | fwidth;
|
||||
guest_fwidth = fwidth;
|
||||
guest_fheight = fheight;
|
||||
guest_xres = x;
|
||||
guest_yres = y;
|
||||
if (guest_textmode) {
|
||||
font_height = fheight;
|
||||
font_width = fwidth;
|
||||
text_cols = x / fwidth;
|
||||
text_rows = y / fheight;
|
||||
}
|
||||
if ((x != rfbDimensionX) || (y != rfbDimensionY)) {
|
||||
if (clientPtr->useNewFBSize) {
|
||||
if ((x > BX_RFB_MAX_XDIM) || (y > BX_RFB_MAX_YDIM)) {
|
||||
|
@ -133,7 +133,6 @@ static BOOL fullscreenMode, inFullscreenToggle;
|
||||
// Text mode screen stuff
|
||||
static HBITMAP vgafont[256];
|
||||
static int xChar = 8, yChar = 16;
|
||||
static unsigned int text_rows=25, text_cols=80;
|
||||
|
||||
// Headerbar stuff
|
||||
HWND hwndTB, hwndSB;
|
||||
@ -1852,14 +1851,13 @@ void bx_win32_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
void bx_win32_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
|
||||
{
|
||||
guest_textmode = (fheight > 0);
|
||||
guest_fsize = (fheight << 8) | fwidth;
|
||||
guest_fwidth = fwidth;
|
||||
guest_fheight = fheight;
|
||||
guest_xres = x;
|
||||
guest_yres = y;
|
||||
if (guest_textmode) {
|
||||
yChar = fheight;
|
||||
xChar = fwidth;
|
||||
text_cols = x / fwidth;
|
||||
text_rows = y / fheight;
|
||||
}
|
||||
|
||||
if ((x == dimension_x) && (y == dimension_y) && (bpp == current_bpp))
|
||||
|
@ -112,9 +112,6 @@ static bx_bool wxScreenCheckSize = 0;
|
||||
static unsigned wxTileX = 0;
|
||||
static unsigned wxTileY = 0;
|
||||
static bx_bool wxMouseModeAbsXY = 0;
|
||||
static unsigned long wxFontX = 0;
|
||||
static unsigned long wxFontY = 0;
|
||||
static unsigned int text_rows=25, text_cols=80;
|
||||
static unsigned disp_bpp = 8;
|
||||
static struct {
|
||||
unsigned char red;
|
||||
@ -1364,15 +1361,10 @@ void bx_wx_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, uns
|
||||
BX_PANIC(("%d bpp graphics mode not supported", bpp));
|
||||
}
|
||||
guest_textmode = (fheight > 0);
|
||||
guest_fsize = (fheight << 8) | fwidth;
|
||||
guest_fwidth = fwidth;
|
||||
guest_fheight = fheight;
|
||||
guest_xres = x;
|
||||
guest_yres = y;
|
||||
if (guest_textmode) {
|
||||
wxFontX = fwidth;
|
||||
wxFontY = fheight;
|
||||
text_cols = x / wxFontX;
|
||||
text_rows = y / wxFontY;
|
||||
}
|
||||
if (((int)x > wx_maxres.GetWidth()) || ((int)y > wx_maxres.GetHeight())) {
|
||||
BX_PANIC(("dimension_update(): resolution of out of display bounds"));
|
||||
return;
|
||||
|
@ -107,7 +107,6 @@ static unsigned long white_pixel=0, black_pixel=0;
|
||||
static char *progname; /* name this program was invoked by */
|
||||
|
||||
// text display
|
||||
static unsigned int text_rows=25, text_cols=80;
|
||||
static unsigned font_width, font_height;
|
||||
|
||||
// graphics display
|
||||
@ -659,8 +658,8 @@ void bx_x_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
|
||||
font_width = 8;
|
||||
font_height = 16;
|
||||
|
||||
dimension_x = text_cols * font_width;
|
||||
dimension_y = text_rows * font_height;
|
||||
dimension_x = guest_xres;
|
||||
dimension_y = guest_yres;
|
||||
|
||||
/* create opaque window */
|
||||
win = XCreateSimpleWindow(bx_x_display, RootWindow(bx_x_display,bx_x_screen_num),
|
||||
@ -1357,7 +1356,8 @@ void bx_x_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsi
|
||||
BX_PANIC(("%d bpp graphics mode not supported", bpp));
|
||||
}
|
||||
guest_textmode = (fheight > 0);
|
||||
guest_fsize = (fheight << 8) | fwidth;
|
||||
guest_fwidth = fwidth;
|
||||
guest_fheight = fheight;
|
||||
guest_xres = x;
|
||||
guest_yres = y;
|
||||
if (guest_textmode) {
|
||||
@ -1367,8 +1367,6 @@ void bx_x_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsi
|
||||
charmap_updated = 1;
|
||||
for (int i = 0; i < 256; i++) char_changed[i] = 1;
|
||||
}
|
||||
text_cols = x / font_width;
|
||||
text_rows = y / font_height;
|
||||
}
|
||||
if ((x != dimension_x) || (y != dimension_y)) {
|
||||
XSizeHints hints;
|
||||
|
Loading…
Reference in New Issue
Block a user