- preparing all display libraries (guis) to support graphics modes > 8bpp

(based on a patch from Christopher Nelson <paradox@BBHC.ORG>)
  * the win32 gui changes the bitmap settings using the bpp argument
  * added stubs for all guis except win32
  * descriptions of function dimension_update() updated
This commit is contained in:
Volker Ruppert 2003-06-28 08:04:31 +00:00
parent d2f0bb7651
commit 43d5bef9ed
13 changed files with 82 additions and 27 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: amigaos.cc,v 1.18 2003-05-11 15:07:53 vruppert Exp $
// $Id: amigaos.cc,v 1.19 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2000 MandrakeSoft S.A.
@ -664,9 +664,12 @@ bx_amigaos_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
void
bx_amigaos_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth)
bx_amigaos_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
{
if (bpp > 8) {
BX_PANIC(("%d bpp graphics mode not supported yet", bpp));
}
int xdiff = w - x;
if (fheight > 0) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: beos.cc,v 1.24 2003-05-11 15:07:53 vruppert Exp $
// $Id: beos.cc,v 1.25 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -435,8 +435,11 @@ bx_beos_gui_c::palette_change(unsigned index, unsigned red, unsigned green, unsi
void
bx_beos_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth)
bx_beos_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
{
if (bpp > 8) {
BX_PANIC(("%d bpp graphics mode not supported yet", bpp));
}
if (fheight > 0) {
if (fwidth != 8) {
x = x * 8 / fwidth;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: carbon.cc,v 1.19 2003-05-11 15:07:53 vruppert Exp $
// $Id: carbon.cc,v 1.20 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1284,9 +1284,15 @@ void bx_carbon_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0
//
// x: new VGA x size
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
// fheight: new VGA character height in text mode
// fwidth : new VGA character width in text mode
// bpp : bits per pixel in graphics mode
void bx_carbon_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth)
void bx_carbon_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
{
if (bpp > 8) {
BX_PANIC(("%d bpp graphics mode not supported yet", bpp));
}
if (fheight > 0) {
if (fwidth != 8) {
x = x * 8 / fwidth;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.h,v 1.39 2003-05-18 10:44:26 vruppert Exp $
// $Id: gui.h,v 1.40 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -56,7 +56,7 @@ public:
virtual void flush(void) = 0;
virtual void clear_screen(void) = 0;
virtual bx_bool palette_change(unsigned index, unsigned red, unsigned green, unsigned blue) = 0;
virtual void dimension_update(unsigned x, unsigned y, unsigned fheight=0, unsigned fwidth=0) = 0;
virtual void dimension_update(unsigned x, unsigned y, unsigned fheight=0, unsigned fwidth=0, unsigned bpp=8) = 0;
virtual unsigned create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim) = 0;
virtual unsigned headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void)) = 0;
virtual void replace_bitmap(unsigned hbar_id, unsigned bmap_id) = 0;
@ -158,7 +158,7 @@ protected:
virtual bx_bool palette_change(unsigned index, \
unsigned red, unsigned green, unsigned blue); \
virtual void dimension_update(unsigned x, unsigned y, unsigned fheight=0, \
unsigned fwidth=0); \
unsigned fwidth=0, unsigned bpp=8); \
virtual unsigned create_bitmap(const unsigned char *bmap, \
unsigned xdim, unsigned ydim); \
virtual unsigned headerbar_bitmap(unsigned bmap_id, unsigned alignment, \

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: macintosh.cc,v 1.20 2003-05-11 15:07:53 vruppert Exp $
// $Id: macintosh.cc,v 1.21 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -988,9 +988,15 @@ void bx_macintosh_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned
//
// x: new VGA x size
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
// fheight: new VGA character height in text mode
// fwidth : new VGA character width in text mode
// bpp : bits per pixel in graphics mode
void bx_macintosh_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth)
void bx_macintosh_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
{
if (bpp > 8) {
BX_PANIC(("%d bpp graphics mode not supported yet", bpp));
}
if (fheight > 0) {
if (fwidth != 8) {
x = x * 8 / fwidth;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: nogui.cc,v 1.20 2003-05-11 15:07:53 vruppert Exp $
// $Id: nogui.cc,v 1.21 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -227,14 +227,18 @@ bx_nogui_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
//
// x: new VGA x size
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
// fheight: new VGA character height in text mode
// fwidth : new VGA character width in text mode
// bpp : bits per pixel in graphics mode
void
bx_nogui_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth)
bx_nogui_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
{
UNUSED(x);
UNUSED(y);
UNUSED(fheight);
UNUSED(fwidth);
UNUSED(bpp);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: rfb.cc,v 1.23 2003-06-04 20:35:28 vruppert Exp $
// $Id: rfb.cc,v 1.24 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2000 Psyon.Org!
@ -640,10 +640,16 @@ void bx_rfb_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
//
// x: new VGA x size
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
// fheight: new VGA character height in text mode
// fwidth : new VGA character width in text mode
// bpp : bits per pixel in graphics mode
void
bx_rfb_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth)
bx_rfb_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
{
if (bpp > 8) {
BX_PANIC(("%d bpp graphics mode not supported yet", bpp));
}
if (fheight > 0) {
text_cols = x / fwidth;
text_rows = y / fheight;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sdl.cc,v 1.40 2003-06-15 15:10:45 vruppert Exp $
// $Id: sdl.cc,v 1.41 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -893,8 +893,12 @@ void bx_sdl_gui_c::dimension_update(
unsigned x,
unsigned y,
unsigned fheight,
unsigned fwidth)
unsigned fwidth,
unsigned bpp)
{
if (bpp > 8) {
BX_PANIC(("%d bpp graphics mode not supported yet", bpp));
}
if( fheight > 0 )
{
fontheight = fheight;

View File

@ -394,13 +394,17 @@ void bx_svga_gui_c::dimension_update(
unsigned x,
unsigned y,
unsigned fheight,
unsigned fwidth)
unsigned fwidth,
unsigned bpp)
{
int newmode;
// TODO: remove this stupid check whenever the vga driver is fixed
if( y == 208 ) y = 200;
if (bpp > 8) {
BX_PANIC(("%d bpp graphics mode not supported yet", bpp));
}
if( fheight > 0 )
{
fontheight = fheight;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: term.cc,v 1.29 2003-05-18 11:26:02 vruppert Exp $
// $Id: term.cc,v 1.30 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2000 MandrakeSoft S.A.
@ -705,10 +705,16 @@ bx_term_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
//
// x: new VGA x size
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
// fheight: new VGA character height in text mode
// fwidth : new VGA character width in text mode
// bpp : bits per pixel in graphics mode
void
bx_term_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth)
bx_term_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
{
if (bpp > 8) {
BX_PANIC(("%d bpp graphics mode not supported", bpp));
}
if (fheight > 0) {
text_cols = x / fwidth;
text_rows = y / fheight;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.60 2003-06-22 12:37:03 vruppert Exp $
// $Id: win32.cc,v 1.61 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -433,7 +433,7 @@ void bx_win32_gui_c::specific_init(int argc, char **argv, unsigned
bitmap_info->bmiHeader.biPlanes=1;
bitmap_info->bmiHeader.biBitCount=8;
bitmap_info->bmiHeader.biCompression=BI_RGB;
bitmap_info->bmiHeader.biSizeImage=x_tilesize*y_tilesize;
bitmap_info->bmiHeader.biSizeImage=x_tilesize*y_tilesize*4;
// I think these next two figures don't matter; saying 45 pixels/centimeter
bitmap_info->bmiHeader.biXPelsPerMeter=4500;
bitmap_info->bmiHeader.biYPelsPerMeter=4500;
@ -1238,8 +1238,9 @@ void bx_win32_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
// fheight: new VGA character height in text mode
// fwidth : new VGA character width in text mode
// bpp : bits per pixel in graphics mode
void bx_win32_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth)
void bx_win32_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
{
if (fheight > 0) {
text_cols = x / fwidth;
@ -1282,12 +1283,17 @@ void bx_win32_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight,
stretched_x *= 2;
stretch_factor *= 2;
}
bitmap_info->bmiHeader.biBitCount = bpp;
SetWindowPos(stInfo.mainWnd, HWND_TOP, 0, 0, stretched_x + x_edge * 2,
stretched_y + bx_headerbar_y + y_edge * 2 + y_caption,
SWP_NOMOVE | SWP_NOZORDER);
MoveWindow(hwndTB, 0, 0, stretched_x, bx_headerbar_y, TRUE);
MoveWindow(stInfo.simWnd, 0, bx_headerbar_y, stretched_x, stretched_y, TRUE);
BX_INFO (("dimension update x=%d y=%d fontheight=%d fontwidth=%d bpp=%d", x, y, fheight, fwidth, bpp));
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wx.cc,v 1.60 2003-06-15 10:37:56 vruppert Exp $
// $Id: wx.cc,v 1.61 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////
//
// wxWindows VGA display for Bochs. wx.cc implements a custom
@ -1161,13 +1161,17 @@ void bx_wx_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
// y: new VGA y size
// fheight: new VGA character height in text mode
// fwidth : new VGA character width in text mode
// bpp : bits per pixel in graphics mode
void bx_wx_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth)
void bx_wx_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
{
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::dimension_update trying to get lock. wxScreen=%p", wxScreen)));
wxScreen_lock.Enter ();
IFDBG_VGA(wxLogDebug (wxT ("MyPanel::dimension_update got lock. wxScreen=%p", wxScreen)));
BX_INFO (("dimension update x=%d y=%d fontheight=%d fontwidth=%d", x, y, fheight, fwidth));
if (bpp > 8) {
BX_PANIC(("%d bpp graphics mode not supported yet", bpp));
}
if (fheight > 0) {
wxFontX = fwidth;
wxFontY = fheight;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: x.cc,v 1.71 2003-06-15 19:20:06 vruppert Exp $
// $Id: x.cc,v 1.72 2003-06-28 08:04:31 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1373,8 +1373,11 @@ bx_x_gui_c::palette_change(unsigned index, unsigned red, unsigned green, unsigne
void
bx_x_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth)
bx_x_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
{
if (bpp > 8) {
BX_PANIC(("%d bpp graphics mode not supported yet", bpp));
}
if (fheight > 0) {
font_height = fheight;
font_width = fwidth;