VOID
VGADDI_BltPointerToVGA(ULONG StartX, ULONG StartY, ULONG SizeX,
- ULONG SizeY, PUCHAR MaskBits, ULONG MaskOp)
+ ULONG SizeY, PUCHAR MaskBits, ULONG MaskPitch, ULONG MaskOp)
{
ULONG EndX, EndY;
UCHAR Mask;
PUCHAR Video;
PUCHAR Src;
- ULONG MaskPitch;
UCHAR SrcValue;
ULONG i, j;
ULONG Left;
EndX = StartX + SizeX;
EndY = StartY + SizeY;
- MaskPitch = SizeX >> 3;
/* Set write mode zero. */
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 5);
VGADDI_HideCursor(PPDEV ppdev)
{
ULONG i, j, cx, cy, bitpos;
- ULONG SizeX;
+ ULONG SizeX, SizeY;
/* Display what was behind cursor */
- SizeX = ((oldx + ppdev->pPointerAttributes->Width) + 7) & ~0x7;
+ SizeX = min(((oldx + ppdev->pPointerAttributes->Width) + 7) & ~0x7, ppdev->sizeSurf.cx);
SizeX -= (oldx & ~0x7);
+ SizeY = min(ppdev->pPointerAttributes->Height, ppdev->sizeSurf.cy - oldy);
VGADDI_BltFromSavedScreenBits(oldx & ~0x7,
oldy,
ImageBehindCursor,
SizeX,
- ppdev->pPointerAttributes->Height);
+ SizeY);
ppdev->pPointerAttributes->Enable = 0;
}
VGADDI_ShowCursor(PPDEV ppdev)
{
ULONG i, j, cx, cy;
- PUCHAR XorMask;
- ULONG SizeX;
+ PUCHAR AndMask, XorMask;
+ ULONG SizeX, SizeY;
if (ppdev->pPointerAttributes->Enable != 0)
{
cy = ppdev->xyCursor.y;
/* Used to repaint background */
- SizeX = ((cx + ppdev->pPointerAttributes->Width) + 7) & ~0x7;
+ SizeX = min(((cx + ppdev->pPointerAttributes->Width) + 7) & ~0x7, ppdev->sizeSurf.cx);
SizeX -= (cx & ~0x7);
+ SizeY = min(ppdev->pPointerAttributes->Height, ppdev->sizeSurf.cy - cy);
VGADDI_BltToSavedScreenBits(ImageBehindCursor,
cx & ~0x7,
cy,
SizeX,
- ppdev->pPointerAttributes->Height);
+ SizeY);
/* Display the cursor. */
- XorMask = ppdev->pPointerAttributes->Pixels +
- ppdev->pPointerAttributes->WidthInBytes *
- ppdev->pPointerAttributes->Height;
+ SizeX = min(ppdev->pPointerAttributes->Width, ppdev->sizeSurf.cx - ppdev->xyCursor.x);
+ SizeY = min(ppdev->pPointerAttributes->Height, ppdev->sizeSurf.cy - ppdev->xyCursor.y);
+ AndMask = ppdev->pPointerAttributes->Pixels +
+ (ppdev->pPointerAttributes->Height - SizeY) * ppdev->pPointerAttributes->WidthInBytes;
VGADDI_BltPointerToVGA(ppdev->xyCursor.x,
ppdev->xyCursor.y,
- ppdev->pPointerAttributes->Width,
- ppdev->pPointerAttributes->Height,
- ppdev->pPointerAttributes->Pixels,
+ SizeX,
+ SizeY,
+ AndMask,
+ ppdev->pPointerAttributes->WidthInBytes,
VGA_AND);
+ XorMask = AndMask +
+ ppdev->pPointerAttributes->WidthInBytes *
+ ppdev->pPointerAttributes->Height;
VGADDI_BltPointerToVGA(ppdev->xyCursor.x,
ppdev->xyCursor.y,
- ppdev->pPointerAttributes->Width,
- ppdev->pPointerAttributes->Height,
+ SizeX,
+ SizeY,
XorMask,
+ ppdev->pPointerAttributes->WidthInBytes,
VGA_XOR);
/* Save the new cursor location. */