mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:03:00 +00:00
Indentation corrected, minor fixes
svn path=/trunk/; revision=1754
This commit is contained in:
parent
14c634ca97
commit
389375c4ee
10 changed files with 837 additions and 743 deletions
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* entry.c
|
* entry.c
|
||||||
*
|
*
|
||||||
* $Revision: 1.10 $
|
* $Revision: 1.11 $
|
||||||
* $Author: jfilby $
|
* $Author: jfilby $
|
||||||
* $Date: 2000/11/16 21:45:54 $
|
* $Date: 2001/03/31 15:40:33 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -164,11 +164,10 @@ DHPDEV VGADDIEnablePDEV(IN DEVMODEW *DM,
|
||||||
|
|
||||||
PDev = EngAllocMem(FL_ZERO_MEMORY, sizeof(PDEV), ALLOC_TAG);
|
PDev = EngAllocMem(FL_ZERO_MEMORY, sizeof(PDEV), ALLOC_TAG);
|
||||||
if (PDev == NULL)
|
if (PDev == NULL)
|
||||||
{
|
{
|
||||||
EngDebugPrint(DBG_PREFIX, "EngAllocMem failed for PDEV\n", 0);
|
EngDebugPrint(DBG_PREFIX, "EngAllocMem failed for PDEV\n", 0);
|
||||||
|
return NULL;
|
||||||
return NULL;
|
}
|
||||||
}
|
|
||||||
PDev->KMDriver = Driver;
|
PDev->KMDriver = Driver;
|
||||||
DPRINT( "PDev: %x, Driver: %x\n", PDev, PDev->KMDriver );
|
DPRINT( "PDev: %x, Driver: %x\n", PDev, PDev->KMDriver );
|
||||||
PDev->xyCursor.x = 320;
|
PDev->xyCursor.x = 320;
|
||||||
|
@ -180,8 +179,7 @@ DHPDEV VGADDIEnablePDEV(IN DEVMODEW *DM,
|
||||||
// FIXME: fill out DevCaps
|
// FIXME: fill out DevCaps
|
||||||
// FIXME: full out DevInfo
|
// FIXME: full out DevInfo
|
||||||
|
|
||||||
devinfoVGA.hpalDefault = EngCreatePalette(PAL_INDEXED, 16,
|
devinfoVGA.hpalDefault = EngCreatePalette(PAL_INDEXED, 16, (PULONG)(VGApalette.PaletteEntry), 0, 0, 0);
|
||||||
(PULONG)(VGApalette.PaletteEntry), 0, 0, 0);
|
|
||||||
|
|
||||||
*DI = devinfoVGA;
|
*DI = devinfoVGA;
|
||||||
|
|
||||||
|
@ -211,27 +209,21 @@ VOID VGADDIAssertMode(IN DHPDEV DPev,
|
||||||
// Reenable our graphics mode
|
// Reenable our graphics mode
|
||||||
|
|
||||||
if (!InitPointer(ppdev))
|
if (!InitPointer(ppdev))
|
||||||
{
|
{
|
||||||
// Failed to set pointer
|
// Failed to set pointer
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitVGA(ppdev, FALSE))
|
if (!InitVGA(ppdev, FALSE))
|
||||||
{
|
{
|
||||||
// Failed to initialize the VGA
|
// Failed to initialize the VGA
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Go back to last known mode
|
// Go back to last known mode
|
||||||
DPRINT( "ppdev: %x, KMDriver: %x", ppdev, ppdev->KMDriver );
|
DPRINT( "ppdev: %x, KMDriver: %x", ppdev, ppdev->KMDriver );
|
||||||
if (EngDeviceIoControl(ppdev->KMDriver,
|
if (EngDeviceIoControl(ppdev->KMDriver, IOCTL_VIDEO_RESET_DEVICE, NULL, 0, NULL, 0, &returnedDataLength))
|
||||||
IOCTL_VIDEO_RESET_DEVICE,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
&returnedDataLength))
|
|
||||||
{
|
{
|
||||||
// Failed to go back to mode
|
// Failed to go back to mode
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -253,7 +245,7 @@ VOID VGADDIDisablePDEV(IN DHPDEV PDev)
|
||||||
if (ppdev->pucDIB4ToVGAConvBuffer != NULL)
|
if (ppdev->pucDIB4ToVGAConvBuffer != NULL)
|
||||||
{
|
{
|
||||||
EngFreeMem(ppdev->pucDIB4ToVGAConvBuffer);
|
EngFreeMem(ppdev->pucDIB4ToVGAConvBuffer);
|
||||||
}
|
}
|
||||||
DPRINT( "Freeing PDEV\n" );
|
DPRINT( "Freeing PDEV\n" );
|
||||||
EngFreeMem(PDev);
|
EngFreeMem(PDev);
|
||||||
}
|
}
|
||||||
|
@ -269,11 +261,11 @@ VOID VGADDIDisableSurface(IN DHPDEV PDev)
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
if (pdsurf->BankInfo != NULL) {
|
if (pdsurf->BankInfo != NULL) {
|
||||||
EngFreeMem(pdsurf->BankInfo);
|
EngFreeMem(pdsurf->BankInfo);
|
||||||
}
|
}
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
if (pdsurf->BankInfo2RW != NULL) {
|
if (pdsurf->BankInfo2RW != NULL) {
|
||||||
EngFreeMem(pdsurf->BankInfo2RW);
|
EngFreeMem(pdsurf->BankInfo2RW);
|
||||||
}
|
}
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
if (pdsurf->BankBufferPlane0 != NULL) {
|
if (pdsurf->BankBufferPlane0 != NULL) {
|
||||||
EngFreeMem(pdsurf->BankBufferPlane0);
|
EngFreeMem(pdsurf->BankBufferPlane0);
|
||||||
|
@ -281,7 +273,7 @@ VOID VGADDIDisableSurface(IN DHPDEV PDev)
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
if (ppdev->pPointerAttributes != NULL) {
|
if (ppdev->pPointerAttributes != NULL) {
|
||||||
EngFreeMem(ppdev->pPointerAttributes);
|
EngFreeMem(ppdev->pPointerAttributes);
|
||||||
}
|
}
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
// free any pending saved screen bit blocks
|
// free any pending saved screen bit blocks
|
||||||
pSSB = pdsurf->ssbList;
|
pSSB = pdsurf->ssbList;
|
||||||
|
|
|
@ -1,65 +1,65 @@
|
||||||
#include "../vgaddi.h"
|
#include "../vgaddi.h"
|
||||||
|
|
||||||
GDIINFO gaulCap = {
|
GDIINFO gaulCap = {
|
||||||
GDI_DRIVER_VERSION,
|
GDI_DRIVER_VERSION,
|
||||||
DT_RASDISPLAY, // ulTechnology
|
DT_RASDISPLAY, // ulTechnology
|
||||||
0, // ulHorzSize
|
0, // ulHorzSize
|
||||||
0, // ulVertSize
|
0, // ulVertSize
|
||||||
0, // ulHorzRes (filled in at initialization)
|
0, // ulHorzRes (filled in at initialization)
|
||||||
0, // ulVertRes (filled in at initialization)
|
0, // ulVertRes (filled in at initialization)
|
||||||
4, // cBitsPixel
|
4, // cBitsPixel
|
||||||
1, // cPlanes
|
1, // cPlanes
|
||||||
16, // ulNumColors
|
16, // ulNumColors
|
||||||
0, // flRaster (DDI reserved field)
|
0, // flRaster (DDI reserved field)
|
||||||
|
|
||||||
0, // ulLogPixelsX (filled in at initialization)
|
0, // ulLogPixelsX (filled in at initialization)
|
||||||
0, // ulLogPixelsY (filled in at initialization)
|
0, // ulLogPixelsY (filled in at initialization)
|
||||||
|
|
||||||
TC_RA_ABLE | TC_SCROLLBLT, // flTextCaps
|
TC_RA_ABLE | TC_SCROLLBLT, // flTextCaps
|
||||||
|
|
||||||
6, // ulDACRed
|
6, // ulDACRed
|
||||||
6, // ulDACGree
|
6, // ulDACGree
|
||||||
6, // ulDACBlue
|
6, // ulDACBlue
|
||||||
|
|
||||||
0x0024, // ulAspectX (one-to-one aspect ratio)
|
0x0024, // ulAspectX (one-to-one aspect ratio)
|
||||||
0x0024, // ulAspectY
|
0x0024, // ulAspectY
|
||||||
0x0033, // ulAspectXY
|
0x0033, // ulAspectXY
|
||||||
|
|
||||||
1, // xStyleStep
|
1, // xStyleStep
|
||||||
1, // yStyleSte;
|
1, // yStyleSte;
|
||||||
3, // denStyleStep
|
3, // denStyleStep
|
||||||
|
|
||||||
{ 0, 0 }, // ptlPhysOffset
|
{ 0, 0 }, // ptlPhysOffset
|
||||||
{ 0, 0 }, // szlPhysSize
|
{ 0, 0 }, // szlPhysSize
|
||||||
|
|
||||||
0, // ulNumPalReg (win3.1 16 color drivers say 0 too)
|
0, // ulNumPalReg (win3.1 16 color drivers say 0 too)
|
||||||
|
|
||||||
// These fields are for halftone initialization.
|
// These fields are for halftone initialization.
|
||||||
|
|
||||||
{ // ciDevice, ColorInfo
|
{ // ciDevice, ColorInfo
|
||||||
{ 6700, 3300, 0 }, // Red
|
{ 6700, 3300, 0 }, // Red
|
||||||
{ 2100, 7100, 0 }, // Green
|
{ 2100, 7100, 0 }, // Green
|
||||||
{ 1400, 800, 0 }, // Blue
|
{ 1400, 800, 0 }, // Blue
|
||||||
{ 1750, 3950, 0 }, // Cyan
|
{ 1750, 3950, 0 }, // Cyan
|
||||||
{ 4050, 2050, 0 }, // Magenta
|
{ 4050, 2050, 0 }, // Magenta
|
||||||
{ 4400, 5200, 0 }, // Yellow
|
{ 4400, 5200, 0 }, // Yellow
|
||||||
{ 3127, 3290, 0 }, // AlignmentWhite
|
{ 3127, 3290, 0 }, // AlignmentWhite
|
||||||
20000, // RedGamma
|
20000, // RedGamma
|
||||||
20000, // GreenGamma
|
20000, // GreenGamma
|
||||||
20000, // BlueGamma
|
20000, // BlueGamma
|
||||||
0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0
|
||||||
},
|
},
|
||||||
|
|
||||||
0, // ulDevicePelsDPI
|
0, // ulDevicePelsDPI
|
||||||
PRIMARY_ORDER_CBA, // ulPrimaryOrder
|
PRIMARY_ORDER_CBA, // ulPrimaryOrder
|
||||||
HT_PATSIZE_4x4_M, // ulHTPatternSize
|
HT_PATSIZE_4x4_M, // ulHTPatternSize
|
||||||
HT_FORMAT_4BPP_IRGB, // ulHTOutputFormat
|
HT_FORMAT_4BPP_IRGB, // ulHTOutputFormat
|
||||||
HT_FLAG_ADDITIVE_PRIMS, // flHTFlags
|
HT_FLAG_ADDITIVE_PRIMS, // flHTFlags
|
||||||
|
|
||||||
0, // ulVRefresh
|
0, // ulVRefresh
|
||||||
8, // ulBltAlignment
|
8, // ulBltAlignment
|
||||||
0, // ulPanningHorzRes
|
0, // ulPanningHorzRes
|
||||||
0, // ulPanningVertRes
|
0, // ulPanningVertRes
|
||||||
};
|
};
|
||||||
|
|
||||||
// Palette for VGA
|
// Palette for VGA
|
||||||
|
@ -77,23 +77,23 @@ const VGALOGPALETTE VGApalette =
|
||||||
0x400, // driver version
|
0x400, // driver version
|
||||||
16, // num entries
|
16, // num entries
|
||||||
{
|
{
|
||||||
{ 0, 0, 0, 0 }, // 0
|
{ 0, 0, 0, 0 }, // 0
|
||||||
{ 0x80,0, 0, 0 }, // 1
|
{ 0x80,0, 0, 0 }, // 1
|
||||||
{ 0, 0x80,0, 0 }, // 2
|
{ 0, 0x80,0, 0 }, // 2
|
||||||
{ 0x80,0x80,0, 0 }, // 3
|
{ 0x80,0x80,0, 0 }, // 3
|
||||||
{ 0, 0, 0x80,0 }, // 4
|
{ 0, 0, 0x80,0 }, // 4
|
||||||
{ 0x80,0, 0x80,0 }, // 5
|
{ 0x80,0, 0x80,0 }, // 5
|
||||||
{ 0, 0x80,0x80,0 }, // 6
|
{ 0, 0x80,0x80,0 }, // 6
|
||||||
{ 0x80,0x80,0x80,0 }, // 7
|
{ 0x80,0x80,0x80,0 }, // 7
|
||||||
|
|
||||||
{ 0xC0,0xC0,0xC0,0 }, // 8
|
{ 0xC0,0xC0,0xC0,0 }, // 8
|
||||||
{ 0xFF,0, 0, 0 }, // 9
|
{ 0xFF,0, 0, 0 }, // 9
|
||||||
{ 0, 0xFF,0, 0 }, // 10
|
{ 0, 0xFF,0, 0 }, // 10
|
||||||
{ 0xFF,0xFF,0, 0 }, // 11
|
{ 0xFF,0xFF,0, 0 }, // 11
|
||||||
{ 0, 0, 0xFF,0 }, // 12
|
{ 0, 0, 0xFF,0 }, // 12
|
||||||
{ 0xFF,0, 0xFF,0 }, // 13
|
{ 0xFF,0, 0xFF,0 }, // 13
|
||||||
{ 0, 0xFF,0xFF,0 }, // 14
|
{ 0, 0xFF,0xFF,0 }, // 14
|
||||||
{ 0xFF,0xFF,0xFF,0 } // 15
|
{ 0xFF,0xFF,0xFF,0 } // 15
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,16 +108,16 @@ const VGALOGPALETTE VGApalette =
|
||||||
|
|
||||||
DEVINFO devinfoVGA =
|
DEVINFO devinfoVGA =
|
||||||
{
|
{
|
||||||
(GCAPS_OPAQUERECT | GCAPS_HORIZSTRIKE | GCAPS_ALTERNATEFILL | GCAPS_MONO_DITHER | GCAPS_COLOR_DITHER |
|
(GCAPS_OPAQUERECT | GCAPS_HORIZSTRIKE | GCAPS_ALTERNATEFILL | GCAPS_MONO_DITHER | GCAPS_COLOR_DITHER |
|
||||||
GCAPS_WINDINGFILL | GCAPS_DITHERONREALIZE
|
GCAPS_WINDINGFILL | GCAPS_DITHERONREALIZE
|
||||||
), // Graphics capabilities
|
), // Graphics capabilities
|
||||||
|
|
||||||
SYSTM_LOGFONT, // Default font description
|
SYSTM_LOGFONT, // Default font description
|
||||||
HELVE_LOGFONT, // ANSI variable font description
|
HELVE_LOGFONT, // ANSI variable font description
|
||||||
COURI_LOGFONT, // ANSI fixed font description
|
COURI_LOGFONT, // ANSI fixed font description
|
||||||
0, // Count of device fonts
|
0, // Count of device fonts
|
||||||
BMF_4BPP, // preferred DIB format
|
BMF_4BPP, // preferred DIB format
|
||||||
8, // Width of color dither
|
8, // Width of color dither
|
||||||
8, // Height of color dither
|
8, // Height of color dither
|
||||||
0 // Default palette to use for this device
|
0 // Default palette to use for this device
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,16 +14,15 @@
|
||||||
typedef BOOL (*PFN_VGABlt)(SURFOBJ *, SURFOBJ *, SURFOBJ *, XLATEOBJ *,
|
typedef BOOL (*PFN_VGABlt)(SURFOBJ *, SURFOBJ *, SURFOBJ *, XLATEOBJ *,
|
||||||
RECTL *, POINTL *);
|
RECTL *, POINTL *);
|
||||||
|
|
||||||
BOOL GDItoVGA(
|
BOOL DIBtoVGA(
|
||||||
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
||||||
RECTL *DestRect, POINTL *SourcePoint)
|
RECTL *DestRect, POINTL *SourcePoint)
|
||||||
{
|
{
|
||||||
LONG i, j, dx, dy, alterx, altery, idxColor, RGBulong = 0, BPP;
|
LONG i, j, dx, dy, alterx, altery, idxColor, RGBulong = 0;
|
||||||
BYTE *GDIpos, *initial;
|
BYTE *GDIpos, *initial;
|
||||||
|
|
||||||
BPP = bytesPerPixel(Source->iBitmapFormat);
|
GDIpos = Source->pvBits /* +
|
||||||
GDIpos = Source->pvBits +
|
SourcePoint->y * Source->lDelta + (SourcePoint->x >> 1) */ ;
|
||||||
SourcePoint->y * Source->lDelta + SourcePoint->x;
|
|
||||||
|
|
||||||
dx = DestRect->right - DestRect->left;
|
dx = DestRect->right - DestRect->left;
|
||||||
dy = DestRect->bottom - DestRect->top;
|
dy = DestRect->bottom - DestRect->top;
|
||||||
|
@ -31,12 +30,16 @@ BOOL GDItoVGA(
|
||||||
alterx = abs(SourcePoint->x - DestRect->left);
|
alterx = abs(SourcePoint->x - DestRect->left);
|
||||||
altery = abs(SourcePoint->y - DestRect->top);
|
altery = abs(SourcePoint->y - DestRect->top);
|
||||||
|
|
||||||
|
// FIXME: ColorTranslation will never be null. We must always map the colors (see PCGPE's bmp.txt)
|
||||||
|
|
||||||
if(ColorTranslation == NULL)
|
if(ColorTranslation == NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
// No color translation necessary, we assume BPP = 1
|
// No color translation necessary, we assume BPP = 1
|
||||||
BltToVGA(DestRect->left, DestRect->top, dx, dy, Source->pvBits, Source->lDelta);
|
DIB_BltToVGA(DestRect->left, DestRect->top, dx, dy, Source->pvBits, Source->lDelta);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Perform color translation
|
// Perform color translation
|
||||||
for(j=SourcePoint->y; j<SourcePoint->y+dy; j++)
|
for(j=SourcePoint->y; j<SourcePoint->y+dy; j++)
|
||||||
{
|
{
|
||||||
|
@ -46,19 +49,18 @@ BOOL GDItoVGA(
|
||||||
{
|
{
|
||||||
idxColor = XLATEOBJ_iXlate(ColorTranslation, *GDIpos);
|
idxColor = XLATEOBJ_iXlate(ColorTranslation, *GDIpos);
|
||||||
vgaPutPixel(i+alterx, j+altery, idxColor);
|
vgaPutPixel(i+alterx, j+altery, idxColor);
|
||||||
GDIpos+=BPP;
|
GDIpos+=1;
|
||||||
}
|
}
|
||||||
GDIpos = initial + Source->lDelta;
|
GDIpos = initial + Source->lDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DPRINT("GDItoVGA: Done\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL VGAtoGDI(
|
BOOL VGAtoDIB(
|
||||||
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
||||||
RECTL *DestRect, POINTL *SourcePoint)
|
RECTL *DestRect, POINTL *SourcePoint)
|
||||||
{
|
{
|
||||||
LONG i, j, dx, dy, RGBulong, BPP;
|
LONG i, j, dx, dy, RGBulong;
|
||||||
BYTE *GDIpos, *initial, idxColor;
|
BYTE *GDIpos, *initial, idxColor;
|
||||||
|
|
||||||
// Used by the temporary DFB
|
// Used by the temporary DFB
|
||||||
|
@ -71,8 +73,7 @@ BOOL VGAtoGDI(
|
||||||
|
|
||||||
// FIXME: Optimize to retrieve entire bytes at a time (see /display/vgavideo/vgavideo.c:vgaGetByte)
|
// FIXME: Optimize to retrieve entire bytes at a time (see /display/vgavideo/vgavideo.c:vgaGetByte)
|
||||||
|
|
||||||
BPP = bytesPerPixel(Dest->iBitmapFormat);
|
GDIpos = Dest->pvBits /* + (DestRect->top * Dest->lDelta) + (DestRect->left >> 1) */ ;
|
||||||
GDIpos = Dest->pvBits + (DestRect->top * Dest->lDelta) + (DestRect->left * BPP);
|
|
||||||
dx = DestRect->right - DestRect->left;
|
dx = DestRect->right - DestRect->left;
|
||||||
dy = DestRect->bottom - DestRect->top;
|
dy = DestRect->bottom - DestRect->top;
|
||||||
|
|
||||||
|
@ -81,7 +82,8 @@ BOOL VGAtoGDI(
|
||||||
// Prepare a Dest Dev Target and copy from the DFB to the DIB
|
// Prepare a Dest Dev Target and copy from the DFB to the DIB
|
||||||
DestDevSurf.NextScan = Dest->lDelta;
|
DestDevSurf.NextScan = Dest->lDelta;
|
||||||
DestDevSurf.StartBmp = Dest->pvScan0;
|
DestDevSurf.StartBmp = Dest->pvScan0;
|
||||||
BltFromVGA(SourcePoint->x, SourcePoint->y, dx, dy, Dest->pvBits, Dest->lDelta);
|
|
||||||
|
DIB_BltFromVGA(SourcePoint->x, SourcePoint->y, dx, dy, Dest->pvBits, Dest->lDelta);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Color translation
|
// Color translation
|
||||||
|
@ -91,12 +93,11 @@ BOOL VGAtoGDI(
|
||||||
for(i=SourcePoint->x; i<SourcePoint->x+dx; i++)
|
for(i=SourcePoint->x; i<SourcePoint->x+dx; i++)
|
||||||
{
|
{
|
||||||
*GDIpos = XLATEOBJ_iXlate(ColorTranslation, vgaGetPixel(i, j));
|
*GDIpos = XLATEOBJ_iXlate(ColorTranslation, vgaGetPixel(i, j));
|
||||||
GDIpos+=BPP;
|
GDIpos+=1;
|
||||||
}
|
}
|
||||||
GDIpos = initial + Dest->lDelta;
|
GDIpos = initial + Dest->lDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DPRINT("VGAtoGDI: Done\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL DFBtoVGA(
|
BOOL DFBtoVGA(
|
||||||
|
@ -186,13 +187,13 @@ DPRINT("VGADDIBitBlt: Dest->pvScan0: %08x\n", Dest->pvScan0);
|
||||||
|
|
||||||
if((Source->iType == STYPE_BITMAP) && (Dest->iType == STYPE_DEVICE))
|
if((Source->iType == STYPE_BITMAP) && (Dest->iType == STYPE_DEVICE))
|
||||||
{
|
{
|
||||||
DPRINT("GDI2VGA\n");
|
DPRINT("DIB2VGA\n");
|
||||||
BltOperation = GDItoVGA;
|
BltOperation = DIBtoVGA;
|
||||||
} else
|
} else
|
||||||
if((Source->iType == STYPE_DEVICE) && (Dest->iType == STYPE_BITMAP))
|
if((Source->iType == STYPE_DEVICE) && (Dest->iType == STYPE_BITMAP))
|
||||||
{
|
{
|
||||||
DPRINT("VGA2GDI\n");
|
DPRINT("VGA2DIB\n");
|
||||||
BltOperation = VGAtoGDI;
|
BltOperation = VGAtoDIB;
|
||||||
} else
|
} else
|
||||||
if((Source->iType == STYPE_DEVICE) && (Dest->iType == STYPE_DEVICE))
|
if((Source->iType == STYPE_DEVICE) && (Dest->iType == STYPE_DEVICE))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
typedef struct _BRUSHINST
|
typedef struct _BRUSHINST
|
||||||
{
|
{
|
||||||
// We need to removed ajC0-3 when color pattern code is complete!!!
|
// We need to removed ajC0-3 when color pattern code is complete!!!
|
||||||
//
|
//
|
||||||
BYTE ajC0[8]; // Color bits for plane 0
|
BYTE ajC0[8]; // Color bits for plane 0
|
||||||
BYTE ajC1[8]; // Color bits for plane 1
|
BYTE ajC1[8]; // Color bits for plane 1
|
||||||
BYTE ajC2[8]; // Color bits for plane 2
|
BYTE ajC2[8]; // Color bits for plane 2
|
||||||
BYTE ajC3[8]; // Color bits for plane 3
|
BYTE ajC3[8]; // Color bits for plane 3
|
||||||
|
|
||||||
BYTE ajPattern[32]; // Color bits for the mask
|
BYTE ajPattern[32]; // Color bits for the mask
|
||||||
USHORT usStyle; // Brush style
|
USHORT usStyle; // Brush style
|
||||||
BYTE fjAccel; // Accelerator flags
|
BYTE fjAccel; // Accelerator flags
|
||||||
BYTE jFgColor; // Current foreground color
|
BYTE jFgColor; // Current foreground color
|
||||||
BYTE jBkColor; // Current background color
|
BYTE jBkColor; // Current background color
|
||||||
BYTE RealWidth; //
|
BYTE RealWidth; //
|
||||||
BYTE YShiftValue; //
|
BYTE YShiftValue; //
|
||||||
BYTE jOldBrushRealized; //
|
BYTE jOldBrushRealized; //
|
||||||
DWORD Width; // Width of brush
|
DWORD Width; // Width of brush
|
||||||
DWORD Height;
|
DWORD Height;
|
||||||
BYTE *pPattern; //Pointer to realized mono pattern
|
BYTE *pPattern; //Pointer to realized mono pattern
|
||||||
} BRUSHINST;
|
} BRUSHINST;
|
||||||
|
|
||||||
#define BRI_SOLID 0
|
#define BRI_SOLID 0
|
||||||
|
|
|
@ -15,8 +15,6 @@ BOOL VGADDILineTo(SURFOBJ *Surface, CLIPOBJ *Clip, BRUSHOBJ *Brush,
|
||||||
LONG deltax, deltay;
|
LONG deltax, deltay;
|
||||||
|
|
||||||
iSolidColor = Brush->iSolidColor; // FIXME: Brush Realization...
|
iSolidColor = Brush->iSolidColor; // FIXME: Brush Realization...
|
||||||
DbgPrint("Drawing with color %08x ", iSolidColor);
|
|
||||||
DbgPrint("%u.%u to %u.%u\n", x1, y1, x2, y2);
|
|
||||||
|
|
||||||
// FIXME: Implement clipping
|
// FIXME: Implement clipping
|
||||||
|
|
||||||
|
|
|
@ -5,63 +5,63 @@
|
||||||
|
|
||||||
BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor)
|
BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor)
|
||||||
{
|
{
|
||||||
int x = Dimensions.left;
|
int x = Dimensions.left;
|
||||||
int y = Dimensions.top;
|
int y = Dimensions.top;
|
||||||
int w = Dimensions.right - Dimensions.left;
|
int w = Dimensions.right - Dimensions.left;
|
||||||
int h = Dimensions.bottom - Dimensions.top;
|
int h = Dimensions.bottom - Dimensions.top;
|
||||||
unsigned char *vp, *vpX;
|
unsigned char *vp, *vpX;
|
||||||
volatile unsigned char dummy;
|
volatile unsigned char dummy;
|
||||||
int byte_per_line;
|
int byte_per_line;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ASSIGNVP4(x, y, vpX)
|
ASSIGNVP4(x, y, vpX)
|
||||||
get_masks(x, w);
|
get_masks(x, w);
|
||||||
byte_per_line = SCREEN_X >> 3;
|
byte_per_line = SCREEN_X >> 3;
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); /* write mode 2 */
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); /* write mode 2 */
|
||||||
saved_GC_mode = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
saved_GC_mode = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x02);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x02);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03); /* replace */
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03); /* replace */
|
||||||
saved_GC_fun = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
saved_GC_fun = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x00);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x00);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x08); /* bit mask */
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x08); /* bit mask */
|
||||||
saved_GC_mask = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
saved_GC_mask = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
||||||
if (leftMask) {
|
if (leftMask) {
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, leftMask); /* bit mask */
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, leftMask); /* bit mask */
|
||||||
/* write to video */
|
/* write to video */
|
||||||
vp = vpX;
|
vp = vpX;
|
||||||
for (i=h; i>0; i--) {
|
for (i=h; i>0; i--) {
|
||||||
dummy = *vp; *vp = iColor;
|
dummy = *vp; *vp = iColor;
|
||||||
vp += byte_per_line;
|
vp += byte_per_line;
|
||||||
}
|
}
|
||||||
vpX++;
|
vpX++;
|
||||||
}
|
}
|
||||||
if (byteCounter) {
|
if (byteCounter) {
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0xff); /* bit mask */
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0xff); /* bit mask */
|
||||||
/* write to video */
|
/* write to video */
|
||||||
vp = vpX;
|
vp = vpX;
|
||||||
for (i=h; i>0; i--) {
|
for (i=h; i>0; i--) {
|
||||||
memset(vp, iColor, byteCounter);
|
memset(vp, iColor, byteCounter);
|
||||||
vp += byte_per_line;
|
vp += byte_per_line;
|
||||||
}
|
}
|
||||||
vpX += byteCounter;
|
vpX += byteCounter;
|
||||||
}
|
}
|
||||||
if (rightMask) {
|
if (rightMask) {
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, rightMask); /* bit mask */
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, rightMask); /* bit mask */
|
||||||
/* write to video */
|
/* write to video */
|
||||||
vp = vpX;
|
vp = vpX;
|
||||||
for (i=h; i>0; i--) {
|
for (i=h; i>0; i--) {
|
||||||
dummy = *vp; *vp = iColor;
|
dummy = *vp; *vp = iColor;
|
||||||
vp += byte_per_line;
|
vp += byte_per_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* reset GC register */
|
/* reset GC register */
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mask);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mask);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_fun);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_fun);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mode);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mode);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL VGADDIPaintRgn(SURFOBJ *Surface, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
|
BOOL VGADDIPaintRgn(SURFOBJ *Surface, CLIPOBJ *ClipRegion, ULONG iColor, MIX Mix,
|
||||||
|
@ -146,7 +146,7 @@ BOOL VGADDIPaint(IN SURFOBJ *Surface, IN CLIPOBJ *ClipRegion,
|
||||||
case R2_WHITE:
|
case R2_WHITE:
|
||||||
case R2_BLACK:
|
case R2_BLACK:
|
||||||
|
|
||||||
// FIXME: The Paint region belongs HERE
|
// FIXME: The Paint region belongs HERE
|
||||||
|
|
||||||
case R2_NOP:
|
case R2_NOP:
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
|
|
@ -8,114 +8,114 @@ void vgaShowCursor(PPDEV ppdev);
|
||||||
|
|
||||||
BOOL InitPointer(PPDEV ppdev)
|
BOOL InitPointer(PPDEV ppdev)
|
||||||
{
|
{
|
||||||
ULONG CursorWidth = 16, CursorHeight = 16;
|
ULONG CursorWidth = 16, CursorHeight = 16;
|
||||||
|
|
||||||
// Determine the size of the pointer attributes
|
// Determine the size of the pointer attributes
|
||||||
ppdev->PointerAttributes = sizeof(VIDEO_POINTER_ATTRIBUTES) +
|
ppdev->PointerAttributes = sizeof(VIDEO_POINTER_ATTRIBUTES) +
|
||||||
(CursorWidth * CursorHeight) * 2; // space for two cursors (data and mask); we assume 4bpp.. but use 8bpp for speed
|
(CursorWidth * CursorHeight) * 2; // space for two cursors (data and mask); we assume 4bpp.. but use 8bpp for speed
|
||||||
|
|
||||||
// Allocate memory for pointer attributes
|
// Allocate memory for pointer attributes
|
||||||
ppdev->pPointerAttributes = EngAllocMem(0, ppdev->PointerAttributes, ALLOC_TAG);
|
ppdev->pPointerAttributes = EngAllocMem(0, ppdev->PointerAttributes, ALLOC_TAG);
|
||||||
|
|
||||||
ppdev->pPointerAttributes->Flags = 0; // FIXME: Do this right
|
ppdev->pPointerAttributes->Flags = 0; // FIXME: Do this right
|
||||||
ppdev->pPointerAttributes->Width = CursorWidth;
|
ppdev->pPointerAttributes->Width = CursorWidth;
|
||||||
ppdev->pPointerAttributes->Height = CursorHeight;
|
ppdev->pPointerAttributes->Height = CursorHeight;
|
||||||
ppdev->pPointerAttributes->WidthInBytes = CursorWidth;
|
ppdev->pPointerAttributes->WidthInBytes = CursorWidth;
|
||||||
ppdev->pPointerAttributes->Enable = 0;
|
ppdev->pPointerAttributes->Enable = 0;
|
||||||
ppdev->pPointerAttributes->Column = 0;
|
ppdev->pPointerAttributes->Column = 0;
|
||||||
ppdev->pPointerAttributes->Row = 0;
|
ppdev->pPointerAttributes->Row = 0;
|
||||||
|
|
||||||
// Allocate memory for the pixels behind the cursor
|
// Allocate memory for the pixels behind the cursor
|
||||||
behindCursor = EngAllocMem(0, ppdev->pPointerAttributes->WidthInBytes * ppdev->pPointerAttributes->Height, ALLOC_TAG);
|
behindCursor = EngAllocMem(0, ppdev->pPointerAttributes->WidthInBytes * ppdev->pPointerAttributes->Height, ALLOC_TAG);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID VGADDIMovePointer(PSURFOBJ pso, LONG x, LONG y, PRECTL prcl)
|
VOID VGADDIMovePointer(PSURFOBJ pso, LONG x, LONG y, PRECTL prcl)
|
||||||
{
|
{
|
||||||
PPDEV ppdev = (PPDEV)pso->dhpdev;
|
PPDEV ppdev = (PPDEV)pso->dhpdev;
|
||||||
|
|
||||||
if(x == -1)
|
if(x == -1)
|
||||||
{
|
{
|
||||||
// x == -1 and y == -1 indicates we must hide the cursor
|
// x == -1 and y == -1 indicates we must hide the cursor
|
||||||
vgaHideCursor(ppdev);
|
vgaHideCursor(ppdev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ppdev->xyCursor.x = x;
|
ppdev->xyCursor.x = x;
|
||||||
ppdev->xyCursor.y = y;
|
ppdev->xyCursor.y = y;
|
||||||
|
|
||||||
vgaShowCursor(ppdev);
|
vgaShowCursor(ppdev);
|
||||||
|
|
||||||
// Give feedback on the new cursor rectangle
|
// Give feedback on the new cursor rectangle
|
||||||
// if (prcl != NULL) ComputePointerRect(ppdev, prcl);
|
// if (prcl != NULL) ComputePointerRect(ppdev, prcl);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG VGADDISetPointerShape(PSURFOBJ pso, PSURFOBJ psoMask, PSURFOBJ psoColor, PXLATEOBJ pxlo,
|
ULONG VGADDISetPointerShape(PSURFOBJ pso, PSURFOBJ psoMask, PSURFOBJ psoColor, PXLATEOBJ pxlo,
|
||||||
LONG xHot, LONG yHot, LONG x, LONG y,
|
LONG xHot, LONG yHot, LONG x, LONG y,
|
||||||
PRECTL prcl, ULONG fl)
|
PRECTL prcl, ULONG fl)
|
||||||
{
|
{
|
||||||
PPDEV ppdev = (PPDEV)pso->dhpdev;
|
PPDEV ppdev = (PPDEV)pso->dhpdev;
|
||||||
ULONG cursorBytes = ppdev->pPointerAttributes->WidthInBytes * ppdev->pPointerAttributes->Height;
|
ULONG cursorBytes = ppdev->pPointerAttributes->WidthInBytes * ppdev->pPointerAttributes->Height;
|
||||||
|
|
||||||
// Hide the cursor (if it's there -- FIXME?)
|
// Hide the cursor (if it's there -- FIXME?)
|
||||||
if(ppdev->pPointerAttributes->Enable != 0) vgaHideCursor(ppdev);
|
if(ppdev->pPointerAttributes->Enable != 0) vgaHideCursor(ppdev);
|
||||||
|
|
||||||
// Copy the mask and color bitmaps into the PPDEV
|
// Copy the mask and color bitmaps into the PPDEV
|
||||||
RtlCopyMemory(ppdev->pPointerAttributes->Pixels, psoMask->pvBits, cursorBytes);
|
RtlCopyMemory(ppdev->pPointerAttributes->Pixels, psoMask->pvBits, cursorBytes);
|
||||||
if(psoColor != NULL) RtlCopyMemory(ppdev->pPointerAttributes->Pixels + cursorBytes, psoColor->pvBits, cursorBytes);
|
if(psoColor != NULL) RtlCopyMemory(ppdev->pPointerAttributes->Pixels + cursorBytes, psoColor->pvBits, cursorBytes);
|
||||||
|
|
||||||
// Set the new cursor position
|
// Set the new cursor position
|
||||||
ppdev->xyCursor.x = x;
|
ppdev->xyCursor.x = x;
|
||||||
ppdev->xyCursor.y = y;
|
ppdev->xyCursor.y = y;
|
||||||
|
|
||||||
// Show the cursor
|
// Show the cursor
|
||||||
vgaShowCursor(ppdev);
|
vgaShowCursor(ppdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vgaHideCursor(PPDEV ppdev)
|
void vgaHideCursor(PPDEV ppdev)
|
||||||
{
|
{
|
||||||
ULONG i, j, cx, cy, bitpos;
|
ULONG i, j, cx, cy, bitpos;
|
||||||
|
|
||||||
// Display what was behind cursor
|
// Display what was behind cursor
|
||||||
BltToVGA(oldx, oldx, oldy,
|
DFB_BltToVGA(oldx, oldx, oldy,
|
||||||
ppdev->pPointerAttributes->Width-1,
|
ppdev->pPointerAttributes->Width-1,
|
||||||
ppdev->pPointerAttributes->Height-1,
|
ppdev->pPointerAttributes->Height-1,
|
||||||
behindCursor);
|
behindCursor);
|
||||||
|
|
||||||
oldx = ppdev->xyCursor.x;
|
oldx = ppdev->xyCursor.x;
|
||||||
oldy = ppdev->xyCursor.y;
|
oldy = ppdev->xyCursor.y;
|
||||||
|
|
||||||
ppdev->pPointerAttributes->Enable = 0;
|
ppdev->pPointerAttributes->Enable = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vgaShowCursor(PPDEV ppdev)
|
void vgaShowCursor(PPDEV ppdev)
|
||||||
{
|
{
|
||||||
ULONG i, j, cx, cy, bitpos;
|
ULONG i, j, cx, cy, bitpos;
|
||||||
|
|
||||||
if(ppdev->pPointerAttributes->Enable != 0) vgaHideCursor(ppdev);
|
if(ppdev->pPointerAttributes->Enable != 0) vgaHideCursor(ppdev);
|
||||||
|
|
||||||
// Capture pixels behind the cursor
|
// Capture pixels behind the cursor
|
||||||
cx = ppdev->xyCursor.x;
|
cx = ppdev->xyCursor.x;
|
||||||
cy = ppdev->xyCursor.y;
|
cy = ppdev->xyCursor.y;
|
||||||
bitpos = 0;
|
bitpos = 0;
|
||||||
for (j=0; j<ppdev->pPointerAttributes->Height; j++)
|
for (j=0; j<ppdev->pPointerAttributes->Height; j++)
|
||||||
{
|
{
|
||||||
cx = ppdev->xyCursor.x;
|
cx = ppdev->xyCursor.x;
|
||||||
for (i=0; i<ppdev->pPointerAttributes->Width; i++)
|
for (i=0; i<ppdev->pPointerAttributes->Width; i++)
|
||||||
{
|
{
|
||||||
behindCursor[bitpos] = vgaGetPixel(cx, cy);
|
behindCursor[bitpos] = vgaGetPixel(cx, cy);
|
||||||
bitpos++;
|
bitpos++;
|
||||||
cx++;
|
cx++;
|
||||||
}
|
}
|
||||||
cy++;
|
cy++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display the cursor
|
// Display the cursor
|
||||||
BltToVGA(ppdev->xyCursor.x, ppdev->xyCursor.x, ppdev->xyCursor.y,
|
DIB_BltToVGA(ppdev->xyCursor.x, ppdev->xyCursor.x, ppdev->xyCursor.y,
|
||||||
ppdev->pPointerAttributes->Width-1,
|
ppdev->pPointerAttributes->Width-1,
|
||||||
ppdev->pPointerAttributes->Height-1,
|
ppdev->pPointerAttributes->Height-1,
|
||||||
ppdev->pPointerAttributes->Pixels);
|
ppdev->pPointerAttributes->Pixels);
|
||||||
|
|
||||||
ppdev->pPointerAttributes->Enable = 1;
|
ppdev->pPointerAttributes->Enable = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,145 +6,143 @@ static WORD PaletteBuffer[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static BYTE ColorBuffer[] = {
|
static BYTE ColorBuffer[] = {
|
||||||
16, // 16 entries
|
16, // 16 entries
|
||||||
0, 0,
|
0, 0,
|
||||||
0, // start with 0
|
0, // start with 0
|
||||||
0x00, 0x00, 0x00, 0x00, // black
|
0x00, 0x00, 0x00, 0x00, // black
|
||||||
0x2A, 0x00, 0x15, 0x00, // red
|
0x2A, 0x00, 0x15, 0x00, // red
|
||||||
0x00, 0x2A, 0x15, 0x00, // green
|
0x00, 0x2A, 0x15, 0x00, // green
|
||||||
0x2A, 0x2A, 0x15, 0x00, // brown
|
0x2A, 0x2A, 0x15, 0x00, // brown
|
||||||
0x00, 0x00, 0x2A, 0x00, // blue
|
0x00, 0x00, 0x2A, 0x00, // blue
|
||||||
0x2A, 0x15, 0x2A, 0x00, // magenta
|
0x2A, 0x15, 0x2A, 0x00, // magenta
|
||||||
0x15, 0x2A, 0x2A, 0x00, // cyan
|
0x15, 0x2A, 0x2A, 0x00, // cyan
|
||||||
0x21, 0x22, 0x23, 0x00, // dark gray
|
0x21, 0x22, 0x23, 0x00, // dark gray
|
||||||
0x30, 0x31, 0x32, 0x00, // light gray
|
0x30, 0x31, 0x32, 0x00, // light gray
|
||||||
0x3F, 0x00, 0x00, 0x00, // bright red
|
0x3F, 0x00, 0x00, 0x00, // bright red
|
||||||
0x00, 0x3F, 0x00, 0x00, // bright green
|
0x00, 0x3F, 0x00, 0x00, // bright green
|
||||||
0x3F, 0x3F, 0x00, 0x00, // bright yellow
|
0x3F, 0x3F, 0x00, 0x00, // bright yellow
|
||||||
0x00, 0x00, 0x3F, 0x00, // bright blue
|
0x00, 0x00, 0x3F, 0x00, // bright blue
|
||||||
0x3F, 0x00, 0x3F, 0x00, // bright magenta
|
0x3F, 0x00, 0x3F, 0x00, // bright magenta
|
||||||
0x00, 0x3F, 0x3F, 0x00, // bright cyan
|
0x00, 0x3F, 0x3F, 0x00, // bright cyan
|
||||||
0x3F, 0x3F, 0x3F, 0x00 // bright white
|
0x3F, 0x3F, 0x3F, 0x00 // bright white
|
||||||
};
|
};
|
||||||
|
|
||||||
DWORD getAvailableModes(HANDLE Driver,
|
DWORD getAvailableModes(HANDLE Driver,
|
||||||
PVIDEO_MODE_INFORMATION *modeInformation,
|
PVIDEO_MODE_INFORMATION *modeInformation,
|
||||||
DWORD *ModeSize)
|
DWORD *ModeSize)
|
||||||
{
|
{
|
||||||
ULONG Temp;
|
ULONG Temp;
|
||||||
VIDEO_NUM_MODES modes;
|
VIDEO_NUM_MODES modes;
|
||||||
PVIDEO_MODE_INFORMATION VideoTemp;
|
PVIDEO_MODE_INFORMATION VideoTemp;
|
||||||
|
|
||||||
// get number of modes supported
|
// get number of modes supported
|
||||||
if (EngDeviceIoControl(Driver,
|
if (EngDeviceIoControl(Driver,
|
||||||
IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES,
|
IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&modes,
|
&modes,
|
||||||
sizeof(VIDEO_NUM_MODES),
|
sizeof(VIDEO_NUM_MODES),
|
||||||
&Temp))
|
&Temp))
|
||||||
{
|
{
|
||||||
// get modes failed
|
// get modes failed
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
*ModeSize = modes.ModeInformationLength;
|
*ModeSize = modes.ModeInformationLength;
|
||||||
|
|
||||||
// allocate buffer for the mini-port to write the modes in
|
// allocate buffer for the mini-port to write the modes in
|
||||||
*modeInformation = (PVIDEO_MODE_INFORMATION)
|
*modeInformation = (PVIDEO_MODE_INFORMATION)
|
||||||
EngAllocMem(0, modes.NumModes *
|
EngAllocMem(0, modes.NumModes *
|
||||||
modes.ModeInformationLength, ALLOC_TAG);
|
modes.ModeInformationLength, ALLOC_TAG);
|
||||||
|
|
||||||
if (*modeInformation == (PVIDEO_MODE_INFORMATION) NULL)
|
if (*modeInformation == (PVIDEO_MODE_INFORMATION) NULL)
|
||||||
{
|
{
|
||||||
// couldn't allocate buffer
|
// couldn't allocate buffer
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask the mini-port to fill in the available modes.
|
// Ask the mini-port to fill in the available modes.
|
||||||
if (EngDeviceIoControl(Driver,
|
if (EngDeviceIoControl(Driver,
|
||||||
IOCTL_VIDEO_QUERY_AVAIL_MODES,
|
IOCTL_VIDEO_QUERY_AVAIL_MODES,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
*modeInformation,
|
*modeInformation,
|
||||||
modes.NumModes * modes.ModeInformationLength,
|
modes.NumModes * modes.ModeInformationLength,
|
||||||
&Temp))
|
&Temp))
|
||||||
{
|
{
|
||||||
// failed to query modes
|
// failed to query modes
|
||||||
EngFreeMem(*modeInformation);
|
EngFreeMem(*modeInformation);
|
||||||
*modeInformation = (PVIDEO_MODE_INFORMATION) NULL;
|
*modeInformation = (PVIDEO_MODE_INFORMATION) NULL;
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Which modes supported by miniport driver are also suppoted by us, the
|
// Which modes supported by miniport driver are also suppoted by us, the
|
||||||
// display driver
|
// display driver
|
||||||
|
|
||||||
Temp = modes.NumModes;
|
Temp = modes.NumModes;
|
||||||
VideoTemp = *modeInformation;
|
VideoTemp = *modeInformation;
|
||||||
|
|
||||||
// Reject mode if it's not 4 planes or not graphic or not 1 bits per pel
|
// Reject mode if it's not 4 planes or not graphic or not 1 bits per pel
|
||||||
while (Temp--)
|
while (Temp--)
|
||||||
{
|
{
|
||||||
if ((VideoTemp->NumberOfPlanes != 4 ) ||
|
if ((VideoTemp->NumberOfPlanes != 4 ) ||
|
||||||
!(VideoTemp->AttributeFlags & VIDEO_MODE_GRAPHICS) ||
|
!(VideoTemp->AttributeFlags & VIDEO_MODE_GRAPHICS) ||
|
||||||
(VideoTemp->BitsPerPlane != 1) ||
|
(VideoTemp->BitsPerPlane != 1) ||
|
||||||
BROKEN_RASTERS(VideoTemp->ScreenStride,
|
BROKEN_RASTERS(VideoTemp->ScreenStride, VideoTemp->VisScreenHeight))
|
||||||
VideoTemp->VisScreenHeight))
|
|
||||||
|
|
||||||
{
|
{
|
||||||
VideoTemp->Length = 0;
|
VideoTemp->Length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoTemp = (PVIDEO_MODE_INFORMATION)
|
VideoTemp = (PVIDEO_MODE_INFORMATION)(((PUCHAR)VideoTemp) + modes.ModeInformationLength);
|
||||||
(((PUCHAR)VideoTemp) + modes.ModeInformationLength);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return modes.NumModes;
|
return modes.NumModes;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL InitVGA(PPDEV ppdev, BOOL bFirst)
|
BOOL InitVGA(PPDEV ppdev, BOOL bFirst)
|
||||||
{
|
{
|
||||||
UINT ReturnedDataLength;
|
UINT ReturnedDataLength;
|
||||||
VIDEO_MEMORY VideoMemory;
|
VIDEO_MEMORY VideoMemory;
|
||||||
VIDEO_MEMORY_INFORMATION VideoMemoryInfo;
|
VIDEO_MEMORY_INFORMATION VideoMemoryInfo;
|
||||||
|
|
||||||
char* vidmem;
|
char* vidmem;
|
||||||
|
|
||||||
ppdev->ModeNum = 12;
|
ppdev->ModeNum = 12;
|
||||||
|
|
||||||
// Set the mode that was requested
|
// Set the mode that was requested
|
||||||
if (EngDeviceIoControl(ppdev->KMDriver,
|
if (EngDeviceIoControl(ppdev->KMDriver,
|
||||||
IOCTL_VIDEO_SET_CURRENT_MODE,
|
IOCTL_VIDEO_SET_CURRENT_MODE,
|
||||||
&ppdev->ModeNum,
|
&ppdev->ModeNum,
|
||||||
sizeof(VIDEO_MODE),
|
sizeof(VIDEO_MODE),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
&ReturnedDataLength)) {
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set up internal palette
|
||||||
|
if (EngDeviceIoControl(ppdev->KMDriver,
|
||||||
|
IOCTL_VIDEO_SET_PALETTE_REGISTERS,
|
||||||
|
(PVOID) PaletteBuffer,
|
||||||
|
sizeof (PaletteBuffer),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
&ReturnedDataLength)) {
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set up the DAC
|
||||||
|
if (EngDeviceIoControl(ppdev->KMDriver,
|
||||||
|
IOCTL_VIDEO_SET_COLOR_REGISTERS,
|
||||||
|
(PVOID) ColorBuffer,
|
||||||
|
sizeof (ColorBuffer),
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&ReturnedDataLength)) {
|
&ReturnedDataLength)) {
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up internal palette
|
|
||||||
if (EngDeviceIoControl(ppdev->KMDriver,
|
|
||||||
IOCTL_VIDEO_SET_PALETTE_REGISTERS,
|
|
||||||
(PVOID) PaletteBuffer,
|
|
||||||
sizeof (PaletteBuffer),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
&ReturnedDataLength)) {
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set up the DAC
|
|
||||||
if (EngDeviceIoControl(ppdev->KMDriver,
|
|
||||||
IOCTL_VIDEO_SET_COLOR_REGISTERS,
|
|
||||||
(PVOID) ColorBuffer,
|
|
||||||
sizeof (ColorBuffer),
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
&ReturnedDataLength)) {
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -168,5 +166,5 @@ gotta fix this up.. it prevents drawing to vidmem right now
|
||||||
ppdev->fbScreen = VideoMemoryInfo.FrameBufferBase;
|
ppdev->fbScreen = VideoMemoryInfo.FrameBufferBase;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,15 @@ HANDLE GdiHeap;
|
||||||
|
|
||||||
typedef struct _RECT_ENUM
|
typedef struct _RECT_ENUM
|
||||||
{
|
{
|
||||||
ULONG c;
|
ULONG c;
|
||||||
RECTL arcl[ENUM_RECT_LIMIT];
|
RECTL arcl[ENUM_RECT_LIMIT];
|
||||||
} RECT_ENUM;
|
} RECT_ENUM;
|
||||||
|
|
||||||
// Cursor coordinates
|
// Cursor coordinates
|
||||||
typedef struct _XYPAIR
|
typedef struct _XYPAIR
|
||||||
{
|
{
|
||||||
USHORT x;
|
USHORT x;
|
||||||
USHORT y;
|
USHORT y;
|
||||||
} XYPAIR;
|
} XYPAIR;
|
||||||
|
|
||||||
// Cursor states
|
// Cursor states
|
||||||
|
@ -37,60 +37,57 @@ typedef struct _XYPAIR
|
||||||
|
|
||||||
typedef struct _PDEV
|
typedef struct _PDEV
|
||||||
{
|
{
|
||||||
ULONG fl; // driver flags
|
ULONG fl; // driver flags
|
||||||
|
|
||||||
// Handles
|
// Handles
|
||||||
HANDLE KMDriver;
|
HANDLE KMDriver;
|
||||||
HDEV GDIDevHandle; // engine's handle to PDEV
|
HDEV GDIDevHandle; // engine's handle to PDEV
|
||||||
HSURF SurfHandle; // engine's handle to surface
|
HSURF SurfHandle; // engine's handle to surface
|
||||||
PVOID AssociatedSurf; // associated surface
|
PVOID AssociatedSurf; // associated surface
|
||||||
|
|
||||||
// Cursor
|
// Cursor
|
||||||
XYPAIR xyCursor; // cursor position
|
XYPAIR xyCursor; // cursor position
|
||||||
POINTL ptlExtent; // cursor extent
|
POINTL ptlExtent; // cursor extent
|
||||||
ULONG cExtent; // effective cursor extent
|
ULONG cExtent; // effective cursor extent
|
||||||
ULONG flCursor; // cursor status
|
ULONG flCursor; // cursor status
|
||||||
|
|
||||||
// Pointer
|
// Pointer
|
||||||
PVIDEO_POINTER_ATTRIBUTES pPointerAttributes; // HW Pointer Attributes
|
PVIDEO_POINTER_ATTRIBUTES pPointerAttributes; // HW Pointer Attributes
|
||||||
ULONG XorMaskStartOffset; // Start offset of hardware pointer
|
ULONG XorMaskStartOffset; // Start offset of hardware pointer
|
||||||
// XOR mask relative to AND mask for
|
// XOR mask relative to AND mask for
|
||||||
// passing to HW pointer
|
// passing to HW pointer
|
||||||
DWORD PointerAttributes; // Size of buffer allocated
|
DWORD PointerAttributes; // Size of buffer allocated
|
||||||
DWORD flPreallocSSBBufferInUse; // True if preallocated saved screen
|
DWORD flPreallocSSBBufferInUse; // True if preallocated saved screen
|
||||||
// bits buffer is in use
|
// bits buffer is in use
|
||||||
PUCHAR pjPreallocSSBBuffer; // Pointer to preallocated saved screen
|
PUCHAR pjPreallocSSBBuffer; // Pointer to preallocated saved screen
|
||||||
// bits buffer, if there is one
|
// bits buffer, if there is one
|
||||||
ULONG ulPreallocSSBSize; // Size of preallocated saved screen
|
ULONG ulPreallocSSBSize; // Size of preallocated saved screen
|
||||||
// bits buffer
|
// bits buffer
|
||||||
VIDEO_POINTER_CAPABILITIES PointerCapabilities; // HW pointer abilities
|
VIDEO_POINTER_CAPABILITIES PointerCapabilities; // HW pointer abilities
|
||||||
PUCHAR pucDIB4ToVGAConvBuffer; // DIB4->VGA conversion table buffer
|
PUCHAR pucDIB4ToVGAConvBuffer; // DIB4->VGA conversion table buffer
|
||||||
PUCHAR pucDIB4ToVGAConvTables; // Pointer to DIB4->VGA conversion
|
PUCHAR pucDIB4ToVGAConvTables; // Pointer to DIB4->VGA conversion
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
|
ULONG ModeNum; // mode index for current VGA mode
|
||||||
|
|
||||||
ULONG ModeNum; // mode index for current VGA mode
|
SIZEL sizeSurf; // displayed size of the surface
|
||||||
|
PBYTE fbScreen; // pointer to the frame buffer
|
||||||
SIZEL sizeSurf; // displayed size of the surface
|
RECTL SavedBitsRight; // invisible part right of screen
|
||||||
|
RECTL SavedBitsBottom; // invisible part at the bottom of the screen
|
||||||
PBYTE fbScreen; // pointer to the frame buffer
|
BOOL BitsSaved; // TRUE if bits are currently saved
|
||||||
|
SIZEL sizeMem; // actual size (in pixels) of video memory
|
||||||
RECTL SavedBitsRight; // invisible part right of screen
|
LONG NumScansUsedByPointer; // # scans of offscreen memory used by
|
||||||
RECTL SavedBitsBottom; // invisible part at the bottom of the screen
|
|
||||||
BOOL BitsSaved; // TRUE if bits are currently saved
|
|
||||||
SIZEL sizeMem; // actual size (in pixels) of video memory
|
|
||||||
LONG NumScansUsedByPointer; // # scans of offscreen memory used by
|
|
||||||
|
|
||||||
} PDEV, *PPDEV;
|
} PDEV, *PPDEV;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
RECTL BankBounds; // Pixels addressable in this bank
|
RECTL BankBounds; // Pixels addressable in this bank
|
||||||
ULONG BankOffset; // Offset of bank start from bitmap start if linearly addressable
|
ULONG BankOffset; // Offset of bank start from bitmap start if linearly addressable
|
||||||
} BANK_INFO, *PBANK_INFO;
|
} BANK_INFO, *PBANK_INFO;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
JustifyTop = 0,
|
JustifyTop = 0,
|
||||||
JustifyBottom,
|
JustifyBottom,
|
||||||
} BANK_JUST;
|
} BANK_JUST;
|
||||||
|
|
||||||
// bank control function vector
|
// bank control function vector
|
||||||
|
@ -101,16 +98,16 @@ typedef VOID (*PFN_BankControl)(PVOID, ULONG, BANK_JUST);
|
||||||
|
|
||||||
typedef struct _SAVED_SCREEN_BITS
|
typedef struct _SAVED_SCREEN_BITS
|
||||||
{
|
{
|
||||||
BOOL bFlags;
|
BOOL bFlags;
|
||||||
PBYTE pjBuffer; // pointer to save buffer start
|
PBYTE pjBuffer; // pointer to save buffer start
|
||||||
ULONG ulSize; // size of save buffer (per plane; display memory only)
|
ULONG ulSize; // size of save buffer (per plane; display memory only)
|
||||||
ULONG ulSaveWidthInBytes; // # of bytes across save area (including
|
ULONG ulSaveWidthInBytes; // # of bytes across save area (including
|
||||||
// partial edge bytes, if any)
|
// partial edge bytes, if any)
|
||||||
ULONG ulDelta; // # of bytes from end of one saved scan's saved bits to
|
ULONG ulDelta; // # of bytes from end of one saved scan's saved bits to
|
||||||
// start of next (system memory only)
|
// start of next (system memory only)
|
||||||
PVOID pvNextSSB; // pointer to next saved screen bits block
|
PVOID pvNextSSB; // pointer to next saved screen bits block
|
||||||
// for system memory blocks, saved bits start immediately
|
// for system memory blocks, saved bits start immediately
|
||||||
// after this structure
|
// after this structure
|
||||||
} SAVED_SCREEN_BITS, *PSAVED_SCREEN_BITS;
|
} SAVED_SCREEN_BITS, *PSAVED_SCREEN_BITS;
|
||||||
|
|
||||||
// DEVSURF -- definition of a surface as seen and used by the various VGA
|
// DEVSURF -- definition of a surface as seen and used by the various VGA
|
||||||
|
@ -118,69 +115,68 @@ typedef struct _SAVED_SCREEN_BITS
|
||||||
|
|
||||||
typedef struct _DEVSURF
|
typedef struct _DEVSURF
|
||||||
{
|
{
|
||||||
IDENT ident; // Identifier for debugging ease
|
IDENT ident; // Identifier for debugging ease
|
||||||
ULONG flSurf; // DS_ flags as defined below
|
ULONG flSurf; // DS_ flags as defined below
|
||||||
BYTE Color; // Solid color surface if DS_SOLIDBRUSH
|
BYTE Color; // Solid color surface if DS_SOLIDBRUSH
|
||||||
|
|
||||||
// If DS_SOLIDBRUSH, the following fields are undefined and not guaranteed to
|
// If DS_SOLIDBRUSH, the following fields are undefined and not guaranteed to
|
||||||
// have been allocated!
|
// have been allocated!
|
||||||
|
|
||||||
BYTE Format; // BMF_*, BMF_PHYSDEVICE
|
BYTE Format; // BMF_*, BMF_PHYSDEVICE
|
||||||
BYTE jReserved1; // Reserved
|
BYTE jReserved1; // Reserved
|
||||||
BYTE jReserved2; // Reserved
|
BYTE jReserved2; // Reserved
|
||||||
PPDEV ppdev; // Pointer to associated PDEV
|
PPDEV ppdev; // Pointer to associated PDEV
|
||||||
SIZEL sizeSurf; // Size of the surface
|
SIZEL sizeSurf; // Size of the surface
|
||||||
ULONG NextScan; // Offset from scan "n" to "n+1"
|
ULONG NextScan; // Offset from scan "n" to "n+1"
|
||||||
ULONG NextPlane; // Offset from plane "n" to "n+1"
|
ULONG NextPlane; // Offset from plane "n" to "n+1"
|
||||||
PVOID Scan0; // Pointer to scan 0 of bitmap
|
PVOID Scan0; // Pointer to scan 0 of bitmap
|
||||||
// (actual address of start of bank, for banked VGA surface)
|
// (actual address of start of bank, for banked VGA surface)
|
||||||
PVOID StartBmp; // Pointer to start of bitmap
|
PVOID StartBmp; // Pointer to start of bitmap
|
||||||
PVOID Conv; // Pointer to DIB/Planer conversion buffer
|
PVOID Conv; // Pointer to DIB/Planer conversion buffer
|
||||||
|
|
||||||
// Banking variables; used only for banked VGA surfaces
|
// Banking variables; used only for banked VGA surfaces
|
||||||
|
|
||||||
PVIDEO_BANK_SELECT BankSelectInfo;
|
PVIDEO_BANK_SELECT BankSelectInfo;
|
||||||
ULONG Bank2RWSkip; // Offset from one bank index to next to make two 32K banks appear to be
|
ULONG Bank2RWSkip; // Offset from one bank index to next to make two 32K banks appear to be
|
||||||
// one seamless 64K bank
|
// one seamless 64K bank
|
||||||
PFN pfnBankSwitchCode;
|
PFN pfnBankSwitchCode;
|
||||||
VIDEO_BANK_TYPE BankingType;
|
VIDEO_BANK_TYPE BankingType;
|
||||||
ULONG BitmapSize; // Length of bitmap if there were no banking, in CPU addressable bytes
|
ULONG BitmapSize; // Length of bitmap if there were no banking, in CPU addressable bytes
|
||||||
ULONG PtrBankScan; // Last scan line in pointer work bank
|
ULONG PtrBankScan; // Last scan line in pointer work bank
|
||||||
RECTL WindowClip1; // Single-window banking clip rect
|
RECTL WindowClip1; // Single-window banking clip rect
|
||||||
RECTL WindowClip2[2]; // Double-window banking clip rects for
|
RECTL WindowClip2[2]; // Double-window banking clip rects for
|
||||||
// windows 0 & 1
|
// windows 0 & 1
|
||||||
ULONG WindowBank[2]; // Current banks mapped into windows
|
ULONG WindowBank[2]; // Current banks mapped into windows
|
||||||
// 0 & 1 (used in 2 window mode only)
|
// 0 & 1 (used in 2 window mode only)
|
||||||
PBANK_INFO BankInfo; // Pointer to array of bank clip info
|
PBANK_INFO BankInfo; // Pointer to array of bank clip info
|
||||||
ULONG BankInfoLength; // Length of pbiBankInfo, in entries
|
ULONG BankInfoLength; // Length of pbiBankInfo, in entries
|
||||||
PBANK_INFO BankInfo2RW; // Same as above, but for 2RW window
|
PBANK_INFO BankInfo2RW; // Same as above, but for 2RW window
|
||||||
ULONG BankInfo2RWLength; // case
|
ULONG BankInfo2RWLength; // case
|
||||||
PFN_BankControl pfnBankControl; // Pointer to bank control function
|
PFN_BankControl pfnBankControl; // Pointer to bank control function
|
||||||
PFN_BankControl pfnBankControl2Window; // Pointer to double-window bank
|
PFN_BankControl pfnBankControl2Window; // Pointer to double-window bank
|
||||||
// control function
|
// control function
|
||||||
PVOID BitmapStart; // Single-window bitmap start pointer (adjusted as
|
PVOID BitmapStart; // Single-window bitmap start pointer (adjusted as
|
||||||
// necessary to make window map in at proper offset)
|
// necessary to make window map in at proper offset)
|
||||||
PVOID BitmapStart2Window[2]; // Double-window window 0 and 1 bitmap start
|
PVOID BitmapStart2Window[2]; // Double-window window 0 and 1 bitmap start
|
||||||
PVOID BankBufferPlane0; // Pointer to temp buffer capable of
|
PVOID BankBufferPlane0; // Pointer to temp buffer capable of
|
||||||
// storing one full bank for plane 0 for 1
|
// storing one full bank for plane 0 for 1
|
||||||
// R/W case; capable of storing one full
|
// R/W case; capable of storing one full
|
||||||
// bank height of edge bytes for all four
|
// bank height of edge bytes for all four
|
||||||
// planes for the 1R/1W case. Also used to
|
// planes for the 1R/1W case. Also used to
|
||||||
// point to text building buffer in all
|
// point to text building buffer in all
|
||||||
// cases. This is the pointer used to
|
// cases. This is the pointer used to
|
||||||
// dealloc bank working storage for all
|
// dealloc bank working storage for all
|
||||||
// four planes
|
// four planes
|
||||||
|
|
||||||
// The following 3 pointers used by 1 R/W banked devices
|
// The following 3 pointers used by 1 R/W banked devices
|
||||||
|
PVOID BankBufferPlane1; // Like above, but for plane 1
|
||||||
|
PVOID BankBufferPlane2; // Like above, but for plane 2
|
||||||
|
PVOID BankBufferPlane3; // Like above, but for plane 3
|
||||||
|
ULONG TempBufferSize; // Full size of temp buffer pointed to
|
||||||
|
// by pvBankBufferPlane0
|
||||||
|
|
||||||
PVOID BankBufferPlane1; // Like above, but for plane 1
|
ULONG ajBits[1]; // Bits will start here for device bitmaps
|
||||||
PVOID BankBufferPlane2; // Like above, but for plane 2
|
PSAVED_SCREEN_BITS ssbList; // Pointer to start of linked list of
|
||||||
PVOID BankBufferPlane3; // Like above, but for plane 3
|
|
||||||
ULONG TempBufferSize; // Full size of temp buffer pointed to
|
|
||||||
// by pvBankBufferPlane0
|
|
||||||
|
|
||||||
ULONG ajBits[1]; // Bits will start here for device bitmaps
|
|
||||||
PSAVED_SCREEN_BITS ssbList; // Pointer to start of linked list of
|
|
||||||
// saved screen bit blocks
|
// saved screen bit blocks
|
||||||
} DEVSURF, *PDEVSURF;
|
} DEVSURF, *PDEVSURF;
|
||||||
|
|
||||||
|
@ -208,5 +204,5 @@ BOOL InitVGA(PPDEV ppdev, BOOL bFirst); // screen.c: initialize VGA mode
|
||||||
#define PACKED_PELS_PER_CPU_ADDRESS 2
|
#define PACKED_PELS_PER_CPU_ADDRESS 2
|
||||||
|
|
||||||
BOOL VGAtoGDI(
|
BOOL VGAtoGDI(
|
||||||
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
||||||
RECTL *DestRect, POINTL *SourcePoint);
|
RECTL *DestRect, POINTL *SourcePoint);
|
||||||
|
|
|
@ -1,3 +1,15 @@
|
||||||
|
//
|
||||||
|
// The current VGA bitblt routines work just fine. However, they put the 4bpp data into 1 byte each.
|
||||||
|
// To solve the problem, whenever assigning to or retrieving data from the buffer, it must pass through
|
||||||
|
// a macro which packs it appropriately.
|
||||||
|
//
|
||||||
|
// Possible future enhancements:
|
||||||
|
// * Use putByte function for middlepix when bitbltting to the VGA
|
||||||
|
//
|
||||||
|
|
||||||
|
// PROCESS 1: Use 4bpp bitblt instead of 8bpp-bitmap/4bpp-display
|
||||||
|
//
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <ddk/ntddvid.h>
|
#include <ddk/ntddvid.h>
|
||||||
#include <ddk/winddi.h>
|
#include <ddk/winddi.h>
|
||||||
|
@ -7,154 +19,154 @@
|
||||||
|
|
||||||
INT abs(INT nm)
|
INT abs(INT nm)
|
||||||
{
|
{
|
||||||
if(nm<0)
|
if(nm<0)
|
||||||
{
|
{
|
||||||
return nm * -1;
|
return nm * -1;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
return nm;
|
return nm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
div_t div(int num, int denom)
|
div_t div(int num, int denom)
|
||||||
{
|
{
|
||||||
div_t r;
|
div_t r;
|
||||||
if (num > 0 && denom < 0) {
|
if (num > 0 && denom < 0) {
|
||||||
num = -num;
|
num = -num;
|
||||||
denom = -denom;
|
denom = -denom;
|
||||||
}
|
}
|
||||||
r.quot = num / denom;
|
r.quot = num / denom;
|
||||||
r.rem = num % denom;
|
r.rem = num % denom;
|
||||||
if (num < 0 && denom > 0)
|
if (num < 0 && denom > 0)
|
||||||
{
|
{
|
||||||
if (r.rem > 0)
|
if (r.rem > 0)
|
||||||
{
|
{
|
||||||
r.quot++;
|
r.quot++;
|
||||||
r.rem -= denom;
|
r.rem -= denom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mod(int num, int denom)
|
int mod(int num, int denom)
|
||||||
{
|
{
|
||||||
div_t dvt = div(num, denom);
|
div_t dvt = div(num, denom);
|
||||||
return dvt.rem;
|
return dvt.rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE bytesPerPixel(ULONG Format)
|
BYTE bytesPerPixel(ULONG Format)
|
||||||
{
|
{
|
||||||
// This function is taken from /subsys/win32k/eng/surface.c
|
// This function is taken from /subsys/win32k/eng/surface.c
|
||||||
// FIXME: GDI bitmaps are supposed to be pixel-packed. Right now if the
|
// FIXME: GDI bitmaps are supposed to be pixel-packed. Right now if the
|
||||||
// pixel size if < 1 byte we expand it to 1 byte for simplicities sake
|
// pixel size if < 1 byte we expand it to 1 byte for simplicities sake
|
||||||
|
|
||||||
if(Format==BMF_1BPP)
|
if(Format==BMF_1BPP)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
if((Format==BMF_4BPP) || (Format==BMF_4RLE))
|
if((Format==BMF_4BPP) || (Format==BMF_4RLE))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
if((Format==BMF_8BPP) || (Format==BMF_8RLE))
|
if((Format==BMF_8BPP) || (Format==BMF_8RLE))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
if(Format==BMF_16BPP)
|
if(Format==BMF_16BPP)
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
} else
|
} else
|
||||||
if(Format==BMF_24BPP)
|
if(Format==BMF_24BPP)
|
||||||
{
|
{
|
||||||
return 3;
|
return 3;
|
||||||
} else
|
} else
|
||||||
if(Format==BMF_32BPP)
|
if(Format==BMF_32BPP)
|
||||||
{
|
{
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID vgaPreCalc()
|
VOID vgaPreCalc()
|
||||||
{
|
{
|
||||||
ULONG j;
|
ULONG j;
|
||||||
|
|
||||||
startmasks[1] = 127;
|
startmasks[1] = 127;
|
||||||
startmasks[2] = 63;
|
startmasks[2] = 63;
|
||||||
startmasks[3] = 31;
|
startmasks[3] = 31;
|
||||||
startmasks[4] = 15;
|
startmasks[4] = 15;
|
||||||
startmasks[5] = 7;
|
startmasks[5] = 7;
|
||||||
startmasks[6] = 3;
|
startmasks[6] = 3;
|
||||||
startmasks[7] = 1;
|
startmasks[7] = 1;
|
||||||
startmasks[8] = 255;
|
startmasks[8] = 255;
|
||||||
|
|
||||||
endmasks[0] = 128;
|
endmasks[0] = 128;
|
||||||
endmasks[1] = 192;
|
endmasks[1] = 192;
|
||||||
endmasks[2] = 224;
|
endmasks[2] = 224;
|
||||||
endmasks[3] = 240;
|
endmasks[3] = 240;
|
||||||
endmasks[4] = 248;
|
endmasks[4] = 248;
|
||||||
endmasks[5] = 252;
|
endmasks[5] = 252;
|
||||||
endmasks[6] = 254;
|
endmasks[6] = 254;
|
||||||
endmasks[7] = 255;
|
endmasks[7] = 255;
|
||||||
endmasks[8] = 255;
|
endmasks[8] = 255;
|
||||||
|
|
||||||
for(j=0; j<80; j++)
|
for(j=0; j<80; j++)
|
||||||
{
|
{
|
||||||
maskbit[j*8] = 128;
|
maskbit[j*8] = 128;
|
||||||
maskbit[j*8+1] = 64;
|
maskbit[j*8+1] = 64;
|
||||||
maskbit[j*8+2] = 32;
|
maskbit[j*8+2] = 32;
|
||||||
maskbit[j*8+3] = 16;
|
maskbit[j*8+3] = 16;
|
||||||
maskbit[j*8+4] = 8;
|
maskbit[j*8+4] = 8;
|
||||||
maskbit[j*8+5] = 4;
|
maskbit[j*8+5] = 4;
|
||||||
maskbit[j*8+6] = 2;
|
maskbit[j*8+6] = 2;
|
||||||
maskbit[j*8+7] = 1;
|
maskbit[j*8+7] = 1;
|
||||||
|
|
||||||
bit8[j*8] = 7;
|
bit8[j*8] = 7;
|
||||||
bit8[j*8+1] = 6;
|
bit8[j*8+1] = 6;
|
||||||
bit8[j*8+2] = 5;
|
bit8[j*8+2] = 5;
|
||||||
bit8[j*8+3] = 4;
|
bit8[j*8+3] = 4;
|
||||||
bit8[j*8+4] = 3;
|
bit8[j*8+4] = 3;
|
||||||
bit8[j*8+5] = 2;
|
bit8[j*8+5] = 2;
|
||||||
bit8[j*8+6] = 1;
|
bit8[j*8+6] = 1;
|
||||||
bit8[j*8+7] = 0;
|
bit8[j*8+7] = 0;
|
||||||
}
|
}
|
||||||
for(j=0; j<480; j++)
|
for(j=0; j<480; j++)
|
||||||
{
|
{
|
||||||
y80[j] = j*80;
|
y80[j] = j*80;
|
||||||
}
|
}
|
||||||
for(j=0; j<640; j++)
|
for(j=0; j<640; j++)
|
||||||
{
|
{
|
||||||
xconv[j] = j >> 3;
|
xconv[j] = j >> 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
get_masks(int x, int w)
|
get_masks(int x, int w)
|
||||||
{
|
{
|
||||||
register int tmp;
|
register int tmp;
|
||||||
|
|
||||||
leftMask = rightMask = 0;
|
leftMask = rightMask = 0;
|
||||||
byteCounter = w;
|
byteCounter = w;
|
||||||
/* right margin */
|
/* right margin */
|
||||||
tmp = (x+w) & 7;
|
tmp = (x+w) & 7;
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
byteCounter -= tmp;
|
byteCounter -= tmp;
|
||||||
rightMask = (unsigned char)(0xff00 >> tmp);
|
rightMask = (unsigned char)(0xff00 >> tmp);
|
||||||
}
|
}
|
||||||
/* left margin */
|
/* left margin */
|
||||||
tmp = x & 7;
|
tmp = x & 7;
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
byteCounter -= (8 - tmp);
|
byteCounter -= (8 - tmp);
|
||||||
leftMask = (0xff >> tmp);
|
leftMask = (0xff >> tmp);
|
||||||
}
|
}
|
||||||
/* too small ? */
|
/* too small ? */
|
||||||
if (byteCounter < 0) {
|
if (byteCounter < 0) {
|
||||||
leftMask &= rightMask;
|
leftMask &= rightMask;
|
||||||
rightMask = 0;
|
rightMask = 0;
|
||||||
byteCounter = 0;
|
byteCounter = 0;
|
||||||
}
|
}
|
||||||
byteCounter /= 8;
|
byteCounter /= 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID vgaPutPixel(INT x, INT y, UCHAR c)
|
VOID vgaPutPixel(INT x, INT y, UCHAR c)
|
||||||
|
@ -342,145 +354,242 @@ static const RECTL rclEmpty = { 0, 0, 0, 0 };
|
||||||
|
|
||||||
BOOL VGADDIIntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2)
|
BOOL VGADDIIntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2)
|
||||||
{
|
{
|
||||||
prcDst->left = max(prcSrc1->left, prcSrc2->left);
|
prcDst->left = max(prcSrc1->left, prcSrc2->left);
|
||||||
prcDst->right = min(prcSrc1->right, prcSrc2->right);
|
prcDst->right = min(prcSrc1->right, prcSrc2->right);
|
||||||
|
|
||||||
if (prcDst->left < prcDst->right) {
|
if (prcDst->left < prcDst->right) {
|
||||||
prcDst->top = max(prcSrc1->top, prcSrc2->top);
|
prcDst->top = max(prcSrc1->top, prcSrc2->top);
|
||||||
prcDst->bottom = min(prcSrc1->bottom, prcSrc2->bottom);
|
prcDst->bottom = min(prcSrc1->bottom, prcSrc2->bottom);
|
||||||
|
|
||||||
if (prcDst->top < prcDst->bottom)
|
if (prcDst->top < prcDst->bottom)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*prcDst = rclEmpty;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIB_BltFromVGA(int x, int y, int w, int h, void *b, int Dest_lDelta)
|
||||||
|
|
||||||
|
// DIB blt from the VGA.
|
||||||
|
// For now we just do slow reads -- pixel by pixel, packing each one into the correct 4BPP format.
|
||||||
|
{
|
||||||
|
PBYTE pb = b, opb = b;
|
||||||
|
BOOLEAN edgePixel = FALSE;
|
||||||
|
ULONG i, j;
|
||||||
|
ULONG x2 = x + w;
|
||||||
|
ULONG y2 = y + h;
|
||||||
|
BYTE b1, b2;
|
||||||
|
|
||||||
|
// Check if the width is odd
|
||||||
|
if(mod(w, 2)>0)
|
||||||
|
{
|
||||||
|
edgePixel = TRUE;
|
||||||
|
x2 -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j=y; j<y2; j++)
|
||||||
|
{
|
||||||
|
for (i=x; i<x2; i+=2)
|
||||||
|
{
|
||||||
|
b1 = vgaGetPixel(i, j);
|
||||||
|
b2 = vgaGetPixel(i+1, j);
|
||||||
|
*pb = b2 | (b1 << 4);
|
||||||
|
pb++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(edgePixel == TRUE)
|
||||||
|
{
|
||||||
|
b1 = vgaGetPixel(x2, j);
|
||||||
|
*pb = b1;
|
||||||
|
pb++;
|
||||||
|
}
|
||||||
|
|
||||||
|
opb += Dest_lDelta; // new test code
|
||||||
|
pb = opb; // new test code
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIB_BltToVGA(int x, int y, int w, int h, void *b, int Source_lDelta)
|
||||||
|
|
||||||
|
// DIB blt to the VGA.
|
||||||
|
// For now we just do slow writes -- pixel by pixel, packing each one into the correct 4BPP format.
|
||||||
|
{
|
||||||
|
PBYTE pb = b, opb = b;
|
||||||
|
BOOLEAN edgePixel = FALSE;
|
||||||
|
ULONG i, j;
|
||||||
|
ULONG x2 = x + w;
|
||||||
|
ULONG y2 = y + h;
|
||||||
|
BYTE b1, b2;
|
||||||
|
|
||||||
|
// Check if the width is odd
|
||||||
|
if(mod(w, 2)>0)
|
||||||
|
{
|
||||||
|
edgePixel = TRUE;
|
||||||
|
x2 -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (j=y; j<y2; j++)
|
||||||
|
{
|
||||||
|
for (i=x; i<x2; i+=2)
|
||||||
|
{
|
||||||
|
b1 = (*pb & 0xf0) >> 4;
|
||||||
|
b2 = *pb & 0x0f;
|
||||||
|
vgaPutPixel(i, j, b1);
|
||||||
|
vgaPutPixel(i+1, j, b2);
|
||||||
|
pb++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(edgePixel == TRUE)
|
||||||
|
{
|
||||||
|
b1 = *pb;
|
||||||
|
vgaPutPixel(x2, j, b1);
|
||||||
|
pb++;
|
||||||
|
}
|
||||||
|
|
||||||
|
opb += Source_lDelta; // new test code
|
||||||
|
pb = opb; // new test code
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DFB_BltFromVGA(int x, int y, int w, int h, void *b, int bw)
|
||||||
|
|
||||||
|
// This algorithm goes from goes from left to right, and inside that loop, top to bottom.
|
||||||
|
// It also stores each 4BPP pixel in an entire byte.
|
||||||
|
{
|
||||||
|
unsigned char *vp, *vpY, *vpP;
|
||||||
|
unsigned char data, mask, maskP;
|
||||||
|
unsigned char *bp, *bpY;
|
||||||
|
unsigned char plane_mask;
|
||||||
|
int byte_per_line = SCREEN_X >> 3;
|
||||||
|
int plane, i, j;
|
||||||
|
|
||||||
|
ASSIGNVP4(x, y, vpP)
|
||||||
|
ASSIGNMK4(x, y, maskP)
|
||||||
|
get_masks(x, w);
|
||||||
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); // read mode 0
|
||||||
|
saved_GC_mode = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
||||||
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x00);
|
||||||
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x04); // read map select
|
||||||
|
saved_GC_rmap = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
||||||
|
|
||||||
|
// clear buffer
|
||||||
|
bp=b;
|
||||||
|
for (j=h; j>0; j--) {
|
||||||
|
memset(bp, 0, w);
|
||||||
|
bp += bw;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (plane=0, plane_mask=1; plane<4; plane++, plane_mask<<=1) {
|
||||||
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, plane); // read map select
|
||||||
|
vpY = vpP;
|
||||||
|
bpY = b;
|
||||||
|
for (j=h; j>0; j--) {
|
||||||
|
vp = vpY;
|
||||||
|
bp = bpY;
|
||||||
|
if (leftMask) {
|
||||||
|
mask = maskP;
|
||||||
|
data = *vp++;
|
||||||
|
do {
|
||||||
|
if (data & mask) *bp |= plane_mask;
|
||||||
|
bp++;
|
||||||
|
mask >>= 1;
|
||||||
|
} while (mask & leftMask);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
if (byteCounter) {
|
||||||
|
for (i=byteCounter; i>0; i--) {
|
||||||
|
data = *vp++;
|
||||||
|
if (data & 0x80) *bp |= plane_mask;
|
||||||
|
bp++;
|
||||||
|
if (data & 0x40) *bp |= plane_mask;
|
||||||
|
bp++;
|
||||||
|
if (data & 0x20) *bp |= plane_mask;
|
||||||
|
bp++;
|
||||||
|
if (data & 0x10) *bp |= plane_mask;
|
||||||
|
bp++;
|
||||||
|
if (data & 0x08) *bp |= plane_mask;
|
||||||
|
bp++;
|
||||||
|
if (data & 0x04) *bp |= plane_mask;
|
||||||
|
bp++;
|
||||||
|
if (data & 0x02) *bp |= plane_mask;
|
||||||
|
bp++;
|
||||||
|
if (data & 0x01) *bp |= plane_mask;
|
||||||
|
bp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rightMask) {
|
||||||
|
mask = 0x80;
|
||||||
|
data = *vp;
|
||||||
|
do {
|
||||||
|
if (data & mask) *bp |= plane_mask;
|
||||||
|
bp++;
|
||||||
|
mask >>= 1;
|
||||||
|
} while (mask & rightMask);
|
||||||
|
}
|
||||||
|
bpY += bw;
|
||||||
|
vpY += byte_per_line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*prcDst = rclEmpty;
|
// reset GC register
|
||||||
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_rmap);
|
||||||
return FALSE;
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05);
|
||||||
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BltFromVGA(int x, int y, int w, int h, void *b, int bw)
|
|
||||||
|
void DFB_BltToVGA(int x, int y, int w, int h, void *b, int bw)
|
||||||
|
|
||||||
|
// This algorithm goes from goes from left to right, and inside that loop, top to bottom.
|
||||||
|
// It also stores each 4BPP pixel in an entire byte.
|
||||||
{
|
{
|
||||||
unsigned char *vp, *vpY, *vpP;
|
unsigned char *bp, *bpX;
|
||||||
unsigned char data, mask, maskP;
|
unsigned char *vp, *vpX;
|
||||||
unsigned char *bp, *bpY;
|
unsigned char mask;
|
||||||
unsigned char plane_mask;
|
volatile unsigned char dummy;
|
||||||
int byte_per_line = SCREEN_X >> 3;
|
int byte_per_line;
|
||||||
int plane, i, j;
|
int i, j;
|
||||||
|
|
||||||
ASSIGNVP4(x, y, vpP)
|
bpX = b;
|
||||||
ASSIGNMK4(x, y, maskP)
|
ASSIGNVP4(x, y, vpX)
|
||||||
get_masks(x, w);
|
ASSIGNMK4(x, y, mask)
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); /* read mode 0 */
|
byte_per_line = SCREEN_X >> 3;
|
||||||
saved_GC_mode = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); // write mode 2
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x00);
|
saved_GC_mode = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x04); /* read map select */
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x02);
|
||||||
saved_GC_rmap = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03); // replace
|
||||||
/* clear buffer */
|
saved_GC_fun = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
||||||
bp=b;
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x00);
|
||||||
for (j=h; j>0; j--) {
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x08); // bit mask
|
||||||
memset(bp, 0, w);
|
saved_GC_mask = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
||||||
bp += bw;
|
|
||||||
}
|
|
||||||
for (plane=0, plane_mask=1; plane<4; plane++, plane_mask<<=1) {
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, plane); /* read map select */
|
|
||||||
vpY = vpP;
|
|
||||||
bpY = b;
|
|
||||||
for (j=h; j>0; j--) {
|
|
||||||
vp = vpY;
|
|
||||||
bp = bpY;
|
|
||||||
if (leftMask) {
|
|
||||||
mask = maskP;
|
|
||||||
data = *vp++;
|
|
||||||
do {
|
|
||||||
if (data & mask) *bp |= plane_mask;
|
|
||||||
bp++;
|
|
||||||
mask >>= 1;
|
|
||||||
} while (mask & leftMask);
|
|
||||||
|
|
||||||
}
|
for (i=w; i>0; i--) {
|
||||||
if (byteCounter) {
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, mask);
|
||||||
for (i=byteCounter; i>0; i--) {
|
bp = bpX;
|
||||||
data = *vp++;
|
vp = vpX;
|
||||||
if (data & 0x80) *bp |= plane_mask;
|
for (j=h; j>0; j--) {
|
||||||
bp++;
|
dummy = *vp;
|
||||||
if (data & 0x40) *bp |= plane_mask;
|
*vp = *bp;
|
||||||
bp++;
|
bp += bw;
|
||||||
if (data & 0x20) *bp |= plane_mask;
|
vp += byte_per_line;
|
||||||
bp++;
|
}
|
||||||
if (data & 0x10) *bp |= plane_mask;
|
bpX++;
|
||||||
bp++;
|
if ((mask >>= 1) == 0) {
|
||||||
if (data & 0x08) *bp |= plane_mask;
|
vpX++;
|
||||||
bp++;
|
mask = 0x80;
|
||||||
if (data & 0x04) *bp |= plane_mask;
|
}
|
||||||
bp++;
|
}
|
||||||
if (data & 0x02) *bp |= plane_mask;
|
|
||||||
bp++;
|
// reset GC register
|
||||||
if (data & 0x01) *bp |= plane_mask;
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mask);
|
||||||
bp++;
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03);
|
||||||
}
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_fun);
|
||||||
}
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05);
|
||||||
if (rightMask) {
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mode);
|
||||||
mask = 0x80;
|
|
||||||
data = *vp;
|
|
||||||
do {
|
|
||||||
if (data & mask) *bp |= plane_mask;
|
|
||||||
bp++;
|
|
||||||
mask >>= 1;
|
|
||||||
} while (mask & rightMask);
|
|
||||||
}
|
|
||||||
bpY += bw;
|
|
||||||
vpY += byte_per_line;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* reset GC register */
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_rmap);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BltToVGA(int x, int y, int w, int h, void *b, int bw)
|
|
||||||
{
|
|
||||||
unsigned char *bp, *bpX;
|
|
||||||
unsigned char *vp, *vpX;
|
|
||||||
unsigned char mask;
|
|
||||||
volatile unsigned char dummy;
|
|
||||||
int byte_per_line;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
bpX = b;
|
|
||||||
ASSIGNVP4(x, y, vpX)
|
|
||||||
ASSIGNMK4(x, y, mask)
|
|
||||||
byte_per_line = SCREEN_X >> 3;
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); /* write mode 2 */
|
|
||||||
saved_GC_mode = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x02);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03); /* replace */
|
|
||||||
saved_GC_fun = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, 0x00);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x08); /* bit mask */
|
|
||||||
saved_GC_mask = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
|
||||||
for (i=w; i>0; i--) {
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, mask);
|
|
||||||
bp = bpX;
|
|
||||||
vp = vpX;
|
|
||||||
for (j=h; j>0; j--) {
|
|
||||||
dummy = *vp; *vp = *bp;
|
|
||||||
bp += bw;
|
|
||||||
vp += byte_per_line;
|
|
||||||
}
|
|
||||||
bpX++;
|
|
||||||
if ((mask >>= 1) == 0) {
|
|
||||||
vpX++;
|
|
||||||
mask = 0x80;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* reset GC register */
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mask);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x03);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_fun);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_mode);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue