[DIBLIB]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 24 Mar 2012 16:19:48 +0000 (16:19 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 24 Mar 2012 16:19:48 +0000 (16:19 +0000)
- Implement support for bottom up bitblt
- Add solid pattern support in generic BitBlt function
- Make sure right-to-left is only used in the appropriate functions
- Fix 1bpp _NextPixel() macro

svn path=/trunk/; revision=56218

reactos/subsystems/win32/win32k/diblib/BitBlt.c
reactos/subsystems/win32/win32k/diblib/BitBlt_SRCCOPY.c
reactos/subsystems/win32/win32k/diblib/DibLib.h
reactos/subsystems/win32/win32k/diblib/DibLib_AllSrcBPP.h
reactos/subsystems/win32/win32k/diblib/DibLib_BitBlt.h
reactos/subsystems/win32/win32k/diblib/DibLib_interface.h

index f494f90..ed6384f 100644 (file)
@@ -6,9 +6,10 @@
 #define __USES_DEST 1
 #define __USES_MASK 0
 
+#define __FUNCTIONNAME BitBlt
+
 #define _DibDoRop(pBltData, M, D, S, P) pBltData->apfnDoRop[0](D,S,P)
 
-#define __FUNCTIONNAME BitBlt
 #include "DibLib_AllSrcBPP.h"
 
 #undef __FUNCTIONNAME
@@ -20,7 +21,17 @@ VOID
 FASTCALL
 Dib_BitBlt(PBLTDATA pBltData)
 {
-    gapfnBitBlt[pBltData->siDst.iFormat][pBltData->siSrc.iFormat](pBltData);
+    /* Check for solid brush */
+    if (pBltData->ulSolidColor != 0xFFFFFFFF)
+    {
+        /* Use the solid version of PATCOPY! */
+        gapfnBitBlt_Solid[pBltData->siDst.iFormat][pBltData->siSrc.iFormat](pBltData);
+    }
+    else
+    {
+        /* Use the pattern version */
+        gapfnBitBlt[pBltData->siDst.iFormat][pBltData->siSrc.iFormat](pBltData);
+    }
 }
 
 
index 75d691b..4c64ed5 100644 (file)
@@ -5,17 +5,20 @@ VOID
 FASTCALL
 Dib_BitBlt_SRCCOPY_EqSurf(PBLTDATA pBltData)
 {
-    ULONG cLines, cjWidth = pBltData->ulWidth * pBltData->jDstBpp;
+    ULONG cLines, cjWidth;
     PBYTE pjDestBase = pBltData->siDst.pjBase;
     PBYTE pjSrcBase = pBltData->siSrc.pjBase;
 
+    /* Calculate the width in bytes */
+    cjWidth = pBltData->ulWidth * pBltData->siDst.jBpp / 8;
+
     /* Loop all lines */
     cLines = pBltData->ulHeight;
     while (cLines--)
     {
         memcpy(pjDestBase, pjSrcBase, cjWidth);
-        pjDestBase += pBltData->siDst.lDelta;
-        pjSrcBase += pBltData->siSrc.lDelta;
+        pjDestBase += pBltData->siDst.cjAdvanceY;
+        pjSrcBase += pBltData->siSrc.cjAdvanceY;
     }
 }
 
@@ -38,8 +41,8 @@ Dib_BitBlt_SRCCOPY_S32_D32_EqSurf(PBLTDATA pBltData)
     while (cLines--)
     {
         __movsd((PULONG)pjDestBase, (PULONG)pjSrcBase, cRows);
-        pjDestBase += pBltData->siDst.lDelta;
-        pjSrcBase += pBltData->siSrc.lDelta;
+        pjDestBase += pBltData->siDst.cjAdvanceY;
+        pjSrcBase += pBltData->siSrc.cjAdvanceY;
     }
 }
 #else
