Fixed and improved text mode CO40.
- vgacore: double font and screen width at half dot clock. - X gui: improved font bitmap generation to support width > 9. - win32 gui: adjust values to use existing stretching feature. - guis rfb, sdl, sdl2, vncsrv and wx: double pixels if font width > 9.
This commit is contained in:
parent
1a3bf9419c
commit
cbd147fca3
@ -1276,6 +1276,7 @@ void DrawChar(int x, int y, int width, int height, int fonty, char *bmap,
|
||||
static unsigned char newBits[9 * 32];
|
||||
unsigned char mask;
|
||||
int bytes = width * height;
|
||||
bx_bool dwidth = (width > 9);
|
||||
for (int i = 0; i < bytes; i+=width) {
|
||||
mask = 0x80;
|
||||
for (int j = 0; j < width; j++) {
|
||||
@ -1288,7 +1289,7 @@ void DrawChar(int x, int y, int width, int height, int fonty, char *bmap,
|
||||
newBits[i + j] = bgcolor;
|
||||
}
|
||||
}
|
||||
mask >>= 1;
|
||||
if (!dwidth || (j & 1)) mask >>= 1;
|
||||
}
|
||||
fonty++;
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ void bx_sdl_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
Bit16u font_row, mask;
|
||||
Bit8u cfstart, cfwidth, cfheight, split_fontrows, split_textrow;
|
||||
bx_bool cursor_visible, gfxcharw9, invert, forceUpdate, split_screen;
|
||||
bx_bool blink_mode, blink_state;
|
||||
bx_bool blink_mode, blink_state, dwidth;
|
||||
Uint32 text_palette[16];
|
||||
|
||||
forceUpdate = 0;
|
||||
@ -623,6 +623,7 @@ void bx_sdl_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
if (tm_info->blink_flags & BX_TEXT_BLINK_TOGGLE)
|
||||
forceUpdate = 1;
|
||||
}
|
||||
dwidth = (fontwidth > 9);
|
||||
if (charmap_updated) {
|
||||
forceUpdate = 1;
|
||||
charmap_updated = 0;
|
||||
@ -755,7 +756,7 @@ void bx_sdl_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
else
|
||||
*buf = fgcolor;
|
||||
buf++;
|
||||
font_row <<= 1;
|
||||
if (!dwidth || (fontpixels & 1)) font_row <<= 1;
|
||||
} while (--fontpixels);
|
||||
buf -= cfwidth;
|
||||
buf += disp;
|
||||
|
@ -544,7 +544,7 @@ void bx_sdl2_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
Bit16u font_row, mask;
|
||||
Bit8u cfstart, cfwidth, cfheight, split_fontrows, split_textrow;
|
||||
bx_bool cursor_visible, gfxcharw9, invert, forceUpdate, split_screen;
|
||||
bx_bool blink_mode, blink_state;
|
||||
bx_bool blink_mode, blink_state, dwidth;
|
||||
Uint32 text_palette[16];
|
||||
|
||||
forceUpdate = 0;
|
||||
@ -554,6 +554,7 @@ void bx_sdl2_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
if (tm_info->blink_flags & BX_TEXT_BLINK_TOGGLE)
|
||||
forceUpdate = 1;
|
||||
}
|
||||
dwidth = (fontwidth > 9);
|
||||
if (charmap_updated) {
|
||||
forceUpdate = 1;
|
||||
charmap_updated = 0;
|
||||
@ -686,7 +687,7 @@ void bx_sdl2_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
else
|
||||
*buf = fgcolor;
|
||||
buf++;
|
||||
font_row <<= 1;
|
||||
if (!dwidth || (fontpixels & 1)) font_row <<= 1;
|
||||
} while (--fontpixels);
|
||||
buf -= cfwidth;
|
||||
buf += disp;
|
||||
|
@ -938,9 +938,10 @@ void DrawBitmap(int x, int y, int width, int height, char *bmap,
|
||||
void DrawChar(int x, int y, int width, int height, int fonty, char *bmap,
|
||||
rfbPixel fgcolor, rfbPixel bgcolor, bx_bool gfxchar)
|
||||
{
|
||||
static rfbPixel newBits[9 * 32];
|
||||
static rfbPixel newBits[18 * 32];
|
||||
unsigned char mask;
|
||||
int bytes = width * height;
|
||||
bx_bool dwidth = (width > 9);
|
||||
|
||||
for (int i = 0; i < bytes; i += width) {
|
||||
mask = 0x80;
|
||||
@ -954,7 +955,7 @@ void DrawChar(int x, int y, int width, int height, int fonty, char *bmap,
|
||||
newBits[i + j] = bgcolor;
|
||||
}
|
||||
}
|
||||
mask >>= 1;
|
||||
if (!dwidth || (j & 1)) mask >>= 1;
|
||||
}
|
||||
fonty++;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2014 The Bochs Project
|
||||
// Copyright (C) 2002-2015 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -1919,6 +1919,10 @@ 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);
|
||||
if (guest_textmode && (fwidth > 9)) {
|
||||
x >>= 1;
|
||||
fwidth >>= 1;
|
||||
}
|
||||
xChar = fwidth;
|
||||
yChar = fheight;
|
||||
guest_xres = x;
|
||||
|
@ -1261,9 +1261,10 @@ static void UpdateScreen(unsigned char *newBits, int x, int y, int width, int he
|
||||
|
||||
static void DrawBochsBitmap(int x, int y, int width, int height, char *bmap, char fgcolor, char bgcolor, int fontx, int fonty, bx_bool gfxchar)
|
||||
{
|
||||
static unsigned char newBits[9 * 32];
|
||||
static unsigned char newBits[18 * 32];
|
||||
unsigned char mask;
|
||||
int bytes = width * height;
|
||||
bx_bool dwidth = (width > 9);
|
||||
|
||||
if (y > wxScreenY) return;
|
||||
|
||||
@ -1279,7 +1280,7 @@ static void DrawBochsBitmap(int x, int y, int width, int height, char *bmap, cha
|
||||
newBits[i + j] = bgcolor;
|
||||
}
|
||||
}
|
||||
mask >>= 1;
|
||||
if (!dwidth || (j & 1)) mask >>= 1;
|
||||
}
|
||||
fonty++;
|
||||
}
|
||||
|
@ -1259,14 +1259,14 @@ void bx_x_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
bx_vga_tminfo_t *tm_info)
|
||||
{
|
||||
Bit8u *old_line, *new_line, *text_base;
|
||||
Bit8u cChar;
|
||||
unsigned int curs, hchars, i, j, offset, rows, x, y, xc, yc, yc2, cs_y;
|
||||
Bit8u cChar, fbits, fmask, frow;
|
||||
unsigned int curs, hchars, i, j, k, offset, rows, x, y, xc, yc, yc2, cs_y;
|
||||
unsigned new_foreground, new_background;
|
||||
Bit8u cfwidth, cfheight, cfheight2, font_col, font_row, font_row2;
|
||||
Bit8u split_textrow, split_fontrows;
|
||||
bx_bool forceUpdate = 0, split_screen;
|
||||
bx_bool blink_state, blink_mode;
|
||||
unsigned char cell[64];
|
||||
unsigned char cell[96];
|
||||
unsigned long text_palette[16];
|
||||
|
||||
blink_mode = (tm_info->blink_flags & BX_TEXT_BLINK_MODE) > 0;
|
||||
@ -1276,32 +1276,56 @@ void bx_x_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
forceUpdate = 1;
|
||||
}
|
||||
if (charmap_updated) {
|
||||
BX_INFO(("charmap update. Font Height is %d",font_height));
|
||||
BX_INFO(("charmap update. Font is %d x %d", font_width, font_height));
|
||||
for (unsigned c = 0; c<256; c++) {
|
||||
if (char_changed[c]) {
|
||||
XFreePixmap(bx_x_display, vgafont[c]);
|
||||
bx_bool gfxchar = tm_info->line_graphics && ((c & 0xE0) == 0xC0);
|
||||
bx_bool dwidth = font_width > 9;
|
||||
i = 0;
|
||||
j = 0;
|
||||
memset(cell, 0, sizeof(cell));
|
||||
for(i=0; i<font_height*2; i+=2) {
|
||||
cell[i] |= ((vga_charmap[(c<<5)+j] & 0x01)<<7);
|
||||
cell[i] |= ((vga_charmap[(c<<5)+j] & 0x02)<<5);
|
||||
cell[i] |= ((vga_charmap[(c<<5)+j] & 0x04)<<3);
|
||||
cell[i] |= ((vga_charmap[(c<<5)+j] & 0x08)<<1);
|
||||
cell[i] |= ((vga_charmap[(c<<5)+j] & 0x10)>>1);
|
||||
cell[i] |= ((vga_charmap[(c<<5)+j] & 0x20)>>3);
|
||||
cell[i] |= ((vga_charmap[(c<<5)+j] & 0x40)>>5);
|
||||
cell[i] |= ((vga_charmap[(c<<5)+j] & 0x80)>>7);
|
||||
if (gfxchar) {
|
||||
cell[i+1] = (vga_charmap[(c<<5)+j] & 0x01);
|
||||
}
|
||||
j++;
|
||||
if (dwidth) {
|
||||
do {
|
||||
frow = vga_charmap[(c<<5)+j];
|
||||
fmask = 0x80;
|
||||
fbits = 0x03;
|
||||
for (k=0; k<8; k++) {
|
||||
if (frow & fmask) cell[i] |= fbits;
|
||||
fmask >>= 1;
|
||||
fbits <<= 2;
|
||||
if (k == 3) {
|
||||
i++;
|
||||
fbits = 0x03;
|
||||
}
|
||||
}
|
||||
if (gfxchar) {
|
||||
if (frow & 0x01) cell[i+1] = 0x03;
|
||||
}
|
||||
i += 2;
|
||||
} while (++j < font_height);
|
||||
vgafont[c] = XCreateBitmapFromData(bx_x_display, win,
|
||||
(const char*)cell, 18, font_height);
|
||||
} else {
|
||||
do {
|
||||
frow = vga_charmap[(c<<5)+j];
|
||||
fmask = 0x80;
|
||||
fbits = 0x01;
|
||||
for (k=0; k<8; k++) {
|
||||
if (frow & fmask) cell[i] |= fbits;
|
||||
fmask >>= 1;
|
||||
fbits <<= 1;
|
||||
}
|
||||
if (gfxchar) {
|
||||
if (frow & 0x01) cell[i+1] = 0x01;
|
||||
}
|
||||
i += 2;
|
||||
} while (++j < font_height);
|
||||
vgafont[c] = XCreateBitmapFromData(bx_x_display, win,
|
||||
(const char*)cell, 9, font_height);
|
||||
}
|
||||
|
||||
vgafont[c]=XCreateBitmapFromData(bx_x_display, win,
|
||||
(const char*)cell, 9, font_height);
|
||||
if(vgafont[c] == None)
|
||||
BX_PANIC(("Can't create vga font [%d]", c));
|
||||
if(vgafont[c] == None)
|
||||
BX_PANIC(("Can't create vga font [%d]", c));
|
||||
char_changed[c] = 0;
|
||||
}
|
||||
}
|
||||
@ -1718,7 +1742,11 @@ void bx_x_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsi
|
||||
guest_yres = y;
|
||||
if (guest_textmode) {
|
||||
font_height = fheight;
|
||||
font_width = fwidth;
|
||||
if (fwidth != font_width) {
|
||||
font_width = fwidth;
|
||||
charmap_updated = 1;
|
||||
for (int i = 0; i < 256; i++) char_changed[i] = 1;
|
||||
}
|
||||
text_cols = x / font_width;
|
||||
text_rows = y / font_height;
|
||||
}
|
||||
|
@ -359,7 +359,8 @@ void bx_vgacore_c::register_state(bx_list_c *parent)
|
||||
new bx_shadow_num_c(list, "last_xres", &BX_VGA_THIS s.last_xres);
|
||||
new bx_shadow_num_c(list, "last_yres", &BX_VGA_THIS s.last_yres);
|
||||
new bx_shadow_num_c(list, "last_bpp", &BX_VGA_THIS s.last_bpp);
|
||||
new bx_shadow_num_c(list, "last_msl", &BX_VGA_THIS s.last_msl);
|
||||
new bx_shadow_num_c(list, "last_fw", &BX_VGA_THIS s.last_fw);
|
||||
new bx_shadow_num_c(list, "last_fh", &BX_VGA_THIS s.last_fh);
|
||||
new bx_shadow_num_c(list, "vga_override", &BX_VGA_THIS s.vga_override);
|
||||
new bx_shadow_data_c(list, "memory", BX_VGA_THIS s.memory, BX_VGA_THIS s.memsize);
|
||||
}
|
||||
@ -1304,8 +1305,8 @@ void bx_vgacore_c::set_override(bx_bool enabled, void *dev)
|
||||
bx_virt_timer.deactivate_timer(BX_VGA_THIS timer_id);
|
||||
} else {
|
||||
bx_virt_timer.activate_timer(BX_VGA_THIS timer_id, BX_VGA_THIS update_interval, 1);
|
||||
bx_gui->dimension_update(BX_VGA_THIS s.last_xres, BX_VGA_THIS s.last_yres, 8,
|
||||
BX_VGA_THIS s.last_msl+1, BX_VGA_THIS s.last_bpp);
|
||||
bx_gui->dimension_update(BX_VGA_THIS s.last_xres, BX_VGA_THIS s.last_yres,
|
||||
BX_VGA_THIS s.last_fw, BX_VGA_THIS s.last_fh, BX_VGA_THIS s.last_bpp);
|
||||
BX_VGA_THIS redraw_area(0, 0, BX_VGA_THIS s.last_xres, BX_VGA_THIS s.last_yres);
|
||||
}
|
||||
}
|
||||
@ -1705,15 +1706,18 @@ void bx_vgacore_c::update(void)
|
||||
return;
|
||||
}
|
||||
cWidth = ((BX_VGA_THIS s.sequencer.reg1 & 0x01) == 1) ? 8 : 9;
|
||||
if (BX_VGA_THIS s.x_dotclockdiv2) cWidth <<= 1;
|
||||
iWidth = cWidth * cols;
|
||||
iHeight = VDE+1;
|
||||
if ((iWidth != BX_VGA_THIS s.last_xres) || (iHeight != BX_VGA_THIS s.last_yres) || (MSL != BX_VGA_THIS s.last_msl) ||
|
||||
if ((iWidth != BX_VGA_THIS s.last_xres) || (iHeight != BX_VGA_THIS s.last_yres) ||
|
||||
(cWidth != BX_VGA_THIS s.last_fw) ||((MSL+1) != BX_VGA_THIS s.last_fh) ||
|
||||
(BX_VGA_THIS s.last_bpp > 8))
|
||||
{
|
||||
bx_gui->dimension_update(iWidth, iHeight, MSL+1, cWidth);
|
||||
BX_VGA_THIS s.last_xres = iWidth;
|
||||
BX_VGA_THIS s.last_yres = iHeight;
|
||||
BX_VGA_THIS s.last_msl = MSL;
|
||||
BX_VGA_THIS s.last_fw = cWidth;
|
||||
BX_VGA_THIS s.last_fh = MSL+1;
|
||||
BX_VGA_THIS s.last_bpp = 8;
|
||||
}
|
||||
if (skip_update()) return;
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2012 The Bochs Project
|
||||
// Copyright (C) 2001-2015 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -226,7 +226,8 @@ protected:
|
||||
Bit16u last_xres;
|
||||
Bit16u last_yres;
|
||||
Bit8u last_bpp;
|
||||
Bit8u last_msl;
|
||||
Bit8u last_fw;
|
||||
Bit8u last_fh;
|
||||
// maximum resolution and number of tiles
|
||||
Bit16u max_xres;
|
||||
Bit16u max_yres;
|
||||
|
Loading…
Reference in New Issue
Block a user