mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 12:23:14 +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 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -166,7 +166,6 @@ DHPDEV VGADDIEnablePDEV(IN DEVMODEW *DM,
|
||||||
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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -225,13 +223,7 @@ VOID VGADDIAssertMode(IN DHPDEV DPev,
|
||||||
} 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;
|
||||||
|
|
|
@ -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))
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ 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);
|
||||||
|
@ -112,7 +112,7 @@ void vgaShowCursor(PPDEV ppdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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);
|
||||||
|
|
|
@ -89,15 +89,13 @@ DWORD getAvailableModes(HANDLE Driver,
|
||||||
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;
|
||||||
|
|
|
@ -68,13 +68,10 @@ typedef struct _PDEV
|
||||||
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
|
SIZEL sizeSurf; // displayed size of the surface
|
||||||
|
|
||||||
PBYTE fbScreen; // pointer to the frame buffer
|
PBYTE fbScreen; // pointer to the frame buffer
|
||||||
|
|
||||||
RECTL SavedBitsRight; // invisible part right of screen
|
RECTL SavedBitsRight; // invisible part right of screen
|
||||||
RECTL SavedBitsBottom; // invisible part at the bottom of the screen
|
RECTL SavedBitsBottom; // invisible part at the bottom of the screen
|
||||||
BOOL BitsSaved; // TRUE if bits are currently saved
|
BOOL BitsSaved; // TRUE if bits are currently saved
|
||||||
|
@ -172,7 +169,6 @@ typedef struct _DEVSURF
|
||||||
// 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 BankBufferPlane1; // Like above, but for plane 1
|
||||||
PVOID BankBufferPlane2; // Like above, but for plane 2
|
PVOID BankBufferPlane2; // Like above, but for plane 2
|
||||||
PVOID BankBufferPlane3; // Like above, but for plane 3
|
PVOID BankBufferPlane3; // Like above, but for plane 3
|
||||||
|
|
|
@ -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>
|
||||||
|
@ -360,7 +372,95 @@ BOOL VGADDIIntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BltFromVGA(int x, int y, int w, int h, void *b, int bw)
|
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 *vp, *vpY, *vpP;
|
||||||
unsigned char data, mask, maskP;
|
unsigned char data, mask, maskP;
|
||||||
|
@ -372,19 +472,21 @@ void BltFromVGA(int x, int y, int w, int h, void *b, int bw)
|
||||||
ASSIGNVP4(x, y, vpP)
|
ASSIGNVP4(x, y, vpP)
|
||||||
ASSIGNMK4(x, y, maskP)
|
ASSIGNMK4(x, y, maskP)
|
||||||
get_masks(x, w);
|
get_masks(x, w);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); /* read mode 0 */
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x05); // read mode 0
|
||||||
saved_GC_mode = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
saved_GC_mode = 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, 0x04); /* read map select */
|
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x04); // read map select
|
||||||
saved_GC_rmap = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
saved_GC_rmap = READ_PORT_UCHAR((PUCHAR)GRA_D);
|
||||||
/* clear buffer */
|
|
||||||
|
// clear buffer
|
||||||
bp=b;
|
bp=b;
|
||||||
for (j=h; j>0; j--) {
|
for (j=h; j>0; j--) {
|
||||||
memset(bp, 0, w);
|
memset(bp, 0, w);
|
||||||
bp += bw;
|
bp += bw;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (plane=0, plane_mask=1; plane<4; plane++, plane_mask<<=1) {
|
for (plane=0, plane_mask=1; plane<4; plane++, plane_mask<<=1) {
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, plane); /* read map select */
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, plane); // read map select
|
||||||
vpY = vpP;
|
vpY = vpP;
|
||||||
bpY = b;
|
bpY = b;
|
||||||
for (j=h; j>0; j--) {
|
for (j=h; j>0; j--) {
|
||||||
|
@ -434,14 +536,18 @@ void BltFromVGA(int x, int y, int w, int h, void *b, int bw)
|
||||||
vpY += byte_per_line;
|
vpY += byte_per_line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* reset GC register */
|
|
||||||
|
// reset GC register
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_rmap);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, saved_GC_rmap);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BltToVGA(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 *bp, *bpX;
|
unsigned char *bp, *bpX;
|
||||||
unsigned char *vp, *vpX;
|
unsigned char *vp, *vpX;
|
||||||
|
@ -454,20 +560,22 @@ void BltToVGA(int x, int y, int w, int h, void *b, int bw)
|
||||||
ASSIGNVP4(x, y, vpX)
|
ASSIGNVP4(x, y, vpX)
|
||||||
ASSIGNMK4(x, y, mask)
|
ASSIGNMK4(x, y, mask)
|
||||||
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);
|
||||||
|
|
||||||
for (i=w; i>0; i--) {
|
for (i=w; i>0; i--) {
|
||||||
WRITE_PORT_UCHAR((PUCHAR)GRA_D, mask);
|
WRITE_PORT_UCHAR((PUCHAR)GRA_D, mask);
|
||||||
bp = bpX;
|
bp = bpX;
|
||||||
vp = vpX;
|
vp = vpX;
|
||||||
for (j=h; j>0; j--) {
|
for (j=h; j>0; j--) {
|
||||||
dummy = *vp; *vp = *bp;
|
dummy = *vp;
|
||||||
|
*vp = *bp;
|
||||||
bp += bw;
|
bp += bw;
|
||||||
vp += byte_per_line;
|
vp += byte_per_line;
|
||||||
}
|
}
|
||||||
|
@ -477,7 +585,8 @@ void BltToVGA(int x, int y, int w, int h, void *b, int bw)
|
||||||
mask = 0x80;
|
mask = 0x80;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue