ReactOS 0.4.15-dev-7924-g5949c20
DibLib_BitBlt.h
Go to the documentation of this file.
1
2#if __USES_SOLID_BRUSH
3#undef __USES_PATTERN
4#define __USES_PATTERN 0
5#endif
6
7#define _DibFunction __DIB_FUNCTION_NAME(__FUNCTIONNAME, _SOURCE_BPP, _DEST_BPP)
8#define _ReadPixel(bpp, pj, jShift) __PASTE(_ReadPixel_, bpp)(pj, jShift)
9#define _WritePixel(pj, jShift, c) __PASTE(_WritePixel_, _DEST_BPP)(pj, jShift, c)
10#define _NextPixel(bpp, ppj, pjShift) __PASTE(_NextPixel_, bpp)(ppj, pjShift)
11#define _SHIFT(bpp, x) __PASTE(_SHIFT_, bpp)(x)
12#define _CALCSHIFT(bpp, pshift, x) __PASTE(_CALCSHIFT_, bpp)(pshift, x)
13
14#if (__PASTE(_DibFunction, _manual) != 1)
15
16VOID
19{
20 ULONG cRows, cLines, ulDest;
21 PBYTE pjDest, pjDestBase;
22 _SHIFT(_DEST_BPP, BYTE jDstShift;)
24 PBYTE pjMask, pjMaskBase;
25 BYTE jMaskBit, jMskShift;
26#endif
27#if __USES_SOURCE
28 PBYTE pjSource, pjSrcBase;
29 ULONG ulSource;
30 _SHIFT(_SOURCE_BPP, BYTE jSrcShift;)
31#endif
33 PBYTE pjPattern, pjPatBase;
34 ULONG ulPattern, cPatRows, cPatLines;
35 _SHIFT(_DEST_BPP, BYTE jPatShift;)
36#endif
38 ULONG ulPattern = pBltData->ulSolidColor;
39#endif
40
42 pjMaskBase = pBltData->siMsk.pjBase;
43#endif
45 pjPatBase = pBltData->siPat.pjBase;
46 pjPatBase += pBltData->siPat.ptOrig.y * pBltData->siPat.lDelta;
47 cPatLines = pBltData->ulPatHeight - pBltData->siPat.ptOrig.y;
48#endif
49 pjDestBase = pBltData->siDst.pjBase;
51 pjSrcBase = pBltData->siSrc.pjBase;
52#endif
53
54 /* Loop all lines */
55 cLines = pBltData->ulHeight;
56 while (cLines--)
57 {
58 /* Set current bit pointers and shifts */
59 pjDest = pjDestBase;
60 _CALCSHIFT(_DEST_BPP, &jDstShift, pBltData->siDst.ptOrig.x);
61#if __USES_SOURCE
62 pjSource = pjSrcBase;
63 _CALCSHIFT(_SOURCE_BPP, &jSrcShift, pBltData->siSrc.ptOrig.x);
64#endif
65#if __USES_MASK
66 pjMask = pjMaskBase;
67 _CALCSHIFT_1(&jMskShift, pBltData->siMsk.ptOrig.x);
68#endif
69#if __USES_PATTERN
70 pjPattern = pjPatBase + pBltData->siPat.ptOrig.x * _DEST_BPP / 8;
71 _CALCSHIFT(_DEST_BPP, &jPatShift, pBltData->siPat.ptOrig.x);
72 cPatRows = pBltData->ulPatWidth - pBltData->siPat.ptOrig.x;
73#endif
74
75 /* Loop all rows */
76 cRows = pBltData->ulWidth;
77 while (cRows--)
78 {
79#if __USES_MASK
80 /* Read the mask color and go to the next mask pixel */
81 jMaskBit = _ReadPixel_1(pjMask, jMskShift);
82 _NextPixel(1, &pjMask, &jMskShift);
83#endif
84#if __USES_PATTERN
85 /* Read the pattern color and go to the next pattern pixel */
86 ulPattern = _ReadPixel(_DEST_BPP, pjPattern, jPatShift);
87 _NextPixel(_DEST_BPP, &pjPattern, &jPatShift);
88
89 /* Check if this was the last pixel in the pattern */
90 if (--cPatRows == 0)
91 {
92 /* Restart pattern from x = 0 */
93 pjPattern = pjPatBase;
94 _SHIFT(_DEST_BPP, jPatShift = (_DEST_BPP == 1) ? 7 : 4;)
95 cPatRows = pBltData->ulPatWidth;
96 }
97#endif
98#if __USES_SOURCE
99 /* Read the pattern color, xlate it and go to the next pixel */
100 ulSource = _ReadPixel(_SOURCE_BPP, pjSource, jSrcShift);
101 ulSource = _DibXlate(pBltData, ulSource);
102 _NextPixel(_SOURCE_BPP, &pjSource, &jSrcShift);
103#endif
104#if __USES_DEST
105 ulDest = _ReadPixel(_DEST_BPP, pjDest, jDstShift);
106#endif
107 /* Apply the ROP operation on the colors */
108 ulDest = _DibDoRop(pBltData, jMaskBit, ulDest, ulSource, ulPattern);
109
110 /* Write the pixel and go to the next dest pixel */
111 _WritePixel(pjDest, jDstShift, ulDest);
112 _NextPixel(_DEST_BPP, &pjDest, &jDstShift);
113 }
114
115 pjDestBase += pBltData->siDst.cjAdvanceY;
116#if __USES_SOURCE
117 pjSrcBase += pBltData->siSrc.cjAdvanceY;
118#endif
119#if __USES_PATTERN
120 /* Go to the next pattern line */
121 pjPatBase += pBltData->siPat.cjAdvanceY;
122
123 /* Check if this was the last line in the pattern */
124 if (--cPatLines == 0)
125 {
126 /* Restart pattern from y = 0 */
127 pjPatBase = pBltData->siPat.pjBase;
128 cPatLines = pBltData->ulPatHeight;
129 }
130#endif
131 }
132}
133
134#endif // manual
135
136#undef _DibFunction
137#undef __FUNCTIONNAME2
#define __USES_SOLID_BRUSH
Definition: BitBlt.c:17
#define __USES_MASK
Definition: BitBlt.c:7
#define __USES_SOURCE
Definition: BitBlt.c:4
#define __USES_PATTERN
Definition: BitBlt.c:5
#define _DibDoRop(pBltData, M, D, S, P)
Definition: BitBlt.c:11
#define _CALCSHIFT_1(pShift, x)
Definition: DibLib.h:48
#define _ReadPixel_1(pjSource, jShift)
Definition: DibLib.h:43
#define _DibXlate(pBltData, ulColor)
Definition: DibLib.h:29
#define _SOURCE_BPP
#define _DEST_BPP
#define _CALCSHIFT(bpp, pshift, x)
Definition: DibLib_BitBlt.h:12
#define _SHIFT(bpp, x)
Definition: DibLib_BitBlt.h:11
#define _NextPixel(bpp, ppj, pjShift)
Definition: DibLib_BitBlt.h:10
#define _ReadPixel(bpp, pj, jShift)
Definition: DibLib_BitBlt.h:8
#define _DibFunction
Definition: DibLib_BitBlt.h:7
#define _WritePixel(pj, jShift, c)
Definition: DibLib_BitBlt.h:9
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
#define FASTCALL
Definition: nt_native.h:50
BYTE * PBYTE
Definition: pedump.c:66
SURFINFO siSrc
SURFINFO siPat
ULONG ulSolidColor
ULONG ulPatWidth
ULONG ulPatHeight
ULONG ulWidth
SURFINFO siDst
ULONG ulHeight
SURFINFO siMsk
PBYTE pjBase
POINTL ptOrig
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
uint32_t ULONG
Definition: typedefs.h:59
unsigned char BYTE
Definition: xxhash.c:193