lite Optimze only for dib32bpp.c

thanks Blight for the inline asm for hline 
bitblt have got optimze for fill black and white color
only. more will come

svn path=/trunk/; revision=15732
This commit is contained in:
Magnus Olsen 2005-06-02 20:12:58 +00:00
parent 83c66bb1c1
commit bd38382acb
2 changed files with 107 additions and 0 deletions

View file

@ -1,6 +1,27 @@
#ifndef _W32K_DIB_DIB_H
#define _W32K_DIB_DIB_H
#ifdef _M_IX86
#define memset4(dest, value, count) asm volatile("rep stosl" : : "D"(dest), "a"(value), "c"(count) : "memory");
#endif
#define ROP4_BLACKNESS ((((0x00000042) >> 8) & 0xff00) | (((0x00000042) >> 16) & 0x00ff))
#define ROP4_NOTSRCERASE ((((0x001100A6) >> 8) & 0xff00) | (((0x001100A6) >> 16) & 0x00ff))
#define ROP4_NOTSRCCOPY ((((0x00330008) >> 8) & 0xff00) | (((0x00330008) >> 16) & 0x00ff))
#define ROP4_SRCERASE ((((0x00440328) >> 8) & 0xff00) | (((0x00440328) >> 16) & 0x00ff))
#define ROP4_DSTINVERT ((((0x00550009) >> 8) & 0xff00) | (((0x00550009) >> 16) & 0x00ff))
#define ROP4_PATINVERT ((((0x005A0049) >> 8) & 0xff00) | (((0x005A0049) >> 16) & 0x00ff))
#define ROP4_SRCINVERT ((((0x00660046) >> 8) & 0xff00) | (((0x00660046) >> 16) & 0x00ff))
#define ROP4_SRCAND ((((0x008800C6) >> 8) & 0xff00) | (((0x008800C6) >> 16) & 0x00ff))
#define ROP4_MERGEPAINT ((((0x00BB0226) >> 8) & 0xff00) | (((0x00BB0226) >> 16) & 0x00ff))
#define ROP4_MERGECOPY ((((0x00C000CA) >> 8) & 0xff00) | (((0x00C000CA) >> 16) & 0x00ff))
#define ROP4_SRCCOPY ((((0x00CC0020) >> 8) & 0xff00) | (((0x00CC0020) >> 16) & 0x00ff))
#define ROP4_SRCPAINT ((((0x00EE0086) >> 8) & 0xff00) | (((0x00EE0086) >> 16) & 0x00ff))
#define ROP4_PATCOPY ((((0x00F00021) >> 8) & 0xff00) | (((0x00F00021) >> 16) & 0x00ff))
#define ROP4_PATPAINT ((((0x00FB0A09) >> 8) & 0xff00) | (((0x00FB0A09) >> 16) & 0x00ff))
#define ROP4_WHITENESS ((((0x00FF0062) >> 8) & 0xff00) | (((0x00FF0062) >> 16) & 0x00ff))
typedef struct _BLTINFO
{
SURFOBJ *DestSurface;

View file

@ -37,6 +37,17 @@ DIB_32BPP_GetPixel(SURFOBJ *SurfObj, LONG x, LONG y)
return (ULONG)(*addr);
}
#ifdef _M_IX86
VOID
DIB_32BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
{
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
PDWORD addr = (PDWORD)byteaddr + x1;
LONG cx = x2 - x1;
if (cx>0) memset4(addr, c, cx);
}
#else
VOID
DIB_32BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
{
@ -50,6 +61,7 @@ DIB_32BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
++cx;
}
}
#endif
VOID
DIB_32BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
@ -294,6 +306,80 @@ DIB_32BPP_BitBlt(PBLTINFO BltInfo)
BOOL UsesPattern;
PULONG DestBits;
switch (BltInfo->Rop4)
{
case ROP4_BLACKNESS:
//return(0x00000000);
#ifdef _M_IX86
if (BltInfo->DestRect.left!=0)
{
SourceX = (BltInfo->DestRect.right - BltInfo->DestRect.left) ;
if (SourceX<=0) return TRUE;
for (DestY=BltInfo->DestRect.bottom-1;DestY>=BltInfo->DestRect.top;DestY--)
{
memset4( (PDWORD) (BltInfo->DestSurface->pvScan0 + DestY *
BltInfo->DestSurface->lDelta +
BltInfo->DestRect.left), 0x00000000, SourceX);
}
}
else
{
SourceX = ((BltInfo->DestRect.bottom - BltInfo->DestRect.top) *
BltInfo->DestRect.right) ;
if (SourceX<=0) return TRUE
memset4( (PDWORD) (BltInfo->DestSurface->pvScan0 + BltInfo->DestRect.top *
BltInfo->DestSurface->lDelta), 0x00000000, SourceX);
}
#else
for (DestY=BltInfo->DestRect.bottom-1;DestY>=BltInfo->DestRect.top;DestY--)
{
DIB_32BPP_HLine(BltInfo->DestSurface, BltInfo->DestRect.bottom, SourceX, DestY, 0x00000000);
}
#endif
return TRUE;
break;
case ROP4_WHITENESS:
//return(0xFFFFFFFF);
SourceX = ((BltInfo->DestRect.bottom - BltInfo->DestRect.top) * BltInfo->DestRect.right) ;
if (SourceX<=0) return TRUE
#ifdef _M_IX86
if (BltInfo->DestRect.left!=0)
{
for (DestY=BltInfo->DestRect.bottom-1;DestY>=BltInfo->DestRect.top;DestY--)
{
memset4( (PDWORD) (BltInfo->DestSurface->pvScan0 + DestY *
BltInfo->DestSurface->lDelta +
BltInfo->DestRect.left), 0xFFFFFFFF, SourceX);
}
}
else
{
memset4( (PDWORD) (BltInfo->DestSurface->pvScan0 + BltInfo->DestRect.top *
BltInfo->DestSurface->lDelta), 0xFFFFFFFF, SourceX);
}
#else
for (DestY=BltInfo->DestRect.bottom-1;DestY>=BltInfo->DestRect.top;DestY--)
{
DIB_32BPP_HLine(BltInfo->DestSurface, BltInfo->DestRect.bottom, SourceX, DestY, 0xFFFFFFFF);
}
#endif
return TRUE;
break;
default:
break;
}
UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);