Optimze DIB32_bitblt for both DGB=0 and DGB=1
Can not geting it faster with current c code
Modified: trunk/reactos/subsys/win32k/dib/dib.c
Modified: trunk/reactos/subsys/win32k/dib/dib.h
Modified: trunk/reactos/subsys/win32k/dib/dib16bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib24bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib32bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib4bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib8bpp.c
Modified: trunk/reactos/subsys/win32k/eng/bitblt.c
_____
Modified: trunk/reactos/subsys/win32k/dib/dib.c
--- trunk/reactos/subsys/win32k/dib/dib.c 2005-06-07 23:11:35 UTC
(rev 15839)
+++ trunk/reactos/subsys/win32k/dib/dib.c 2005-06-08 16:28:41 UTC
(rev 15840)
@@ -35,57 +35,57 @@
{
DIB_1BPP_PutPixel, DIB_1BPP_GetPixel, DIB_1BPP_HLine,
DIB_1BPP_VLine,
DIB_1BPP_BitBlt, DIB_1BPP_BitBltSrcCopy, DIB_1BPP_StretchBlt,
- DIB_1BPP_TransparentBlt
+ DIB_1BPP_TransparentBlt, DIB_1BPP_ColorFill
},
/* BMF_4BPP */
{
DIB_4BPP_PutPixel, DIB_4BPP_GetPixel, DIB_4BPP_HLine,
DIB_4BPP_VLine,
DIB_4BPP_BitBlt, DIB_4BPP_BitBltSrcCopy, DIB_4BPP_StretchBlt,
- DIB_4BPP_TransparentBlt
+ DIB_4BPP_TransparentBlt, DIB_4BPP_ColorFill
},
/* BMF_8BPP */
{
DIB_8BPP_PutPixel, DIB_8BPP_GetPixel, DIB_8BPP_HLine,
DIB_8BPP_VLine,
DIB_8BPP_BitBlt, DIB_8BPP_BitBltSrcCopy, DIB_8BPP_StretchBlt,
- DIB_8BPP_TransparentBlt
+ DIB_8BPP_TransparentBlt, DIB_8BPP_ColorFill
},
/* BMF_16BPP */
{
DIB_16BPP_PutPixel, DIB_16BPP_GetPixel, DIB_16BPP_HLine,
DIB_16BPP_VLine,
DIB_16BPP_BitBlt, DIB_16BPP_BitBltSrcCopy, DIB_16BPP_StretchBlt,
- DIB_16BPP_TransparentBlt
+ DIB_16BPP_TransparentBlt, DIB_16BPP_ColorFill
},
/* BMF_24BPP */
{
DIB_24BPP_PutPixel, DIB_24BPP_GetPixel, DIB_24BPP_HLine,
DIB_24BPP_VLine,
DIB_24BPP_BitBlt, DIB_24BPP_BitBltSrcCopy, DIB_24BPP_StretchBlt,
- DIB_24BPP_TransparentBlt
+ DIB_24BPP_TransparentBlt, DIB_24BPP_ColorFill
},
/* BMF_32BPP */
{
DIB_32BPP_PutPixel, DIB_32BPP_GetPixel, DIB_32BPP_HLine,
DIB_32BPP_VLine,
DIB_32BPP_BitBlt, DIB_32BPP_BitBltSrcCopy, DIB_32BPP_StretchBlt,
- DIB_32BPP_TransparentBlt
+ DIB_32BPP_TransparentBlt, DIB_32BPP_ColorFill
},
/* BMF_4RLE */
{
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
- Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt,
Dummy_TransparentBlt
+ Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt,
Dummy_TransparentBlt, Dummy_ColorFill
},
/* BMF_8RLE */
{
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
- Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt,
Dummy_TransparentBlt
+ Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt,
Dummy_TransparentBlt, Dummy_ColorFill
},
/* BMF_JPEG */
{
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
- Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt,
Dummy_TransparentBlt
+ Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt,
Dummy_TransparentBlt, Dummy_ColorFill
},
/* BMF_PNG */
{
Dummy_PutPixel, Dummy_GetPixel, Dummy_HLine, Dummy_VLine,
- Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt,
Dummy_TransparentBlt
+ Dummy_BitBlt, Dummy_BitBlt, Dummy_StretchBlt,
Dummy_TransparentBlt, Dummy_ColorFill
}
};
@@ -230,4 +230,10 @@
return FALSE;
}
+BOOLEAN Dummy_ColorFill(SURFOBJ* Dest, RECTL* DestRect, ULONG Color)
+{
+ return FALSE;
+}
+
+
/* EOF */
_____
Modified: trunk/reactos/subsys/win32k/dib/dib.h
--- trunk/reactos/subsys/win32k/dib/dib.h 2005-06-07 23:11:35 UTC
(rev 15839)
+++ trunk/reactos/subsys/win32k/dib/dib.h 2005-06-08 16:28:41 UTC
(rev 15840)
@@ -43,6 +43,7 @@
typedef BOOLEAN (*PFN_DIB_BitBlt)(PBLTINFO);
typedef BOOLEAN
(*PFN_DIB_StretchBlt)(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLI
POBJ*,XLATEOBJ*,ULONG);
typedef BOOLEAN
(*PFN_DIB_TransparentBlt)(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULO
NG);
+typedef BOOLEAN (*PFN_DIB_ColorFill)(SURFOBJ*, RECTL*, ULONG);
typedef struct
{
@@ -54,6 +55,7 @@
PFN_DIB_BitBlt DIB_BitBltSrcCopy;
PFN_DIB_StretchBlt DIB_StretchBlt;
PFN_DIB_TransparentBlt DIB_TransparentBlt;
+ PFN_DIB_ColorFill DIB_ColorFill;
} DIB_FUNCTIONS;
extern DIB_FUNCTIONS DibFunctionsForBitmapFormat[];
@@ -65,6 +67,7 @@
BOOLEAN Dummy_BitBlt(PBLTINFO);
BOOLEAN
Dummy_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPOBJ*
,XLATEOBJ*,ULONG);
BOOLEAN
Dummy_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG);
+BOOLEAN Dummy_ColorFill(SURFOBJ*, RECTL*, ULONG);
VOID DIB_1BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_1BPP_GetPixel(SURFOBJ*,LONG,LONG);
@@ -74,6 +77,7 @@
BOOLEAN DIB_1BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN
DIB_1BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPO
BJ*,XLATEOBJ*,ULONG);
BOOLEAN
DIB_1BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG
);
+BOOLEAN DIB_1BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
VOID DIB_4BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_4BPP_GetPixel(SURFOBJ*,LONG,LONG);
@@ -83,6 +87,7 @@
BOOLEAN DIB_4BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN
DIB_4BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPO
BJ*,XLATEOBJ*,ULONG);
BOOLEAN
DIB_4BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG
);
+BOOLEAN DIB_4BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
VOID DIB_8BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_8BPP_GetPixel(SURFOBJ*,LONG,LONG);
@@ -92,6 +97,7 @@
BOOLEAN DIB_8BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN
DIB_8BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIPO
BJ*,XLATEOBJ*,ULONG);
BOOLEAN
DIB_8BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULONG
);
+BOOLEAN DIB_8BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
VOID DIB_16BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_16BPP_GetPixel(SURFOBJ*,LONG,LONG);
@@ -101,6 +107,7 @@
BOOLEAN DIB_16BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN
DIB_16BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIP
OBJ*,XLATEOBJ*,ULONG);
BOOLEAN
DIB_16BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULON
G);
+BOOLEAN DIB_16BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
VOID DIB_24BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_24BPP_GetPixel(SURFOBJ*,LONG,LONG);
@@ -110,6 +117,7 @@
BOOLEAN DIB_24BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN
DIB_24BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIP
OBJ*,XLATEOBJ*,ULONG);
BOOLEAN
DIB_24BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULON
G);
+BOOLEAN DIB_24BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
VOID DIB_32BPP_PutPixel(SURFOBJ*,LONG,LONG,ULONG);
ULONG DIB_32BPP_GetPixel(SURFOBJ*,LONG,LONG);
@@ -119,17 +127,14 @@
BOOLEAN DIB_32BPP_BitBltSrcCopy(PBLTINFO);
BOOLEAN
DIB_32BPP_StretchBlt(SURFOBJ*,SURFOBJ*,RECTL*,RECTL*,POINTL*,POINTL,CLIP
OBJ*,XLATEOBJ*,ULONG);
BOOLEAN
DIB_32BPP_TransparentBlt(SURFOBJ*,SURFOBJ*,RECTL*,POINTL*,XLATEOBJ*,ULON
G);
+BOOLEAN DIB_32BPP_ColorFill(SURFOBJ*, RECTL*, ULONG);
BOOLEAN FASTCALL DIB_32DstInvert(PBLTINFO);
-BOOLEAN FASTCALL DIB32_Srccopy(PBLTINFO);
-BOOLEAN FASTCALL DIB32_ColorFill(PBLTINFO, ULONG);
+
BOOLEAN FASTCALL DIB32_SrcPaint(PBLTINFO);
BOOLEAN FASTCALL DIB32_NotSrcErase(PBLTINFO);
BOOLEAN FASTCALL DIB32_SrcErase(PBLTINFO);
-BOOLEAN FASTCALL DIB_32PatCopy(PBLTINFO);
-
-
extern unsigned char notmask[2];
extern unsigned char altnotmask[2];
#define MASK1BPP(x) (1<<(7-((x)&7)))
_____
Modified: trunk/reactos/subsys/win32k/dib/dib16bpp.c
--- trunk/reactos/subsys/win32k/dib/dib16bpp.c 2005-06-07 23:11:35 UTC
(rev 15839)
+++ trunk/reactos/subsys/win32k/dib/dib16bpp.c 2005-06-08 16:28:41 UTC
(rev 15840)
@@ -42,6 +42,7 @@
{
PDWORD addr = (PDWORD)((PWORD)(SurfObj->pvScan0 + y *
SurfObj->lDelta) + x1);
+
#ifdef _M_IX86
/* This is about 10% faster than the generic C code below */
LONG Count = x2 - x1;
@@ -65,7 +66,7 @@
" jz .L2\n"
" stosw\n"
".L2:\n"
- : /* no output */
+ : // no output */
: "r"(c), "r"(Count), "D"(addr)
: "%eax", "%ecx");
#else /* _M_IX86 */
@@ -88,6 +89,7 @@
#endif /* _M_IX86 */
}
+
VOID
DIB_16BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
{
@@ -423,7 +425,17 @@
return TRUE;
}
-
+/* Optimze for bitBlt */
+BOOLEAN
+DIB_16BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
+{
+ ULONG DestY;
+ for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
+ {
+ DIB_16BPP_HLine (DestSurface, DestRect->left, DestRect->right,
DestY, color);
+ }
+return TRUE;
+}
/*
=======================================
Stretching functions goes below
_____
Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c
--- trunk/reactos/subsys/win32k/dib/dib1bpp.c 2005-06-07 23:11:35 UTC
(rev 15839)
+++ trunk/reactos/subsys/win32k/dib/dib1bpp.c 2005-06-08 16:28:41 UTC
(rev 15840)
@@ -478,6 +478,20 @@
return TRUE;
}
+/* Optimze for bitBlt */
+BOOLEAN
+DIB_1BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
+{
+ ULONG DestY;
+
+ for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
+ {
+ DIB_1BPP_HLine(DestSurface, DestRect->left,
DestRect->right, DestY, color);
+ }
+
+return TRUE;
+}
+
//NOTE: If you change something here, please do the same in other
dibXXbpp.c files!
BOOLEAN DIB_1BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
_____
Modified: trunk/reactos/subsys/win32k/dib/dib24bpp.c
--- trunk/reactos/subsys/win32k/dib/dib24bpp.c 2005-06-07 23:11:35 UTC
(rev 15839)
+++ trunk/reactos/subsys/win32k/dib/dib24bpp.c 2005-06-08 16:28:41 UTC
(rev 15840)
@@ -302,6 +302,20 @@
return TRUE;
}
+/* BitBlt Optimze */
+BOOLEAN
+DIB_24BPP_ColorFill(SURFOBJ* DestSurface, RECTL* DestRect, ULONG color)
+{
+ ULONG DestY;
+
+ for (DestY = DestRect->top; DestY< DestRect->bottom; DestY++)
+ {
+ DIB_24BPP_HLine(DestSurface, DestRect->left,
DestRect->right, DestY, color);
+ }
+
+return TRUE;
+}
+
//NOTE: If you change something here, please do the same in other
dibXXbpp.c files!
BOOLEAN DIB_24BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
_____
Modified: trunk/reactos/subsys/win32k/dib/dib32bpp.c
--- trunk/reactos/subsys/win32k/dib/dib32bpp.c 2005-06-07 23:11:35 UTC
(rev 15839)
+++ trunk/reactos/subsys/win32k/dib/dib32bpp.c 2005-06-08 16:28:41 UTC
(rev 15840)
@@ -45,54 +45,46 @@
VOID
DIB_32BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
{
- LONG cx = (x2 - x1) ;
- if (cx>0)
- {
+ LONG cx = (x2 - x1) ;
PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
PDWORD addr = (PDWORD)byteaddr + x1;
memset4(addr, c, cx);
- }
- else if (cx<0)
- {
- PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
- PDWORD addr = (PDWORD)byteaddr + x2;
- cx = (x1 - x2) ;
- memset4(addr, c, cx);
- }
+
+
}
#else
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 = x1;
- while(cx < x2)
- {
- *addr = (DWORD)c;
- ++addr;
- ++cx;
- }
+ PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;
+ PDWORD addr = (PDWORD)byteaddr + x1;
+ LONG cx = x1;
+ while(cx < x2)
+ {
+ *addr = (DWORD)c;
+ ++addr;
+ ++cx;
+ }
}
#endif
VOID
DIB_32BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
{
+
+
PBYTE byteaddr = SurfObj->pvScan0 + y1 * SurfObj->lDelta;
PDWORD addr = (PDWORD)byteaddr + x;
- LONG lDelta = SurfObj->lDelta >> 2; /* >> 2 == / sizeof(DWORD) */
+ LONG lDelta = SurfObj->lDelta >> 2; // >> 2 == / sizeof(DWORD)
byteaddr = (PBYTE)addr;
while(y1++ < y2)
{
- *addr = (DWORD)c;
- addr += lDelta;
- }
-
+ *addr = (DWORD)c;
+ addr += lDelta;
+ }
+
}
BOOLEAN
@@ -315,236 +307,241 @@
BOOLEAN
DIB_32BPP_BitBlt(PBLTINFO BltInfo)
{
- ULONG DestX, DestY;
- ULONG SourceX, SourceY;
- ULONG PatternY = 0;
- ULONG Dest, Source = 0, Pattern = 0;
- BOOL UsesSource;
- BOOL UsesPattern;
- PULONG DestBits;
+ ULONG DestX, DestY;
+ ULONG SourceX, SourceY;
+ ULONG PatternY = 0, PatternX = 0, orgPatternX = 0;
+ ULONG Source = 0, Pattern = 0;
+ BOOL UsesSource;
+ BOOL UsesPattern;
+ PULONG DestBits;
+ ULONG Delta;
- switch (BltInfo->Rop4)
- {
+ switch (BltInfo->Rop4)
+ {
+ case ROP4_DSTINVERT:
+ return DIB_32DstInvert(BltInfo);
+ break;
- case ROP4_BLACKNESS:
- //return(0x00000000);
- return DIB32_ColorFill(BltInfo, 0x00000000);
- break;
+ case ROP4_SRCPAINT:
+ return DIB32_SrcPaint(BltInfo);
+ break;
- case ROP4_WHITENESS:
- //return(0xFFFFFFFF);
- return DIB32_ColorFill(BltInfo, 0xFFFFFFFF);
- break;
+ case ROP4_NOTSRCERASE:
+ return DIB32_NotSrcErase(BltInfo);
+ break;
- case ROP4_SRCCOPY:
- // return(Source);
- return DIB32_Srccopy(BltInfo);
- break;
-
- case ROP4_DSTINVERT:
- // return(~Dest);
- return DIB_32DstInvert(BltInfo);
- break;
-
- case ROP4_SRCPAINT:
- // return(Dest | Source);
- return DIB32_SrcPaint(BltInfo);
- break;
-
- case ROP4_NOTSRCERASE:
- return DIB32_NotSrcErase(BltInfo);
- break;
- case ROP4_SRCERASE:
- return DIB32_SrcErase(BltInfo);
- break;
-
- case ROP4_PATCOPY:
- // return(Pattern);
- return DIB_32PatCopy(BltInfo);
- break;
+ case ROP4_SRCERASE:
+ return DIB32_SrcErase(BltInfo);
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
UsesSource = ROP4_USES_SOURCE(BltInfo->Rop4);
UsesPattern = ROP4_USES_PATTERN(BltInfo->Rop4);
SourceY = BltInfo->SourcePoint.y;
- DestBits = (PULONG)(
- BltInfo->DestSurface->pvScan0 +
- (BltInfo->DestRect.left << 2) +
- BltInfo->DestRect.top * BltInfo->DestSurface->lDelta);
+ DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left << 2) +
+ BltInfo->DestRect.top *
BltInfo->DestSurface->lDelta);
- if (UsesPattern)
+ Delta = BltInfo->DestSurface->lDelta - ((BltInfo->DestRect.right -
BltInfo->DestRect.left) << 2);
+
+ if ((UsesSource) && (BltInfo->PatternSurface))
{
- if (BltInfo->PatternSurface)
+ if (UsesPattern)
{
- PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
- BltInfo->PatternSurface->sizlBitmap.cy;
+ PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
+ BltInfo->PatternSurface->sizlBitmap.cy;
}
- else
+
+ orgPatternX = (BltInfo->DestRect.left + BltInfo->BrushOrigin.x) %
BltInfo->PatternSurface->sizlBitmap.cx;
+
+
+ for (DestY = BltInfo->DestRect.top; DestY <
BltInfo->DestRect.bottom; DestY++)
{
- Pattern = BltInfo->Brush->iSolidColor;
- }
- }
+ SourceX = BltInfo->SourcePoint.x;
- for (DestY = BltInfo->DestRect.top; DestY <
BltInfo->DestRect.bottom; DestY++)
- {
- SourceX = BltInfo->SourcePoint.x;
+ PatternX = orgPatternX;
- for (DestX = BltInfo->DestRect.left; DestX <
BltInfo->DestRect.right; DestX++, DestBits++, SourceX++)
+ for (DestX = BltInfo->DestRect.left; DestX <
BltInfo->DestRect.right; DestX++, DestBits++, SourceX++)
+ {
+
+ Source = DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest);
+
+ Pattern = DIB_GetSource(BltInfo->PatternSurface, PatternX,
PatternY, BltInfo->XlatePatternToDest);
+
+ *DestBits = DIB_DoRop(BltInfo->Rop4, *DestBits, Source,
Pattern);
+
+ PatternX++;
+ PatternX %= BltInfo->PatternSurface->sizlBitmap.cx;
+
+ }
+
+ SourceY++;
+
+ PatternY++;
+ PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + Delta);
+ }
+ }
+
+ else if ((UsesSource) && (!BltInfo->PatternSurface))
+ {
+ if (UsesPattern)
{
- Dest = *DestBits;
+ Pattern = BltInfo->Brush->iSolidColor;
+ }
- if (UsesSource)
- {
- Source = DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest);
- }
+ for (DestY = BltInfo->DestRect.top; DestY <
BltInfo->DestRect.bottom; DestY++)
+ {
+ SourceX = BltInfo->SourcePoint.x;
- if (BltInfo->PatternSurface)
- {
- Pattern = DIB_GetSource(BltInfo->PatternSurface, (DestX +
BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx,
PatternY, BltInfo->XlatePatternToDest);
+ for (DestX = BltInfo->DestRect.left; DestX <
BltInfo->DestRect.right; DestX++, DestBits++, SourceX++)
+ {
+ Source = DIB_GetSource(BltInfo->SourceSurface, SourceX,
SourceY, BltInfo->XlateSourceToDest);
+
+ *DestBits = DIB_DoRop(BltInfo->Rop4, *DestBits, Source,
Pattern);
}
- *DestBits = DIB_DoRop(BltInfo->Rop4, Dest, Source, Pattern);
+ SourceY++;
+ DestBits = (PULONG)((ULONG_PTR)DestBits + Delta);
}
+ }
- SourceY++;
- if (BltInfo->PatternSurface)
+ else if ((!UsesSource) && (BltInfo->PatternSurface))
+ {
+ if (UsesPattern)
{
- PatternY++;
- PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
+ PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
+ BltInfo->PatternSurface->sizlBitmap.cy;
}
- DestBits = (PULONG)(
- (ULONG_PTR)DestBits -
- ((BltInfo->DestRect.right - BltInfo->DestRect.left) << 2) +
- BltInfo->DestSurface->lDelta);
- }
- return TRUE;
-}
+ orgPatternX = (BltInfo->DestRect.left + BltInfo->BrushOrigin.x) %
BltInfo->PatternSurface->sizlBitmap.cx;
+
+ for (DestY = BltInfo->DestRect.top; DestY <
BltInfo->DestRect.bottom; DestY++)
+ {
-/* optimze functions for bitblt */
+ PatternX = orgPatternX;
-BOOLEAN
-FASTCALL
-DIB_32PatCopy(PBLTINFO BltInfo)
-{
- ULONG delta;
- ULONG DestX, DestY, PatternY;
- PULONG DestBits;
+ for (DestX = BltInfo->DestRect.left; DestX <
BltInfo->DestRect.right; DestX++, DestBits++)
+ {
+
+ Pattern = DIB_GetSource(BltInfo->PatternSurface, PatternX,
PatternY, BltInfo->XlatePatternToDest);
+ *DestBits = DIB_DoRop(BltInfo->Rop4, *DestBits, 0, Pattern);
- if (!BltInfo->PatternSurface)
- {
- return DIB32_ColorFill(BltInfo,
XLATEOBJ_iXlate(BltInfo->XlatePatternToDest,
BltInfo->Brush->iSolidColor));
- }
+ PatternX++;
+ PatternX %= BltInfo->PatternSurface->sizlBitmap.cx;
+ }
+
+ PatternY++;
+ PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
+
+ DestBits = (PULONG)((ULONG_PTR)DestBits + Delta);
+ }
+ }
+ else if ((!UsesSource) && (!BltInfo->PatternSurface))
+ {
+ if (UsesPattern)
+ {
+ Pattern = BltInfo->Brush->iSolidColor;
+ }
- DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left << 2) +
- BltInfo->DestRect.top *
BltInfo->DestSurface->lDelta);
+ for (DestY = BltInfo->DestRect.top; DestY <
BltInfo->DestRect.bottom; DestY++)
+ {
- delta = BltInfo->DestSurface->lDelta -
((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2);
-
- PatternY = (BltInfo->DestRect.top + BltInfo->BrushOrigin.y) %
BltInfo->PatternSurface->sizlBitmap.cy;
-
- for (DestY = BltInfo->DestRect.top; DestY <
BltInfo->DestRect.bottom; DestY++)
- {
+ for (DestX = BltInfo->DestRect.left; DestX <
BltInfo->DestRect.right; DestX++, DestBits++)
+ {
+ *DestBits = DIB_DoRop(BltInfo->Rop4, *DestBits, 0, Pattern);
+ }
- for (DestX = BltInfo->DestRect.left; DestX <
BltInfo->DestRect.right; DestX++, DestBits++)
- {
- *DestBits = DIB_GetSource(BltInfo->PatternSurface, (DestX +
BltInfo->BrushOrigin.x) % BltInfo->PatternSurface->sizlBitmap.cx,
PatternY, BltInfo->XlatePatternToDest);
+ DestBits = (PULONG)((ULONG_PTR)DestBits + Delta);
}
-
- PatternY++;
- PatternY %= BltInfo->PatternSurface->sizlBitmap.cy;
+ }
- DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
- }
-
-
return TRUE;
}
+/* optimze functions for bitblt */
+
BOOLEAN
FASTCALL
DIB_32DstInvert(PBLTINFO BltInfo)
{
- ULONG DestX, DestY;
- PULONG DestBits;
+ ULONG DestX, DestY;
+ PULONG DestBits;
- ULONG bottom = BltInfo->DestRect.bottom;
- ULONG right = BltInfo->DestRect.right;
- ULONG delta = BltInfo->DestSurface->lDelta -
((BltInfo->DestRect.right - BltInfo->DestRect.left) <<2) ;
+ 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);
+ DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left << 2) +
+ BltInfo->DestRect.top *
BltInfo->DestSurface->lDelta);
- for (DestY = BltInfo->DestRect.top; DestY <
bottom; DestY++)
- {
- for (DestX = BltInfo->DestRect.left;
DestX < right; DestX++, DestBits++)
- {
-
- *DestBits = ~*DestBits ;
- }
+ for (DestY = BltInfo->DestRect.top; DestY < bottom; DestY++)
+ {
+ for (DestX = BltInfo->DestRect.left; DestX < right; DestX++,
DestBits++)
+ {
+ *DestBits = ~*DestBits ;
+ }
- DestBits = (PULONG)((ULONG_PTR)DestBits +
delta);
- }
+ DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
+ }
- /* Return TRUE */
- return TRUE;
+ /* Return TRUE */
+ return TRUE;
}
BOOLEAN
FASTCALL
DIB32_SrcErase(PBLTINFO BltInfo)
{
- BOOLEAN status = FALSE;
+ BOOLEAN status = FALSE;
- switch (BltInfo->SourceSurface->iBitmapFormat)
- {
- case BMF_1BPP:
- case BMF_4BPP:
- case BMF_16BPP:
- case BMF_24BPP:
- case BMF_32BPP:
- {
- ULONG DestX, DestY;
- ULONG SourceX, SourceY;
- PULONG DestBits;
+ switch (BltInfo->SourceSurface->iBitmapFormat)
+ {
+ case BMF_1BPP:
+ case BMF_4BPP:
+ case BMF_16BPP:
+ case BMF_24BPP:
+ 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) ;
+ 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);
+ DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left << 2) +
+ BltInfo->DestRect.top *
BltInfo->DestSurface->lDelta);
- SourceY = BltInfo->SourcePoint.y;
+ 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));
- }
+ 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;
+ DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
+ SourceY++;
+ }
+ }
+ status = TRUE;
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
return status;
}
@@ -553,51 +550,50 @@
FASTCALL
DIB32_NotSrcErase(PBLTINFO BltInfo)
{
- BOOLEAN status = FALSE;
+ BOOLEAN status = FALSE;
- switch (BltInfo->SourceSurface->iBitmapFormat)
- {
- case BMF_1BPP:
- case BMF_4BPP:
- case BMF_16BPP:
- case BMF_24BPP:
- case BMF_32BPP:
- {
- ULONG DestX, DestY;
- ULONG SourceX, SourceY;
- PULONG DestBits;
+ switch (BltInfo->SourceSurface->iBitmapFormat)
+ {
+ case BMF_1BPP:
+ case BMF_4BPP:
+ case BMF_16BPP:
+ case BMF_24BPP:
+ 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) ;
+ 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) +
+ DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left << 2) +
BltInfo->DestRect.top *
BltInfo->DestSurface->lDelta);
- SourceY = BltInfo->SourcePoint.y;
+ 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));
- }
+ 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++;
- }
+ DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
+ SourceY++;
+ }
- }
- status = TRUE;
- break;
+ }
+ status = TRUE;
+ break;
+ default:
+ break;
+ }
- default:
- break;
- }
-
return status;
}
@@ -605,214 +601,107 @@
FASTCALL
DIB32_SrcPaint(PBLTINFO BltInfo)
{
- BOOLEAN status = FALSE;
+ BOOLEAN status = FALSE;
+
+ switch (BltInfo->SourceSurface->iBitmapFormat)
+ {
+ case BMF_1BPP:
+ case BMF_4BPP:
+ case BMF_16BPP:
+ case BMF_24BPP:
+ {
+ ULONG DestX, DestY;
+ ULONG SourceX, SourceY;
+ PULONG DestBits;
- // return(Source);
- switch (BltInfo->SourceSurface->iBitmapFormat)
- {
- case BMF_1BPP:
- 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) ;
- 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);
+ DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left << 2) +
+ BltInfo->DestRect.top *
BltInfo->DestSurface->lDelta);
- SourceY = BltInfo->SourcePoint.y;
+ 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));
- }
+ 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++;
- }
+ DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
+ SourceY++;
+ }
- }
- status = TRUE;
- break;
+ }
+ status = TRUE;
+ break;
- case BMF_32BPP:
- {
- ULONG DestX, DestY;
- ULONG SourceX, SourceY;
- PULONG DestBits;
+ 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) ;
+ 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);
+ DestBits = (PULONG)(BltInfo->DestSurface->pvScan0 +
(BltInfo->DestRect.left << 2) +
+ BltInfo->DestRect.top *
BltInfo->DestSurface->lDelta);
- SourceY = BltInfo->SourcePoint.y;
+ 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_32BPP_GetPixel(BltInfo->SourceSurface, SourceX, SourceY));
- }
+ 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_32BPP_GetPixel(BltInfo->SourceSurface, SourceX, SourceY));
+ }
- DestBits = (PULONG)((ULONG_PTR)DestBits +
delta);
- SourceY++;
- }
+ DestBits = (PULONG)((ULONG_PTR)DestBits + delta);
+ SourceY++;
+ }
- }
- status = TRUE;
- break;
+ }
+ status = TRUE;
+ break;
- default:
- break;
+ default:
+ break;
}
return status;
}
BOOLEAN
-FASTCALL
-DIB32_Srccopy(PBLTINFO BltInfo)
-{
- BOOLEAN status = FALSE;
-
- // return(Source);
- switch (BltInfo->SourceSurface->iBitmapFormat)
- {
- case BMF_1BPP:
- case BMF_4BPP:
- case BMF_16BPP:
- case BMF_24BPP:
- {
[truncated at 1000 lines; 237 more skipped]