optimze for bitblt dib32bpp.c

NOTSRCERASE, DSTINVERT
you can gain more speed from these

svn path=/trunk/; revision=15756
This commit is contained in:
Magnus Olsen 2005-06-03 18:57:53 +00:00
parent 3c262aeb05
commit bf66d82efc

View file

@ -387,30 +387,36 @@ DIB_32BPP_BitBlt(PBLTINFO BltInfo)
case BMF_16BPP: case BMF_16BPP:
case BMF_24BPP: case BMF_24BPP:
{ {
PBYTE byteaddr = BltInfo->SourceSurface->pvScan0 + BltInfo->DestRect.top * BltInfo->SourceSurface->lDelta; /* calc dest start position */
PDWORD addr = (PDWORD)byteaddr + BltInfo->DestRect.left; PBYTE Destbyteaddr = BltInfo->SourceSurface->pvScan0 + BltInfo->DestRect.top * BltInfo->SourceSurface->lDelta;
LONG xlDelta = BltInfo->SourceSurface->lDelta - (BltInfo->DestRect.right - BltInfo->DestRect.left) ; PDWORD Destaddr = (PDWORD)Destbyteaddr + BltInfo->DestRect.left;
LONG DestxlDelta = BltInfo->SourceSurface->lDelta - (BltInfo->DestRect.right - BltInfo->DestRect.left) ;
/* calc src start position */
SourceY = BltInfo->SourcePoint.y; SourceY = BltInfo->SourcePoint.y;
for (DestY=BltInfo->DestRect.top; DestY<BltInfo->DestRect.bottom; DestY++) for (DestY=BltInfo->DestRect.top; DestY<BltInfo->DestRect.bottom; DestY++)
{ {
if (SourceY > BltInfo->SourceSurface->sizlBitmap.cy) break; if (SourceY > BltInfo->SourceSurface->sizlBitmap.cy) break;
SourceX = BltInfo->SourcePoint.x; SourceX = BltInfo->SourcePoint.x;
for (DestX=BltInfo->DestRect.left; DestX<BltInfo->DestRect.right; DestX++, SourceX++, addr++) for (DestX=BltInfo->DestRect.left; DestX<BltInfo->DestRect.right; DestX++, SourceX++, Destaddr++)
{ {
if (SourceX > BltInfo->SourceSurface->sizlBitmap.cx) break; if (SourceX > BltInfo->SourceSurface->sizlBitmap.cx) break;
*addr = DIB_GetSource(BltInfo->SourceSurface, SourceX, *Destaddr = DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest); SourceY, BltInfo->XlateSourceToDest);
} }
Destaddr+=DestxlDelta;
} }
addr+=xlDelta; return TRUE;
break;
} }
break;
case BMF_32BPP: case BMF_32BPP:
{ {
INT Destdelta; INT Destdelta;
@ -449,16 +455,78 @@ DIB_32BPP_BitBlt(PBLTINFO BltInfo)
} }
while (--DesmaxY); while (--DesmaxY);
} }
return TRUE; return TRUE;
break; break;
} }
default: default:
break; break;
} }
break;
break;
case ROP4_DSTINVERT:
// return(~Dest);
{
/* calc dest start position */
PBYTE Destbyteaddr = BltInfo->SourceSurface->pvScan0 + BltInfo->DestRect.top * BltInfo->SourceSurface->lDelta;
PDWORD Destaddr = (PDWORD)Destbyteaddr + BltInfo->DestRect.left;
LONG DestxlDelta = BltInfo->SourceSurface->lDelta - (BltInfo->DestRect.right - BltInfo->DestRect.left) ;
for (DestY=BltInfo->DestRect.top; DestY<BltInfo->DestRect.bottom; DestY++)
{
for (DestX=BltInfo->DestRect.left; DestX<BltInfo->DestRect.right; DestX++, Destaddr++)
{
*Destaddr = ~(*Destaddr);
}
Destaddr+=DestxlDelta;
}
return TRUE;
}
break;
case ROP4_NOTSRCERASE:
// return(~(Dest | Source));
switch (BltInfo->SourceSurface->iBitmapFormat)
{
case BMF_1BPP:
case BMF_4BPP:
case BMF_16BPP:
case BMF_24BPP:
case BMF_32BPP:
{
/* calc dest start position */
PBYTE Destbyteaddr = BltInfo->SourceSurface->pvScan0 + BltInfo->DestRect.top * BltInfo->SourceSurface->lDelta;
PDWORD Destaddr = (PDWORD)Destbyteaddr + BltInfo->DestRect.left;
LONG DestxlDelta = BltInfo->SourceSurface->lDelta - (BltInfo->DestRect.right - BltInfo->DestRect.left) ;
SourceY = BltInfo->SourcePoint.y;
for (DestY=BltInfo->DestRect.top; DestY<BltInfo->DestRect.bottom; DestY++)
{
if (SourceY > BltInfo->SourceSurface->sizlBitmap.cy) break;
SourceX = BltInfo->SourcePoint.x;
for (DestX=BltInfo->DestRect.left; DestX<BltInfo->DestRect.right; DestX++, SourceX++, Destaddr++)
{
if (SourceX > BltInfo->SourceSurface->sizlBitmap.cx) break;
*Destaddr = ~(*Destaddr | DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest));
}
Destaddr+=DestxlDelta;
}
return TRUE;
break;
default:
break;
}
}
break;
default: default:
break; break;
} }