Author: aandrejevic Date: Fri Nov 8 21:56:30 2013 New Revision: 60888
URL: http://svn.reactos.org/svn/reactos?rev=60888&view=rev Log: [NTVDM] For better visibility, double the screen size if the resolution is too low.
Modified: branches/ntvdm/subsystems/ntvdm/vga.c branches/ntvdm/subsystems/ntvdm/vga.h
Modified: branches/ntvdm/subsystems/ntvdm/vga.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/vga.c?rev... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/vga.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/vga.c [iso-8859-1] Fri Nov 8 21:56:30 2013 @@ -92,6 +92,7 @@ static HANDLE GraphicsConsoleBuffer = NULL; static HANDLE ConsoleMutex = NULL; static HPALETTE PaletteHandle = NULL; +static BOOLEAN DoubleVision = FALSE;
static BYTE VgaLatchRegisters[VGA_NUM_BANKS] = {0, 0, 0, 0}; static BYTE VgaMiscRegister; @@ -439,6 +440,13 @@ BYTE BitmapInfoBuffer[VGA_BITMAP_INFO_SIZE]; LPBITMAPINFO BitmapInfo = (LPBITMAPINFO)BitmapInfoBuffer; LPWORD PaletteIndex = (LPWORD)(BitmapInfo->bmiColors); + + if ((Resolution->X < VGA_MINIMUM_WIDTH) && (Resolution->Y < VGA_MINIMUM_HEIGHT)) + { + DoubleVision = TRUE; + Resolution->X *= 2; + Resolution->Y *= 2; + }
/* Fill the bitmap info header */ ZeroMemory(&BitmapInfo->bmiHeader, sizeof(BITMAPINFOHEADER)); @@ -500,6 +508,7 @@ ConsoleMutex = NULL; CloseHandle(GraphicsConsoleBuffer); GraphicsConsoleBuffer = NULL; + DoubleVision = FALSE; }
static BOOL VgaEnterTextMode(PCOORD Resolution) @@ -738,14 +747,32 @@ PixelData = VgaAcRegisters[PixelData]; }
- /* Now check if the resulting pixel data has changed */ - if (GraphicsBuffer[i * Resolution.X + j] != PixelData) + if (DoubleVision) { - /* Yes, write the new value */ - GraphicsBuffer[i * Resolution.X + j] = PixelData; - - /* Mark the specified pixel as changed */ - VgaMarkForUpdate(i, j); + /* Now check if the resulting pixel data has changed */ + if (GraphicsBuffer[(i * Resolution.X * 4) + (j * 2)] != PixelData) + { + /* Yes, write the new value */ + GraphicsBuffer[(i * Resolution.X * 4) + (j * 2)] = PixelData; + GraphicsBuffer[(i * Resolution.X * 4) + (j * 2 + 1)] = PixelData; + GraphicsBuffer[((i * 2 + 1) * Resolution.X * 2) + (j * 2)] = PixelData; + GraphicsBuffer[((i * 2 + 1) * Resolution.X * 2) + (j * 2 + 1)] = PixelData; + + /* Mark the specified pixel as changed */ + VgaMarkForUpdate(i, j); + } + } + else + { + /* Now check if the resulting pixel data has changed */ + if (GraphicsBuffer[i * Resolution.X + j] != PixelData) + { + /* Yes, write the new value */ + GraphicsBuffer[i * Resolution.X + j] = PixelData; + + /* Mark the specified pixel as changed */ + VgaMarkForUpdate(i, j); + } } }
@@ -952,6 +979,15 @@ Resolution, Origin, &UpdateRectangle); + } + + if (DoubleVision) + { + /* Scale the update rectangle */ + UpdateRectangle.Left *= 2; + UpdateRectangle.Top *= 2; + UpdateRectangle.Right = UpdateRectangle.Right * 2 + 1; + UpdateRectangle.Bottom = UpdateRectangle.Bottom * 2 + 1; }
/* Redraw the screen */
Modified: branches/ntvdm/subsystems/ntvdm/vga.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/vga.h?rev... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/vga.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/vga.h [iso-8859-1] Fri Nov 8 21:56:30 2013 @@ -38,6 +38,8 @@ #define VGA_MAX_COLORS 256 #define VGA_PALETTE_SIZE (VGA_MAX_COLORS * 3) #define VGA_BITMAP_INFO_SIZE (sizeof(BITMAPINFOHEADER) + 2 * (VGA_PALETTE_SIZE / 3)) +#define VGA_MINIMUM_WIDTH 400 +#define VGA_MINIMUM_HEIGHT 300 #define VGA_DAC_TO_COLOR(x) (((x) << 2) | ((x) >> 6)) #define VGA_COLOR_TO_DAC(x) ((x) >> 2)