- Fixed algorithm for 4BPP bitblts with ROP != SRCCOPY

- Minor coordinate correction for software mouse pointer emulation

svn path=/trunk/; revision=8087
This commit is contained in:
Filip Navara 2004-02-08 09:27:39 +00:00
parent 2a78934eed
commit 2535445a70
2 changed files with 83 additions and 65 deletions

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: dib4bpp.c,v 1.22 2003/12/08 18:05:30 fireball Exp $ */ /* $Id: dib4bpp.c,v 1.23 2004/02/08 09:27:39 navaraf Exp $ */
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <stdlib.h> #include <stdlib.h>
@ -239,7 +239,7 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
PBRUSHOBJ Brush, PPOINTL BrushOrigin, PBRUSHOBJ Brush, PPOINTL BrushOrigin,
XLATEOBJ *ColorTranslation, ULONG Rop4) XLATEOBJ *ColorTranslation, ULONG Rop4)
{ {
LONG i, j, k, sx, sy; LONG i, j, sx, sy;
ULONG Dest, Source, Pattern; ULONG Dest, Source, Pattern;
PULONG DestBits; PULONG DestBits;
BOOL UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000); BOOL UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
@ -273,21 +273,42 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
{ {
sy = SourcePoint->y; sy = SourcePoint->y;
for (j=DestRect->top; j<DestRect->bottom; j++) for (j = DestRect->top; j < DestRect->bottom; j++, sy++)
{ {
DestBits = (PULONG)(DestSurf->pvScan0 + (DestRect->left >> 1) + j * DestSurf->lDelta);
sx = SourcePoint->x; sx = SourcePoint->x;
DestBits = (PULONG)(DestSurf->pvScan0 + (DestRect->left>>1) + j * DestSurf->lDelta);
for (i=DestRect->left; i<RoundedRight; i+=8, DestBits++) /* Process all pixels on the left that aren't DWORD aligned */
for (i = DestRect->left; i & 0x7; i++, sx++)
{
Dest = DIB_4BPP_GetPixel(DestSurf, i, j);
if (UsesSource)
{
Source = DIB_GetSource(SourceSurf, SourceGDI, sx, sy, ColorTranslation);
}
if (UsesPattern)
{
/* FIXME: No support for pattern brushes. */
Pattern = ExpandSolidColor[Brush->iSolidColor & 0xF];
}
DIB_4BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF);
}
/* Process all DWORD aligned pixels */
for (; i < RoundedRight; i += 8, sx += 8, DestBits++)
{ {
Dest = *DestBits; Dest = *DestBits;
if (UsesSource) if (UsesSource)
{ {
Source = 0; Source =
for (k = 0; k < 8; k += 2) (DIB_GetSource(SourceSurf, SourceGDI, sx + 1, sy, ColorTranslation)) |
{ (DIB_GetSource(SourceSurf, SourceGDI, sx + 0, sy, ColorTranslation) << 4) |
Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << ((k + 1) * 4)) (DIB_GetSource(SourceSurf, SourceGDI, sx + 3, sy, ColorTranslation) << 8) |
| (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k + 1, sy, ColorTranslation) << (k * 4)); (DIB_GetSource(SourceSurf, SourceGDI, sx + 2, sy, ColorTranslation) << 12) |
} (DIB_GetSource(SourceSurf, SourceGDI, sx + 5, sy, ColorTranslation) << 16) |
(DIB_GetSource(SourceSurf, SourceGDI, sx + 4, sy, ColorTranslation) << 20) |
(DIB_GetSource(SourceSurf, SourceGDI, sx + 7, sy, ColorTranslation) << 24) |
(DIB_GetSource(SourceSurf, SourceGDI, sx + 6, sy, ColorTranslation) << 28);
} }
if (UsesPattern) if (UsesPattern)
{ {
@ -296,14 +317,14 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
} }
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern); *DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
} }
if (i < DestRect->right)
{ /* Process the rest of pixel on the line */
Dest = *DestBits; for (; i < DestRect->right; i++, sx++)
for (; i < DestRect->right; i++)
{ {
Dest = DIB_4BPP_GetPixel(DestSurf, i, j);
if (UsesSource) if (UsesSource)
{ {
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left), sy, ColorTranslation); Source = DIB_GetSource(SourceSurf, SourceGDI, sx, sy, ColorTranslation);
} }
if (UsesPattern) if (UsesPattern)
{ {
@ -311,11 +332,8 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
Pattern = ExpandSolidColor[Brush->iSolidColor & 0xF]; Pattern = ExpandSolidColor[Brush->iSolidColor & 0xF];
} }
DIB_4BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF); DIB_4BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF);
Dest >>= 4;
} }
} }
sy++;
}
} }
return TRUE; return TRUE;
} }

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: mouse.c,v 1.59 2004/02/06 21:12:55 navaraf Exp $ /* $Id: mouse.c,v 1.60 2004/02/08 09:27:39 navaraf Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* PURPOSE: Mouse * PURPOSE: Mouse
@ -566,10 +566,10 @@ IntHideMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface)
DestRect.top = max(ppdev->PointerAttributes.Row, 0); DestRect.top = max(ppdev->PointerAttributes.Row, 0);
DestRect.right = min( DestRect.right = min(
ppdev->PointerAttributes.Column + ppdev->PointerAttributes.Width, ppdev->PointerAttributes.Column + ppdev->PointerAttributes.Width,
DestSurface->sizlBitmap.cx - 1); DestSurface->sizlBitmap.cx);
DestRect.bottom = min( DestRect.bottom = min(
ppdev->PointerAttributes.Row + ppdev->PointerAttributes.Height, ppdev->PointerAttributes.Row + ppdev->PointerAttributes.Height,
DestSurface->sizlBitmap.cy - 1); DestSurface->sizlBitmap.cy);
SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0); SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0);
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0); SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);
@ -610,10 +610,10 @@ IntShowMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface)
DestRect.top = SrcPoint.y - ppdev->PointerAttributes.Row; DestRect.top = SrcPoint.y - ppdev->PointerAttributes.Row;
DestRect.right = min( DestRect.right = min(
ppdev->PointerAttributes.Width, ppdev->PointerAttributes.Width,
DestSurface->sizlBitmap.cx - ppdev->PointerAttributes.Column - 1); DestSurface->sizlBitmap.cx - ppdev->PointerAttributes.Column);
DestRect.bottom = min( DestRect.bottom = min(
ppdev->PointerAttributes.Height, ppdev->PointerAttributes.Height,
DestSurface->sizlBitmap.cy - ppdev->PointerAttributes.Row - 1); DestSurface->sizlBitmap.cy - ppdev->PointerAttributes.Row);
SaveSurface = EngLockSurface(ppdev->PointerSaveSurface); SaveSurface = EngLockSurface(ppdev->PointerSaveSurface);
EngBitBlt(SaveSurface, DestSurface, NULL, NULL, NULL, EngBitBlt(SaveSurface, DestSurface, NULL, NULL, NULL,
@ -635,10 +635,10 @@ IntShowMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface)
DestRect.top = max(ppdev->PointerAttributes.Row, 0); DestRect.top = max(ppdev->PointerAttributes.Row, 0);
DestRect.right = min( DestRect.right = min(
ppdev->PointerAttributes.Column + ppdev->PointerAttributes.Width, ppdev->PointerAttributes.Column + ppdev->PointerAttributes.Width,
DestSurface->sizlBitmap.cx - 1); DestSurface->sizlBitmap.cx);
DestRect.bottom = min( DestRect.bottom = min(
ppdev->PointerAttributes.Row + ppdev->PointerAttributes.Height, ppdev->PointerAttributes.Row + ppdev->PointerAttributes.Height,
DestSurface->sizlBitmap.cy - 1); DestSurface->sizlBitmap.cy);
SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0); SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0);
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0); SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);