dib32 more speed optimze

svn path=/trunk/; revision=15774
This commit is contained in:
Magnus Olsen 2005-06-04 17:36:59 +00:00
parent daaeafc22b
commit 33798a8e08

View file

@ -402,10 +402,12 @@ BOOLEAN
FASTCALL
DIB_32DstInvert(PBLTINFO BltInfo)
{
ULONG SourceX, SourceY;
ULONG right = BltInfo->DestRect.right;
PULONG DestBits;
ULONG top = BltInfo->DestRect.top;
ULONG left = BltInfo->DestRect.left;
ULONG DestX = BltInfo->DestRect.right - left;
ULONG DestX;
ULONG DestY = BltInfo->DestRect.bottom - top;
ULONG delta = BltInfo->DestSurface->lDelta - (DestX << 2);
@ -413,24 +415,20 @@ DIB_32DstInvert(PBLTINFO BltInfo)
DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 + (left << 2) +
top * BltInfo->DestSurface->lDelta);
SourceY = BltInfo->SourcePoint.y;
while (DestY>0)
{
while (DestX > 0)
SourceX = BltInfo->SourcePoint.x;
for (DestX = BltInfo->DestRect.left; DestX < right; DestX++, DestBits++, SourceX++)
{
/* Invert bits */
*DestBits = ~*DestBits;
/* Update Position */
DestBits++;
/* Decrease distance to do */
DestX--;
}
/* Update position */
DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
/* Decrease distance to do */
SourceY++;
DestY--;
}
@ -450,64 +448,37 @@ DIB32_SrcPaint(PBLTINFO BltInfo)
case BMF_4BPP:
case BMF_16BPP:
case BMF_24BPP:
{
ULONG DestX, DestY;
ULONG SourceX, SourceY;
PULONG DestBits;
ULONG bottom = BltInfo->DestRect.bottom;
ULONG right = BltInfo->DestRect.right;
ULONG delta = BltInfo->DestSurface->lDelta - ((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2) ;
DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
SourceY = BltInfo->SourcePoint.y;
for (DestY = BltInfo->DestRect.top; DestY < bottom; DestY++)
{
SourceX = BltInfo->SourcePoint.x;
for (DestX = BltInfo->DestRect.left; DestX < right; DestX++, DestBits++, SourceX++)
{
*DestBits = (*DestBits | DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest));
}
DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
SourceY++;
}
}
status = TRUE;
break;
case BMF_32BPP:
{
ULONG DestX, DestY;
ULONG SourceX, SourceY;
PULONG DestBits;
ULONG bottom = BltInfo->DestRect.bottom;
ULONG right = BltInfo->DestRect.right;
ULONG delta = BltInfo->DestSurface->lDelta - ((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2) ;
PULONG DestBits;
ULONG top = BltInfo->DestRect.top;
ULONG left = BltInfo->DestRect.left;
ULONG DestX;
ULONG DestY = BltInfo->DestRect.bottom - top;
ULONG delta = BltInfo->DestSurface->lDelta - (DestX << 2);
DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
/* Calculate the Initial Destination */
DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 + (left << 2) +
top * BltInfo->DestSurface->lDelta);
SourceY = BltInfo->SourcePoint.y;
for (DestY = BltInfo->DestRect.top; DestY < bottom; DestY++)
while (DestY>0)
{
SourceX = BltInfo->SourcePoint.x;
for (DestX = BltInfo->DestRect.left; DestX < right; DestX++, DestBits++, SourceX++)
for (DestX = left; DestX < right; DestX++, DestBits++, SourceX++)
{
*DestBits = (*DestBits | DIB_32BPP_GetPixel(BltInfo->SourceSurface, SourceX, SourceY));
*DestBits |= DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest);
}
DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
SourceY++;
DestY--;
}
}
@ -520,6 +491,7 @@ DIB32_SrcPaint(PBLTINFO BltInfo)
return status;
}
BOOLEAN
DIB32_Srccopy(PBLTINFO BltInfo)
{
@ -533,35 +505,34 @@ DIB32_Srccopy(PBLTINFO BltInfo)
case BMF_16BPP:
case BMF_24BPP:
{
ULONG DestX, DestY;
ULONG SourceX, SourceY;
PULONG DestBits;
ULONG bottom = BltInfo->DestRect.bottom;
ULONG right = BltInfo->DestRect.right;
ULONG delta = ((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2) + BltInfo->DestSurface->lDelta;
PULONG DestBits;
ULONG top = BltInfo->DestRect.top;
ULONG left = BltInfo->DestRect.left;
ULONG DestX;
ULONG DestY = BltInfo->DestRect.bottom - top;
ULONG delta = BltInfo->DestSurface->lDelta - (DestX << 2);
DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 + (BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
/* Calculate the Initial Destination */
DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 + (left << 2) +
top * BltInfo->DestSurface->lDelta);
SourceY = BltInfo->SourcePoint.y;
for (DestY = BltInfo->DestRect.top; DestY < bottom; DestY++)
while (DestY>0)
{
SourceX = BltInfo->SourcePoint.x;
for (DestX = BltInfo->DestRect.left; DestX < right; DestX++, DestBits++, SourceX++)
for (DestX = left; DestX < right; DestX++, DestBits++, SourceX++)
{
if (SourceX > BltInfo->SourceSurface->sizlBitmap.cx) break;
*DestBits = DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest);
}
DestBits = (PULONG)((ULONG_PTR)DestBits - delta);
DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
SourceY++;
DestY--;
}
}
status = TRUE;
break;