X-Git-Url: http://git.jankratochvil.net/?p=reactos.git;a=blobdiff_plain;f=drivers%2Fdd%2Fvga%2Fdisplay%2Fobjects%2Fpointer.c;fp=drivers%2Fdd%2Fvga%2Fdisplay%2Fobjects%2Fpointer.c;h=c5194f2771fcb0b694b6ab195bae01e0de70ffdf;hp=724bfd68374e3a3b215c4ae60cb327cb98388eff;hb=7c0cf90e3b750f1f0dc83b2eec9e5c68a512c30f;hpb=ee8b63255465d8c28be3e7bd11628015708fc1ab diff --git a/drivers/dd/vga/display/objects/pointer.c b/drivers/dd/vga/display/objects/pointer.c index 724bfd6..c5194f2 100644 --- a/drivers/dd/vga/display/objects/pointer.c +++ b/drivers/dd/vga/display/objects/pointer.c @@ -39,13 +39,12 @@ VOID VGADDI_ShowCursor(PPDEV ppdev); 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; @@ -53,7 +52,6 @@ VGADDI_BltPointerToVGA(ULONG StartX, ULONG StartY, ULONG SizeX, EndX = StartX + SizeX; EndY = StartY + SizeY; - MaskPitch = SizeX >> 3; /* Set write mode zero. */ WRITE_PORT_UCHAR((PUCHAR)GRA_I, 5); @@ -289,16 +287,17 @@ VOID 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; } @@ -307,8 +306,8 @@ VOID VGADDI_ShowCursor(PPDEV ppdev) { ULONG i, j, cx, cy; - PUCHAR XorMask; - ULONG SizeX; + PUCHAR AndMask, XorMask; + ULONG SizeX, SizeY; if (ppdev->pPointerAttributes->Enable != 0) { @@ -320,30 +319,37 @@ VGADDI_ShowCursor(PPDEV ppdev) 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. */