mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Correct palette info. Initial support for bitblt masks
svn path=/trunk/; revision=1858
This commit is contained in:
parent
6be44d6e81
commit
69a45c48b1
6 changed files with 126 additions and 43 deletions
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
* entry.c
|
||||
*
|
||||
* $Revision: 1.11 $
|
||||
* $Revision: 1.12 $
|
||||
* $Author: jfilby $
|
||||
* $Date: 2001/03/31 15:40:33 $
|
||||
* $Date: 2001/05/02 12:29:07 $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -48,6 +48,10 @@ VOID VGADDIMovePointer(PSURFOBJ pso, LONG x, LONG y, PRECTL prcl);
|
|||
ULONG VGADDISetPointerShape(PSURFOBJ pso, PSURFOBJ psoMask, PSURFOBJ psoColor, PXLATEOBJ pxlo,
|
||||
LONG xHot, LONG yHot, LONG x, LONG y,
|
||||
PRECTL prcl, ULONG fl);
|
||||
BOOL VGADDITransparentBlt(PSURFOBJ Dest, PSURFOBJ Source,
|
||||
PCLIPOBJ Clip, PXLATEOBJ ColorTranslation,
|
||||
PRECTL DestRect, PRECTL SourceRect,
|
||||
ULONG TransparentColor, ULONG Reserved);
|
||||
|
||||
DRVFN FuncList[] =
|
||||
{
|
||||
|
@ -62,6 +66,7 @@ DRVFN FuncList[] =
|
|||
{INDEX_DrvLineTo, (PFN) VGADDILineTo},
|
||||
{INDEX_DrvPaint, (PFN) VGADDIPaint},
|
||||
{INDEX_DrvBitBlt, (PFN) VGADDIBitBlt},
|
||||
{INDEX_DrvTransparentBlt, (PFN) VGADDITransparentBlt},
|
||||
{INDEX_DrvMovePointer, (PFN) VGADDIMovePointer},
|
||||
{INDEX_DrvSetPointerShape, (PFN) VGADDISetPointerShape},
|
||||
|
||||
|
@ -387,7 +392,8 @@ HSURF VGADDIEnableSurface(IN DHPDEV PDev)
|
|||
|
||||
InitSavedBits(ppdev);
|
||||
|
||||
if (EngAssociateSurface(hsurf, ppdev->GDIDevHandle, HOOK_BITBLT | HOOK_PAINT | HOOK_LINETO | HOOK_COPYBITS))
|
||||
if (EngAssociateSurface(hsurf, ppdev->GDIDevHandle, HOOK_BITBLT | HOOK_PAINT | HOOK_LINETO | HOOK_COPYBITS |
|
||||
HOOK_TRANSPARENTBLT))
|
||||
{
|
||||
EngDebugPrint("VGADDI:", "Successfully associated surface\n", 0);
|
||||
ppdev->SurfHandle = hsurf;
|
||||
|
|
|
@ -77,23 +77,22 @@ const VGALOGPALETTE VGApalette =
|
|||
0x400, // driver version
|
||||
16, // num entries
|
||||
{
|
||||
{ 0, 0, 0, 0 }, // 0
|
||||
{ 0x80,0, 0, 0 }, // 1
|
||||
{ 0, 0x80,0, 0 }, // 2
|
||||
{ 0x80,0x80,0, 0 }, // 3
|
||||
{ 0, 0, 0x80,0 }, // 4
|
||||
{ 0x80,0, 0x80,0 }, // 5
|
||||
{ 0, 0x80,0x80,0 }, // 6
|
||||
{ 0x80,0x80,0x80,0 }, // 7
|
||||
|
||||
{ 0xC0,0xC0,0xC0,0 }, // 8
|
||||
{ 0xFF,0, 0, 0 }, // 9
|
||||
{ 0, 0xFF,0, 0 }, // 10
|
||||
{ 0xFF,0xFF,0, 0 }, // 11
|
||||
{ 0, 0, 0xFF,0 }, // 12
|
||||
{ 0xFF,0, 0xFF,0 }, // 13
|
||||
{ 0, 0xFF,0xFF,0 }, // 14
|
||||
{ 0xFF,0xFF,0xFF,0 } // 15
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // 0
|
||||
{ 0x80, 0x00, 0x00, 0x00 }, // 1
|
||||
{ 0x00, 0x80, 0x00, 0x00 }, // 2
|
||||
{ 0x80, 0x80, 0x00, 0x00 }, // 3
|
||||
{ 0x00, 0x00, 0x80, 0x00 }, // 4
|
||||
{ 0x80, 0x00, 0x80, 0x00 }, // 5
|
||||
{ 0x00, 0x80, 0x80, 0x00 }, // 6
|
||||
{ 0x80, 0x80, 0x80, 0x00 }, // 7
|
||||
{ 0xc0, 0xc0, 0xc0, 0x00 }, // 8
|
||||
{ 0xff, 0x00, 0x00, 0x00 }, // 9
|
||||
{ 0x00, 0xff, 0x00, 0x00 }, // 10
|
||||
{ 0xff, 0xff, 0x00, 0x00 }, // 11
|
||||
{ 0x00, 0x00, 0xff, 0x00 }, // 12
|
||||
{ 0xff, 0x00, 0xff, 0x00 }, // 13
|
||||
{ 0x00, 0xff, 0xff, 0x00 }, // 14
|
||||
{ 0xff, 0xff, 0xff, 0x00 } // 15
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.13 2000/11/20 19:59:11 ekohl Exp $
|
||||
# $Id: makefile,v 1.14 2001/05/02 12:29:07 jfilby Exp $
|
||||
#
|
||||
# Makefile for ReactOS vgaddi.dll
|
||||
#
|
||||
|
@ -21,7 +21,7 @@ all: $(DLLTARGET)
|
|||
|
||||
MAIN_OBJECTS = main/enable.o
|
||||
OTHER_OBJECTS = objects/screen.o objects/pointer.o objects/lineto.o objects/paint.o objects/bitblt.o \
|
||||
vgavideo/vgavideo.o
|
||||
vgavideo/vgavideo.o objects/transblt.o
|
||||
RESOURCE_OBJECTS = $(TARGET).coff
|
||||
|
||||
OBJECTS = $(MAIN_OBJECTS) $(OTHER_OBJECTS) $(RESOURCE_OBJECTS)
|
||||
|
|
|
@ -12,17 +12,21 @@
|
|||
// Note: All of our BitBlt ops expect to be working with 4BPP data
|
||||
|
||||
typedef BOOL (*PFN_VGABlt)(SURFOBJ *, SURFOBJ *, SURFOBJ *, XLATEOBJ *,
|
||||
RECTL *, POINTL *);
|
||||
RECTL *, POINTL *, POINTL *,
|
||||
BRUSHOBJ *, POINTL *, ROP4);
|
||||
|
||||
BOOL DIBtoVGA(
|
||||
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
||||
RECTL *DestRect, POINTL *SourcePoint)
|
||||
RECTL *DestRect, POINTL *SourcePoint, POINTL *MaskPoint,
|
||||
BRUSHOBJ *Brush, POINTL *BrushPoint, ROP4 rop4)
|
||||
{
|
||||
LONG i, j, dx, dy, alterx, altery, idxColor, RGBulong = 0;
|
||||
BYTE *GDIpos, *initial;
|
||||
LONG i, j, dx, dy, alterx, altery, idxColor, RGBulong = 0, c8;
|
||||
BYTE *GDIpos, *initial, *tMask, *lMask;
|
||||
|
||||
GDIpos = Source->pvBits /* +
|
||||
SourcePoint->y * Source->lDelta + (SourcePoint->x >> 1) */ ;
|
||||
if(Source != NULL) {
|
||||
GDIpos = Source->pvBits /* +
|
||||
SourcePoint->y * Source->lDelta + (SourcePoint->x >> 1) */ ;
|
||||
}
|
||||
|
||||
dx = DestRect->right - DestRect->left;
|
||||
dy = DestRect->bottom - DestRect->top;
|
||||
|
@ -35,8 +39,28 @@ BOOL DIBtoVGA(
|
|||
if(ColorTranslation == NULL)
|
||||
{
|
||||
|
||||
// No color translation necessary, we assume BPP = 1
|
||||
DIB_BltToVGA(DestRect->left, DestRect->top, dx, dy, Source->pvBits, Source->lDelta);
|
||||
if(Mask != NULL)
|
||||
{
|
||||
if(rop4 == 0xAACC) { // no source, just paint the brush according to the mask
|
||||
|
||||
tMask = Mask->pvBits;
|
||||
for (j=0; j<dy; j++)
|
||||
{
|
||||
lMask = tMask;
|
||||
c8 = 0;
|
||||
for (i=0; i<dx; i++)
|
||||
{
|
||||
if((*lMask & maskbit[c8]) != 0)
|
||||
vgaPutPixel(DestRect->left + i, DestRect->top + j, Brush->iSolidColor);
|
||||
c8++;
|
||||
if(c8 == 8) { lMask++; c8=0; }
|
||||
}
|
||||
tMask += Mask->lDelta;
|
||||
}
|
||||
|
||||
}
|
||||
} else
|
||||
DIB_BltToVGA(DestRect->left, DestRect->top, dx, dy, Source->pvBits, Source->lDelta);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -58,7 +82,8 @@ BOOL DIBtoVGA(
|
|||
|
||||
BOOL VGAtoDIB(
|
||||
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
||||
RECTL *DestRect, POINTL *SourcePoint)
|
||||
RECTL *DestRect, POINTL *SourcePoint, POINTL *MaskPoint,
|
||||
BRUSHOBJ *Brush, POINTL *BrushPoint, ROP4 rop4)
|
||||
{
|
||||
LONG i, j, dx, dy, RGBulong;
|
||||
BYTE *GDIpos, *initial, idxColor;
|
||||
|
@ -102,21 +127,24 @@ BOOL VGAtoDIB(
|
|||
|
||||
BOOL DFBtoVGA(
|
||||
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
||||
RECTL *DestRect, POINTL *SourcePoint)
|
||||
RECTL *DestRect, POINTL *SourcePoint, POINTL *MaskPoint,
|
||||
BRUSHOBJ *Brush, POINTL *BrushPoint, ROP4 rop4)
|
||||
{
|
||||
// Do DFBs need color translation??
|
||||
}
|
||||
|
||||
BOOL VGAtoDFB(
|
||||
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
||||
RECTL *DestRect, POINTL *SourcePoint)
|
||||
RECTL *DestRect, POINTL *SourcePoint, POINTL *MaskPoint,
|
||||
BRUSHOBJ *Brush, POINTL *BrushPoint, ROP4 rop4)
|
||||
{
|
||||
// Do DFBs need color translation??
|
||||
}
|
||||
|
||||
BOOL VGAtoVGA(
|
||||
SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask, XLATEOBJ *ColorTranslation,
|
||||
RECTL *DestRect, POINTL *SourcePoint)
|
||||
RECTL *DestRect, POINTL *SourcePoint, POINTL *MaskPoint,
|
||||
BRUSHOBJ *Brush, POINTL *BrushPoint, ROP4 rop4)
|
||||
{
|
||||
// FIXME: Use fast blts instead of get and putpixels
|
||||
|
||||
|
@ -180,38 +208,45 @@ BOOL VGADDIBitBlt(SURFOBJ *Dest, SURFOBJ *Source, SURFOBJ *Mask,
|
|||
RECT_ENUM RectEnum;
|
||||
BOOL EnumMore;
|
||||
PFN_VGABlt BltOperation;
|
||||
ULONG SourceType;
|
||||
|
||||
if(Source == NULL)
|
||||
{
|
||||
SourceType = STYPE_BITMAP;
|
||||
} else
|
||||
SourceType = Source->iType;
|
||||
|
||||
DPRINT("VGADDIBitBlt: Dest->pvScan0: %08x\n", Dest->pvScan0);
|
||||
|
||||
// Determine the bltbit operation
|
||||
|
||||
if((Source->iType == STYPE_BITMAP) && (Dest->iType == STYPE_DEVICE))
|
||||
if((SourceType == STYPE_BITMAP) && (Dest->iType == STYPE_DEVICE))
|
||||
{
|
||||
DPRINT("DIB2VGA\n");
|
||||
BltOperation = DIBtoVGA;
|
||||
} else
|
||||
if((Source->iType == STYPE_DEVICE) && (Dest->iType == STYPE_BITMAP))
|
||||
if((SourceType == STYPE_DEVICE) && (Dest->iType == STYPE_BITMAP))
|
||||
{
|
||||
DPRINT("VGA2DIB\n");
|
||||
BltOperation = VGAtoDIB;
|
||||
} else
|
||||
if((Source->iType == STYPE_DEVICE) && (Dest->iType == STYPE_DEVICE))
|
||||
if((SourceType == STYPE_DEVICE) && (Dest->iType == STYPE_DEVICE))
|
||||
{
|
||||
DPRINT("VGA2VGA\n");
|
||||
BltOperation = VGAtoVGA;
|
||||
} else
|
||||
if((Source->iType == STYPE_DEVBITMAP) && (Dest->iType == STYPE_DEVICE))
|
||||
if((SourceType == STYPE_DEVBITMAP) && (Dest->iType == STYPE_DEVICE))
|
||||
{
|
||||
DPRINT("DFB2VGA\n");
|
||||
BltOperation = DFBtoVGA;
|
||||
} else
|
||||
if((Source->iType == STYPE_DEVICE) && (Dest->iType == STYPE_DEVBITMAP))
|
||||
if((SourceType == STYPE_DEVICE) && (Dest->iType == STYPE_DEVBITMAP))
|
||||
{
|
||||
DPRINT("VGA2DFB\n");
|
||||
BltOperation = VGAtoDFB;
|
||||
} else
|
||||
{
|
||||
DPRINT("VGA:bitblt.c: Can't handle requested BitBlt operation (source:%u dest:%u)\n", Source->iType, Dest->iType);
|
||||
DPRINT("VGA:bitblt.c: Can't handle requested BitBlt operation (source:%u dest:%u)\n", SourceType, Dest->iType);
|
||||
// Cannot handle given surfaces for VGA BitBlt
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -221,7 +256,7 @@ DPRINT("VGA:bitblt.c: Can't handle requested BitBlt operation (source:%u dest:%u
|
|||
if(Clip == NULL)
|
||||
{
|
||||
BltOperation(Dest, Source, Mask, ColorTranslation, DestRect,
|
||||
SourcePoint);
|
||||
SourcePoint, MaskPoint, Brush, BrushPoint, rop4);
|
||||
} else
|
||||
{
|
||||
switch(Clip->iMode) {
|
||||
|
@ -233,7 +268,7 @@ DPRINT("VGA:bitblt.c: Can't handle requested BitBlt operation (source:%u dest:%u
|
|||
// FIXME: Intersect clip rectangle
|
||||
|
||||
BltOperation(Dest, Source, Mask, ColorTranslation,
|
||||
DestRect, SourcePoint);
|
||||
DestRect, SourcePoint, MaskPoint, Brush, BrushPoint, rop4);
|
||||
} else {
|
||||
|
||||
// Enumerate all the rectangles and draw them
|
||||
|
|
|
@ -13,7 +13,7 @@ BOOL VGADDILineTo(SURFOBJ *Surface, CLIPOBJ *Clip, BRUSHOBJ *Brush,
|
|||
ULONG x, y, d, i, length, xchange, ychange, error,
|
||||
iSolidColor, hx, vy;
|
||||
LONG deltax, deltay;
|
||||
|
||||
DbgPrint("drvlineto\n");
|
||||
iSolidColor = Brush->iSolidColor; // FIXME: Brush Realization...
|
||||
|
||||
// FIXME: Implement clipping
|
||||
|
|
|
@ -457,6 +457,49 @@ void DIB_BltToVGA(int x, int y, int w, int h, void *b, int Source_lDelta)
|
|||
}
|
||||
}
|
||||
|
||||
void DIB_TransparentBltToVGA(int x, int y, int w, int h, void *b, int Source_lDelta, ULONG trans)
|
||||
|
||||
// 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;
|
||||
if(b1 != trans) vgaPutPixel(i, j, b1);
|
||||
if(b2 != trans) vgaPutPixel(i+1, j, b2);
|
||||
pb++;
|
||||
}
|
||||
|
||||
if(edgePixel == TRUE)
|
||||
{
|
||||
b1 = *pb;
|
||||
if(b1 != trans) 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.
|
||||
|
|
Loading…
Reference in a new issue