VGA display driver improvements

svn path=/trunk/; revision=1184
This commit is contained in:
Jason Filby 2000-06-16 07:28:20 +00:00
parent 0b34b1b746
commit 77ef48e705
4 changed files with 78 additions and 15 deletions

View file

@ -1,9 +1,9 @@
/*
* entry.c
*
* $Revision: 1.5 $
* $Revision: 1.6 $
* $Author: jfilby $
* $Date: 2000/04/10 20:17:32 $
* $Date: 2000/06/16 07:28:19 $
*
*/
@ -101,6 +101,7 @@ DrvEnableDriver(IN ULONG EngineVersion,
EngDebugPrint("VGADDI", "DrvEnableDriver called...\n", 0);
vgaPreCalc();
// FIXME: Use Vidport to map the memory properly
vidmem = (char *)(0xd0000000 + 0xa0000);

View file

@ -28,19 +28,38 @@ BOOL GDItoVGA(
alterx = abs(SourcePoint->x - DestRect->left);
altery = abs(SourcePoint->y - DestRect->top);
for(j=SourcePoint->y; j<SourcePoint->y+dy; j++)
if(ColorTranslation == NULL)
{
initial = GDIpos;
DbgPrint("GDItoVGA: No color translation\n");
// No color translation necessary, we assume BPP = 1
for(i=SourcePoint->x; i<SourcePoint->x+dx; i++)
for(j=SourcePoint->y; j<SourcePoint->y+dy; j++)
{
RtlCopyMemory(&RGBulong, GDIpos, BPP);
idxColor = XLATEOBJ_iXlate(ColorTranslation, RGBulong);
vgaPutPixel(i+alterx, j+altery, idxColor);
GDIpos+=BPP;
initial = GDIpos;
for(i=SourcePoint->x; i<SourcePoint->x+dx; i++)
{
vgaPutPixel(i+alterx, j+altery, *GDIpos);
GDIpos+=BPP;
}
GDIpos = initial + Source->lDelta;
}
} else {
// Perform color translation
for(j=SourcePoint->y; j<SourcePoint->y+dy; j++)
{
initial = GDIpos;
for(i=SourcePoint->x; i<SourcePoint->x+dx; i++)
{
idxColor = XLATEOBJ_iXlate(ColorTranslation, *GDIpos);
vgaPutPixel(i+alterx, j+altery, idxColor);
GDIpos+=BPP;
}
GDIpos = initial + Source->lDelta;
}
GDIpos = initial + Source->lDelta;
}
DbgPrint("GDItoVGA: Done\n");
}
BOOL VGAtoGDI(
@ -53,6 +72,9 @@ BOOL VGAtoGDI(
// FIXME: Optimize to retrieve entire bytes at a time (see /display/vgavideo/vgavideo.c:vgaGetByte)
BPP = bytesPerPixel(Dest->iBitmapFormat);
DbgPrint("VGAtoGDI: BPP: %u\n", BPP);
GDIpos = Dest->pvBits +
(DestRect->top * Dest->lDelta) + (DestRect->left * BPP);
@ -61,14 +83,14 @@ BOOL VGAtoGDI(
if(ColorTranslation == NULL)
{
DbgPrint("VGAtoGDI: No color translation\n");
// No color translation necessary, we assume BPP = 1
for(j=SourcePoint->y; j<SourcePoint->y+dy; j++)
{
initial = GDIpos;
for(i=SourcePoint->x; i<SourcePoint->x+dx; i++)
{
idxColor = vgaGetPixel(i, j);
RtlCopyMemory(GDIpos, &idxColor, 1);
*GDIpos = vgaGetPixel(i, j);
GDIpos++;
}
GDIpos = initial + Dest->lDelta;
@ -80,14 +102,13 @@ BOOL VGAtoGDI(
initial = GDIpos;
for(i=SourcePoint->x; i<SourcePoint->x+dx; i++)
{
idxColor = vgaGetPixel(i, j);
RGBulong = XLATEOBJ_iXlate(ColorTranslation, idxColor);
RtlCopyMemory(GDIpos, &RGBulong, BPP);
*GDIpos = XLATEOBJ_iXlate(ColorTranslation, vgaGetPixel(i, j));
GDIpos+=BPP;
}
GDIpos = initial + Dest->lDelta;
}
}
DbgPrint("VGAtoGDI: Done\n");
}
BOOL DFBtoVGA(
@ -176,25 +197,31 @@ BOOL VGADDIBitBlt(SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask,
if((Source->iType == STYPE_BITMAP) && (Dest->iType == STYPE_DEVICE))
{
DbgPrint("GDI2VGA\n");
BltOperation = GDItoVGA;
} else
if((Source->iType == STYPE_DEVICE) && (Dest->iType == STYPE_BITMAP))
{
DbgPrint("VGA2GDI\n");
BltOperation = VGAtoGDI;
} else
if((Source->iType == STYPE_DEVICE) && (Dest->iType == STYPE_DEVICE))
{
DbgPrint("VGA2VGA\n");
BltOperation = VGAtoVGA;
} else
if((Source->iType == STYPE_DEVBITMAP) && (Dest->iType == STYPE_DEVICE))
{
DbgPrint("DFB2VGA\n");
BltOperation = DFBtoVGA;
} else
if((Source->iType == STYPE_DEVICE) && (Dest->iType == STYPE_DEVBITMAP))
{
DbgPrint("VGA2DFB\n");
BltOperation = VGAtoDFB;
} else
{
DbgPrint("VGA:bitblt.c: Can't handle requested BitBlt operation\n");
// Cannot handle given surfaces for VGA BitBlt
return FALSE;
}

View file

@ -6,12 +6,18 @@
BOOL VGADDILineTo(SURFOBJ *Surface, CLIPOBJ *Clip, BRUSHOBJ *Brush,
LONG x1, LONG y1, LONG x2, LONG y2,
RECTL *RectBounds, MIX mix)
// FIXME: Use ClipObj and RectBounds to clip the line where required
// FIXME: Use Mix to perform ROPs
{
ULONG x, y, d, i, length, xchange, ychange, error,
iSolidColor, hx, vy;
LONG deltax, deltay;
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

View file

@ -331,3 +331,32 @@ BOOL VGADDIIntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2)
return FALSE;
}
BOOL bltToVga(INT x1, INT y1, INT dx, INT dy, UCHAR *bitmap)
{
// We use vertical stripes because we save some time by setting the mask less often
// Prototype code, to be implemented in bitblt.c
ULONG offset, i;
UCHAR a, *initial;
for(j=x; j<x+dx; j++)
{
offset = xconv[x]+y80[y];
WRITE_PORT_UCHAR((PUCHAR)0x3ce,0x08); // set the mask
WRITE_PORT_UCHAR((PUCHAR)0x3cf,maskbit[x]);
initial = bitmap;
for(i=y; i<y+dy; i++)
{
a = READ_REGISTER_UCHAR(vidmem + offset);
WRITE_REGISTER_UCHAR(vidmem + offset, *bitmap);
offset+=80;
bitmap+=dx;
}
bitmap = initial + dx;
}
return TRUE;
}