mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
- 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:
parent
2a78934eed
commit
2535445a70
2 changed files with 83 additions and 65 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -239,14 +239,14 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
PBRUSHOBJ Brush, PPOINTL BrushOrigin,
|
||||
XLATEOBJ *ColorTranslation, ULONG Rop4)
|
||||
{
|
||||
LONG i, j, k, sx, sy;
|
||||
ULONG Dest, Source, Pattern;
|
||||
PULONG DestBits;
|
||||
BOOL UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
|
||||
BOOL UsesPattern = ((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000);
|
||||
LONG RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x7);
|
||||
static const ULONG ExpandSolidColor[16] =
|
||||
{
|
||||
LONG i, j, sx, sy;
|
||||
ULONG Dest, Source, Pattern;
|
||||
PULONG DestBits;
|
||||
BOOL UsesSource = ((Rop4 & 0xCC0000) >> 2) != (Rop4 & 0x330000);
|
||||
BOOL UsesPattern = ((Rop4 & 0xF00000) >> 4) != (Rop4 & 0x0F0000);
|
||||
LONG RoundedRight = DestRect->right - ((DestRect->right - DestRect->left) & 0x7);
|
||||
static const ULONG ExpandSolidColor[16] =
|
||||
{
|
||||
0x00000000 /* 0 */,
|
||||
0x11111111 /* 1 */,
|
||||
0x22222222 /* 2 */,
|
||||
|
@ -263,61 +263,79 @@ DIB_4BPP_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
0xDDDDDDDD /* 13 */,
|
||||
0xEEEEEEEE /* 14 */,
|
||||
0xFFFFFFFF /* 15 */,
|
||||
};
|
||||
};
|
||||
|
||||
if (Rop4 == SRCCOPY)
|
||||
{
|
||||
if (Rop4 == SRCCOPY)
|
||||
{
|
||||
return(DIB_4BPP_BitBltSrcCopy(DestSurf, SourceSurf, DestGDI, SourceGDI, DestRect, SourcePoint, ColorTranslation));
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
sy = SourcePoint->y;
|
||||
|
||||
for (j=DestRect->top; j<DestRect->bottom; j++)
|
||||
for (j = DestRect->top; j < DestRect->bottom; j++, sy++)
|
||||
{
|
||||
sx = SourcePoint->x;
|
||||
DestBits = (PULONG)(DestSurf->pvScan0 + (DestRect->left>>1) + j * DestSurf->lDelta);
|
||||
for (i=DestRect->left; i<RoundedRight; i+=8, DestBits++)
|
||||
{
|
||||
Dest = *DestBits;
|
||||
if (UsesSource)
|
||||
{
|
||||
Source = 0;
|
||||
for (k = 0; k < 8; k += 2)
|
||||
{
|
||||
Source |= (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k, sy, ColorTranslation) << ((k + 1) * 4))
|
||||
| (DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left) + k + 1, sy, ColorTranslation) << (k * 4));
|
||||
}
|
||||
}
|
||||
if (UsesPattern)
|
||||
{
|
||||
/* FIXME: No support for pattern brushes. */
|
||||
Pattern = ExpandSolidColor[Brush->iSolidColor & 0xF];
|
||||
}
|
||||
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
||||
}
|
||||
if (i < DestRect->right)
|
||||
{
|
||||
Dest = *DestBits;
|
||||
for (; i < DestRect->right; i++)
|
||||
{
|
||||
if (UsesSource)
|
||||
{
|
||||
Source = DIB_GetSource(SourceSurf, SourceGDI, sx + (i - DestRect->left), 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);
|
||||
Dest >>= 4;
|
||||
}
|
||||
}
|
||||
sy++;
|
||||
DestBits = (PULONG)(DestSurf->pvScan0 + (DestRect->left >> 1) + j * DestSurf->lDelta);
|
||||
sx = SourcePoint->x;
|
||||
|
||||
/* 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;
|
||||
if (UsesSource)
|
||||
{
|
||||
Source =
|
||||
(DIB_GetSource(SourceSurf, SourceGDI, sx + 1, sy, ColorTranslation)) |
|
||||
(DIB_GetSource(SourceSurf, SourceGDI, sx + 0, sy, ColorTranslation) << 4) |
|
||||
(DIB_GetSource(SourceSurf, SourceGDI, sx + 3, sy, ColorTranslation) << 8) |
|
||||
(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)
|
||||
{
|
||||
/* FIXME: No support for pattern brushes. */
|
||||
Pattern = ExpandSolidColor[Brush->iSolidColor & 0xF];
|
||||
}
|
||||
*DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
|
||||
}
|
||||
|
||||
/* Process the rest of pixel on the line */
|
||||
for (; i < DestRect->right; 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN DIB_4BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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
|
||||
* PURPOSE: Mouse
|
||||
|
@ -566,10 +566,10 @@ IntHideMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface)
|
|||
DestRect.top = max(ppdev->PointerAttributes.Row, 0);
|
||||
DestRect.right = min(
|
||||
ppdev->PointerAttributes.Column + ppdev->PointerAttributes.Width,
|
||||
DestSurface->sizlBitmap.cx - 1);
|
||||
DestSurface->sizlBitmap.cx);
|
||||
DestRect.bottom = min(
|
||||
ppdev->PointerAttributes.Row + ppdev->PointerAttributes.Height,
|
||||
DestSurface->sizlBitmap.cy - 1);
|
||||
DestSurface->sizlBitmap.cy);
|
||||
|
||||
SrcPoint.x = max(-ppdev->PointerAttributes.Column, 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.right = min(
|
||||
ppdev->PointerAttributes.Width,
|
||||
DestSurface->sizlBitmap.cx - ppdev->PointerAttributes.Column - 1);
|
||||
DestSurface->sizlBitmap.cx - ppdev->PointerAttributes.Column);
|
||||
DestRect.bottom = min(
|
||||
ppdev->PointerAttributes.Height,
|
||||
DestSurface->sizlBitmap.cy - ppdev->PointerAttributes.Row - 1);
|
||||
DestSurface->sizlBitmap.cy - ppdev->PointerAttributes.Row);
|
||||
|
||||
SaveSurface = EngLockSurface(ppdev->PointerSaveSurface);
|
||||
EngBitBlt(SaveSurface, DestSurface, NULL, NULL, NULL,
|
||||
|
@ -635,10 +635,10 @@ IntShowMousePointer(GDIDEVICE *ppdev, SURFOBJ *DestSurface)
|
|||
DestRect.top = max(ppdev->PointerAttributes.Row, 0);
|
||||
DestRect.right = min(
|
||||
ppdev->PointerAttributes.Column + ppdev->PointerAttributes.Width,
|
||||
DestSurface->sizlBitmap.cx - 1);
|
||||
DestSurface->sizlBitmap.cx);
|
||||
DestRect.bottom = min(
|
||||
ppdev->PointerAttributes.Row + ppdev->PointerAttributes.Height,
|
||||
DestSurface->sizlBitmap.cy - 1);
|
||||
DestSurface->sizlBitmap.cy);
|
||||
|
||||
SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0);
|
||||
SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0);
|
||||
|
|
Loading…
Reference in a new issue