From 77ef48e7051d3f838b2a4b0de66b39caee66bf6a Mon Sep 17 00:00:00 2001 From: Jason Filby Date: Fri, 16 Jun 2000 07:28:20 +0000 Subject: [PATCH] VGA display driver improvements svn path=/trunk/; revision=1184 --- reactos/drivers/dd/vga/display/main/enable.c | 5 +- .../drivers/dd/vga/display/objects/bitblt.c | 53 ++++++++++++++----- .../drivers/dd/vga/display/objects/lineto.c | 6 +++ .../dd/vga/display/vgavideo/vgavideo.c | 29 ++++++++++ 4 files changed, 78 insertions(+), 15 deletions(-) diff --git a/reactos/drivers/dd/vga/display/main/enable.c b/reactos/drivers/dd/vga/display/main/enable.c index e701836caa5..22f118ae516 100644 --- a/reactos/drivers/dd/vga/display/main/enable.c +++ b/reactos/drivers/dd/vga/display/main/enable.c @@ -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); diff --git a/reactos/drivers/dd/vga/display/objects/bitblt.c b/reactos/drivers/dd/vga/display/objects/bitblt.c index 3df191b8c92..c510a8f9744 100644 --- a/reactos/drivers/dd/vga/display/objects/bitblt.c +++ b/reactos/drivers/dd/vga/display/objects/bitblt.c @@ -28,19 +28,38 @@ BOOL GDItoVGA( alterx = abs(SourcePoint->x - DestRect->left); altery = abs(SourcePoint->y - DestRect->top); - for(j=SourcePoint->y; jy+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; ix+dx; i++) + for(j=SourcePoint->y; jy+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; ix+dx; i++) + { + vgaPutPixel(i+alterx, j+altery, *GDIpos); + GDIpos+=BPP; + } + GDIpos = initial + Source->lDelta; + } + } else { + // Perform color translation + for(j=SourcePoint->y; jy+dy; j++) + { + initial = GDIpos; + + for(i=SourcePoint->x; ix+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; jy+dy; j++) { initial = GDIpos; for(i=SourcePoint->x; ix+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; ix+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; } diff --git a/reactos/drivers/dd/vga/display/objects/lineto.c b/reactos/drivers/dd/vga/display/objects/lineto.c index 495c4235b42..b434b45232c 100644 --- a/reactos/drivers/dd/vga/display/objects/lineto.c +++ b/reactos/drivers/dd/vga/display/objects/lineto.c @@ -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 diff --git a/reactos/drivers/dd/vga/display/vgavideo/vgavideo.c b/reactos/drivers/dd/vga/display/vgavideo/vgavideo.c index f6db7acf35b..1c5304ea95d 100644 --- a/reactos/drivers/dd/vga/display/vgavideo/vgavideo.c +++ b/reactos/drivers/dd/vga/display/vgavideo/vgavideo.c @@ -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