index 5909799..ee46aba 100644 (file)
@@ -42,8 +42,8 @@ extern const BYTE ajShift4[2];
 
 #define _ReadPixel_1(pjSource, jShift) (((*(pjSource)) >> (jShift)) & 1)
 #define _WritePixel_1(pjDest, jShift, ulColor) (void)(*(pjDest) = (UCHAR)((*(pjDest) & ~(1<<(jShift))) | ((ulColor)<<(jShift))))
-#define _NextPixel_1(ppj, pjShift) (void)((*(pjShift))--, *(pjShift) &= 7, (*(ppj) += (*(pjShift) >> 5)))
-#define _NextPixelR2L_1(ppj, pjShift) (void)((*(ppj) -= (*(pjShift) >> 5)), (*(pjShift))++, *(pjShift) &= 7)
+#define _NextPixel_1(ppj, pjShift)    (void)(((*(pjShift))--), (*(pjShift) &= 7), (*(ppj) += (*(pjShift) == 7)))
+#define _NextPixelR2L_1(ppj, pjShift) (void)(((*(pjShift))++), (*(pjShift) &= 7), (*(ppj) -= (*(pjShift) == 0)))
 #define _SHIFT_1(x) x
 #define _CALCSHIFT_1(pShift, x) (void)(*(pShift) = (7 - ((x) & 7)))
 
index bdeef61..4f76724 100644 (file)
 #undef _DibXlate
 #define _DibXlate(pBltData, ulColor) (ulColor)
 #define _SOURCE_BPP _DEST_BPP
-#define _NextPixel_ _NextPixelR2L_
 
 #undef __DIB_FUNCTION_NAME
 #define __DIB_FUNCTION_NAME __DIB_FUNCTION_NAME_SRCDSTEQ
 #include "diblib_alldstbpp.h"
 
+#define _NextPixel_ _NextPixelR2L_
 #undef __DIB_FUNCTION_NAME
 #define __DIB_FUNCTION_NAME __DIB_FUNCTION_NAME_SRCDSTEQR2L
 #include "diblib_alldstbpp.h"
 #undef _SOURCE_BPP
+#undef _NextPixel_
 
 PFN_DIBFUNCTION
 __PASTE(gapfn, __FUNCTIONNAME)[7][7] =
index 63b9e5d..ed5ab24 100644 (file)
@@ -77,7 +77,7 @@ _DibFunction(PBLTDATA pBltData)
 #if __USES_MASK
             /* Read the mask color and go to the next mask pixel */
             jMaskBit = _ReadPixel_1(pjMask, jMskShift);
-            _NextPixel_1(&pjMask, &jMskShift);
+            _NextPixel(1, &pjMask, &jMskShift);
 #endif
 #if __USES_PATTERN
             /* Read the pattern color and go to the next pattern pixel */
@@ -110,13 +110,13 @@ _DibFunction(PBLTDATA pBltData)
             _NextPixel(_DEST_BPP, &pjDest, &jDstShift);
         }
 
-        pjDestBase += pBltData->siDst.lDelta;
+        pjDestBase += pBltData->siDst.cjAdvanceY;
 #if __USES_SOURCE
-        pjSrcBase += pBltData->siSrc.lDelta;
+        pjSrcBase += pBltData->siSrc.cjAdvanceY;
 #endif
 #if __USES_PATTERN
         /* Go to the next pattern line */
-        pjPatBase += pBltData->siPat.lDelta;
+        pjPatBase += pBltData->siPat.cjAdvanceY;
 
         /* Check if this was the last line in the pattern */
         if (--cPatLines == 0)
index f4dab24..bacf927 100644 (file)
@@ -7,6 +7,7 @@ typedef struct
     PBYTE pvScan0;
     PBYTE pjBase;
     LONG lDelta;
+    LONG cjAdvanceY;
     POINTL ptOrig;
     BYTE jBpp;
 } SURFINFO;
@@ -27,7 +28,7 @@ typedef struct
     ULONG rop4;
     PFN_DOROP apfnDoRop[2];
     ULONG ulSolidColor;
-    BYTE jDstBpp;
+    LONG dy;
 } BLTDATA, *PBLTDATA;
 
 typedef