- Handle correctly bottom-up surfaces in the VGA driver.

svn path=/trunk/; revision=9976
This commit is contained in:
Filip Navara 2004-07-03 13:45:42 +00:00
parent 40afa3d500
commit ac183abd23
4 changed files with 13 additions and 10 deletions

View file

@ -77,7 +77,7 @@ VGAtoDIB(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation,
// 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)
GDIpos = Dest->pvBits /* + (DestRect->top * Dest->lDelta) + (DestRect->left >> 1) */ ; GDIpos = Dest->pvScan0 /* + (DestRect->top * Dest->lDelta) + (DestRect->left >> 1) */ ;
dx = DestRect->right - DestRect->left; dx = DestRect->right - DestRect->left;
dy = DestRect->bottom - DestRect->top; dy = DestRect->bottom - DestRect->top;
@ -87,7 +87,7 @@ VGAtoDIB(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation,
DestDevSurf.NextScan = Dest->lDelta; DestDevSurf.NextScan = Dest->lDelta;
DestDevSurf.StartBmp = Dest->pvScan0; DestDevSurf.StartBmp = Dest->pvScan0;
DIB_BltFromVGA(SourcePoint->x, SourcePoint->y, dx, dy, Dest->pvBits, Dest->lDelta); DIB_BltFromVGA(SourcePoint->x, SourcePoint->y, dx, dy, Dest->pvScan0, Dest->lDelta);
} else { } else {
// Color translation // Color translation
@ -353,7 +353,7 @@ VGADDI_BltMask(SURFOBJ* Dest, SURFOBJ* Source, SURFOBJ* Mask,
{ {
if (Mask != NULL) if (Mask != NULL)
{ {
tMask = Mask->pvBits; tMask = Mask->pvScan0;
for (j=0; j<dy; j++) for (j=0; j<dy; j++)
{ {
lMask = tMask; lMask = tMask;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: pointer.c,v 1.2 2004/01/16 13:18:23 gvg Exp $ /* $Id: pointer.c,v 1.3 2004/07/03 13:45:42 navaraf Exp $
* *
* PROJECT: ReactOS VGA16 display driver * PROJECT: ReactOS VGA16 display driver
* FILE: drivers/dd/vga/display/objects/pointer.c * FILE: drivers/dd/vga/display/objects/pointer.c
@ -245,8 +245,8 @@ DrvSetPointerShape(SURFOBJ* pso,
} }
ppdev->flCursor = ppdev->flCursor & (~ CURSOR_DOWN); ppdev->flCursor = ppdev->flCursor & (~ CURSOR_DOWN);
NewWidth = psoMask->lDelta << 3; NewWidth = abs(psoMask->lDelta) << 3;
NewHeight = (psoMask->cjBits / psoMask->lDelta) / 2; NewHeight = (psoMask->cjBits / abs(psoMask->lDelta)) / 2;
/* Reallocate the space for the cursor if necessary. */ /* Reallocate the space for the cursor if necessary. */
if (ppdev->pPointerAttributes->Width != NewWidth || if (ppdev->pPointerAttributes->Width != NewWidth ||
@ -275,11 +275,10 @@ DrvSetPointerShape(SURFOBJ* pso,
ImageBehindCursor = VGADDI_AllocSavedScreenBits(SavedMemSize); ImageBehindCursor = VGADDI_AllocSavedScreenBits(SavedMemSize);
} }
Src = (PUCHAR)psoMask->pvScan0;
/* Copy the new cursor in. */ /* Copy the new cursor in. */
for (i = 0; i < (NewHeight * 2); i++) for (i = 0; i < (NewHeight * 2); i++)
{ {
Src = (PUCHAR)psoMask->pvBits;
Src += (i * (NewWidth >> 3));
Dest = (PUCHAR)ppdev->pPointerAttributes->Pixels; Dest = (PUCHAR)ppdev->pPointerAttributes->Pixels;
if (i >= NewHeight) if (i >= NewHeight)
{ {
@ -290,6 +289,7 @@ DrvSetPointerShape(SURFOBJ* pso,
Dest += ((NewHeight - i - 1) * (NewWidth >> 3)); Dest += ((NewHeight - i - 1) * (NewWidth >> 3));
} }
memcpy(Dest, Src, NewWidth >> 3); memcpy(Dest, Src, NewWidth >> 3);
Src += psoMask->lDelta;
} }
/* Set the new cursor position */ /* Set the new cursor position */

View file

@ -28,7 +28,7 @@ DrvTransparentBlt(SURFOBJ* Dest,
if(sy<dy) dy = sy; if(sy<dy) dy = sy;
// FIXME: adjust using SourceRect // FIXME: adjust using SourceRect
DIB_TransparentBltToVGA(DestRect->left, DestRect->top, dx, dy, Source->pvBits, Source->lDelta, TransparentColor); DIB_TransparentBltToVGA(DestRect->left, DestRect->top, dx, dy, Source->pvScan0, Source->lDelta, TransparentColor);
return TRUE; return TRUE;
} }

View file

@ -407,7 +407,10 @@ void DIB_BltFromVGA(int x, int y, int w, int h, void *b, int Dest_lDelta)
} }
/* Reset the destination. */ /* Reset the destination. */
memset(b, 0, h * Dest_lDelta); for (j = 0; j < h; j++)
{
memset(b + (j * Dest_lDelta), 0, abs(Dest_lDelta));
}
for (plane = 0; plane < 4; plane++) for (plane = 0; plane < 4; plane++)
{ {