ReactOS 0.4.15-dev-7942-gd23573b
bitblt_new.c File Reference
#include <win32k.h>
#include "../diblib/DibLib_interface.h"
Include dependency graph for bitblt_new.c:

Go to the source code of this file.

Macros

#define SURFOBJ_flags(pso)   (CONTAINING_RECORD(pso, SURFACE, SurfObj)->flags)
 

Functions

 DBG_DEFAULT_CHANNEL (GdiFont)
 
static void CalculateCoordinates (PBLTDATA pbltdata, PRECTL prclClipped, PRECTL prclOrg, PPOINTL pptlSrc, PPOINTL pptlMask, PPOINTL pptlPat, PSIZEL psizlPat)
 
BOOL APIENTRY EngBitBlt (_Inout_ SURFOBJ *psoTrg, _In_opt_ SURFOBJ *psoSrc, _In_opt_ SURFOBJ *psoMask, _In_opt_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ RECTL *prclTrg, _When_(psoSrc, _In_) POINTL *pptlSrc, _When_(psoMask, _In_) POINTL *pptlMask, _In_opt_ BRUSHOBJ *pbo, _When_(pbo, _In_) POINTL *pptlBrush, _In_ ROP4 rop4)
 
static VOID AdjustOffsetAndSize (_Out_ PPOINTL pptOffset, _Out_ PSIZEL psizTrg, _In_ PPOINTL pptlSrc, _In_ PSIZEL psizSrc)
 
BOOL APIENTRY IntEngBitBlt (_Inout_ SURFOBJ *psoTrg, _In_opt_ SURFOBJ *psoSrc, _In_opt_ SURFOBJ *psoMask, _In_opt_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ RECTL *prclTrg, _When_(psoSrc, _In_) POINTL *pptlSrc, _When_(psoMask, _In_) POINTL *pptlMask, _In_opt_ BRUSHOBJ *pbo, _When_(pbo, _In_) POINTL *pptlBrush, _In_ ROP4 rop4)
 
BOOL APIENTRY NtGdiEngBitBlt (IN SURFOBJ *psoTrgUMPD, IN SURFOBJ *psoSrcUMPD, IN SURFOBJ *psoMaskUMPD, IN CLIPOBJ *pcoUMPD, IN XLATEOBJ *pxloUMPD, IN RECTL *prclTrg, IN POINTL *pptlSrc, IN POINTL *pptlMask, IN BRUSHOBJ *pboUMPD, IN POINTL *pptlBrush, IN ROP4 rop4)
 
BOOL APIENTRY EngCopyBits (SURFOBJ *psoTrg, SURFOBJ *psoSrc, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc)
 
BOOL APIENTRY IntEngCopyBits (SURFOBJ *psoTrg, SURFOBJ *psoSrc, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc)
 

Variables

XCLIPOBJ gxcoTrivial
 

Macro Definition Documentation

◆ SURFOBJ_flags

#define SURFOBJ_flags (   pso)    (CONTAINING_RECORD(pso, SURFACE, SurfObj)->flags)

Definition at line 6 of file bitblt_new.c.

Function Documentation

◆ AdjustOffsetAndSize()

static VOID AdjustOffsetAndSize ( _Out_ PPOINTL  pptOffset,
_Out_ PSIZEL  psizTrg,
_In_ PPOINTL  pptlSrc,
_In_ PSIZEL  psizSrc 
)
static

Definition at line 361 of file bitblt_new.c.

366{
367 LONG x, y, cxMax, cyMax;
368
369 x = pptlSrc->x + pptOffset->x;
370 if (x < 0) pptOffset->x -= x, x = 0;
371
372 cxMax = psizSrc->cx - x;
373 if (psizTrg->cx > cxMax) psizTrg->cx = cxMax;
374
375 y = pptlSrc->y + pptOffset->y;
376 if (y < 0) pptOffset->y -= y, y = 0;
377
378 cyMax = psizSrc->cy - y;
379 if (psizTrg->cy > cyMax) psizTrg->cy = cyMax;
380}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
long LONG
Definition: pedump.c:60
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL * pptlSrc
Definition: winddi.h:3438

Referenced by IntEngBitBlt().

◆ CalculateCoordinates()

static void CalculateCoordinates ( PBLTDATA  pbltdata,
PRECTL  prclClipped,
PRECTL  prclOrg,
PPOINTL  pptlSrc,
PPOINTL  pptlMask,
PPOINTL  pptlPat,
PSIZEL  psizlPat 
)
static

Definition at line 19 of file bitblt_new.c.

27{
28 ULONG cx, cy;
29
30 /* Calculate width and height of this rect */
31 pbltdata->ulWidth = prclClipped->right - prclClipped->left;
32 pbltdata->ulHeight = prclClipped->bottom - prclClipped->top;
33
34 /* Calculate the x offset to the origin coordinates */
35 if (pbltdata->siDst.iFormat == 0)
36 cx = (prclClipped->right - 1 - prclOrg->left);
37 else
38 cx = (prclClipped->left - prclOrg->left);
39
40 /* Calculate the y offset to the origin coordinates */
41 if (pbltdata->dy < 0)
42 cy = (prclClipped->bottom - 1 - prclOrg->top);
43 else
44 cy = (prclClipped->top - prclOrg->top);
45
46 /* Calculate the target start point */
47 pbltdata->siDst.ptOrig.x = prclOrg->left + cx;
48 pbltdata->siDst.ptOrig.y = prclOrg->top + cy;
49
50 /* Calculate start position for target */
51 pbltdata->siDst.pjBase = pbltdata->siDst.pvScan0;
52 pbltdata->siDst.pjBase += pbltdata->siDst.ptOrig.y * pbltdata->siDst.lDelta;
53 pbltdata->siDst.pjBase += pbltdata->siDst.ptOrig.x * pbltdata->siDst.jBpp / 8;
54
55 if (pptlSrc)
56 {
57 /* Calculate start point and bitpointer for source */
58 pbltdata->siSrc.ptOrig.x = pptlSrc->x + cx;
59 pbltdata->siSrc.ptOrig.y = pptlSrc->y + cy;
60 pbltdata->siSrc.pjBase = pbltdata->siSrc.pvScan0;
61 pbltdata->siSrc.pjBase += pbltdata->siSrc.ptOrig.y * pbltdata->siSrc.lDelta;
62 pbltdata->siSrc.pjBase += pbltdata->siSrc.ptOrig.x * pbltdata->siSrc.jBpp / 8;
63 }
64
65 if (pptlMask)
66 {
67 /* Calculate start point and bitpointer for mask */
68 pbltdata->siMsk.ptOrig.x = pptlMask->x + cx;
69 pbltdata->siMsk.ptOrig.y = pptlMask->y + cy;
70 pbltdata->siMsk.pjBase = pbltdata->siMsk.pvScan0;
71 pbltdata->siMsk.pjBase += pbltdata->siMsk.ptOrig.y * pbltdata->siMsk.lDelta;
72 pbltdata->siMsk.pjBase += pbltdata->siMsk.ptOrig.x * pbltdata->siMsk.jBpp / 8;
73 }
74
75 if (pptlPat)
76 {
77 /* Calculate start point and bitpointer for pattern */
78 pbltdata->siPat.ptOrig.x = (pptlPat->x + cx) % psizlPat->cx;
79 pbltdata->siPat.ptOrig.y = (pptlPat->y + cy) % psizlPat->cy;
80 pbltdata->siPat.pjBase = pbltdata->siPat.pvScan0;
81
82 /* Check for bottom-up case */
83 if (pbltdata->dy < 0)
84 {
85 pbltdata->siPat.pjBase += (psizlPat->cy - 1) * pbltdata->siPat.lDelta;
86 pbltdata->siPat.ptOrig.y = psizlPat->cy - 1 - pbltdata->siPat.ptOrig.y;
87 }
88
89 /* Check for right-to-left case */
90 if (pbltdata->siDst.iFormat == 0)
91 {
92 pbltdata->siPat.pjBase += (psizlPat->cx - 1) * pbltdata->siMsk.jBpp / 8;
93 pbltdata->siPat.ptOrig.x = psizlPat->cx - 1 - pbltdata->siPat.ptOrig.x;
94 }
95 }
96}
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
SURFINFO siSrc
SURFINFO siPat
ULONG ulWidth
SURFINFO siDst
ULONG ulHeight
SURFINFO siMsk
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
PBYTE pjBase
PBYTE pvScan0
POINTL ptOrig
ULONG iFormat
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
uint32_t ULONG
Definition: typedefs.h:59
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL _In_opt_ POINTL * pptlMask
Definition: winddi.h:3439

Referenced by EngBitBlt().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( GdiFont  )

◆ EngBitBlt()

BOOL APIENTRY EngBitBlt ( _Inout_ SURFOBJ psoTrg,
_In_opt_ SURFOBJ psoSrc,
_In_opt_ SURFOBJ psoMask,
_In_opt_ CLIPOBJ pco,
_In_opt_ XLATEOBJ pxlo,
_In_ RECTL prclTrg,
_When_(psoSrc, _In_) POINTL pptlSrc,
_When_(psoMask, _In_) POINTL pptlMask,
_In_opt_ BRUSHOBJ pbo,
_When_(pbo, _In_) POINTL pptlBrush,
_In_ ROP4  rop4 
)

Definition at line 100 of file bitblt_new.c.

112{
113 BLTDATA bltdata;
114 ULONG i, iFunctionIndex, iDirection = CD_ANY;
115 RECTL rcTrg;
116 PFN_DIBFUNCTION pfnBitBlt;
117 BOOL bEnumMore;
118 RECT_ENUM rcenum;
119 PSIZEL psizlPat;
121
122//static int count = 0;
123//if (++count >= 1230) __debugbreak();
124
125 /* Sanity checks */
126 ASSERT(psoTrg);
127 ASSERT(psoTrg->iBitmapFormat >= BMF_1BPP);
128 ASSERT(psoTrg->iBitmapFormat <= BMF_32BPP);
130 ASSERT(prclTrg->left >= 0);
131 ASSERT(prclTrg->top >= 0);
132 ASSERT(prclTrg->right <= psoTrg->sizlBitmap.cx);
133 ASSERT(prclTrg->bottom <= psoTrg->sizlBitmap.cy);
134
135 rcTrg = *prclTrg;
136
137 bltdata.dy = 1;
138 bltdata.rop4 = rop4;
139 bltdata.apfnDoRop[0] = gapfnRop[ROP4_BKGND(rop4)];
140 bltdata.apfnDoRop[1] = gapfnRop[ROP4_FGND(rop4)];
141 if (!pxlo) pxlo = &gexloTrivial.xlo;
142 bltdata.pxlo = pxlo;
144
145 /* Check if the ROP uses a source */
147 {
148 /* Sanity checks */
149 ASSERT(psoSrc);
150 ASSERT(psoSrc->iBitmapFormat >= BMF_1BPP);
151 ASSERT(psoSrc->iBitmapFormat <= BMF_32BPP);
153 ASSERT(pptlSrc->x >= 0);
154 ASSERT(pptlSrc->y >= 0);
155 ASSERT(pptlSrc->x <= psoSrc->sizlBitmap.cx);
156 ASSERT(pptlSrc->y <= psoSrc->sizlBitmap.cy);
157
158 /* Check if source and target are equal */
159 if (psoSrc == psoTrg)
160 {
161 /* Analyze the copying direction */
162 if (rcTrg.top > pptlSrc->y)
163 {
164 /* Need to copy from bottom to top */
165 iDirection = rcTrg.left < pptlSrc->x ? CD_RIGHTUP : CD_LEFTUP;
166 bltdata.dy = -1;
167 }
168 else
169 iDirection = rcTrg.left < pptlSrc->x ? CD_RIGHTDOWN : CD_LEFTDOWN;
170
171 /* Check for special right to left case */
172 if ((rcTrg.top == pptlSrc->y) && (rcTrg.left > pptlSrc->x))
173 {
174 /* Use 0 as target format to get special right to left versions */
175 bltdata.siDst.iFormat = 0;
176 bltdata.siSrc.iFormat = psoSrc->iBitmapFormat;
177 //__debugbreak();
178 }
179 else
180 {
181 /* Use 0 as source format to get special equal surface versions */
182 bltdata.siDst.iFormat = psoTrg->iBitmapFormat;
183 bltdata.siSrc.iFormat = 0;
184 }
185 }
186 else
187 {
188 bltdata.siDst.iFormat = psoTrg->iBitmapFormat;
189 bltdata.siSrc.iFormat = psoSrc->iBitmapFormat;
190 }
191
192 /* Set the source format info */
193 bltdata.siSrc.pvScan0 = psoSrc->pvScan0;
194 bltdata.siSrc.lDelta = psoSrc->lDelta;
195 bltdata.siSrc.cjAdvanceY = bltdata.dy * psoSrc->lDelta;
196 bltdata.siSrc.jBpp = gajBitsPerFormat[psoSrc->iBitmapFormat];
197 }
198 else
199 {
200 bltdata.siDst.iFormat = psoTrg->iBitmapFormat;
201 }
202
203 /* Set the destination format info */
204 bltdata.siDst.pvScan0 = psoTrg->pvScan0;
205 bltdata.siDst.lDelta = psoTrg->lDelta;
206 bltdata.siDst.cjAdvanceY = bltdata.dy * psoTrg->lDelta;
207 bltdata.siDst.jBpp = gajBitsPerFormat[psoTrg->iBitmapFormat];
208
209 /* Check if the ROP uses a pattern / brush */
211 {
212 /* Must have a brush */
213 NT_ASSERT(pbo); // FIXME: test this!
214
215 /* Copy the solid color */
216 bltdata.ulSolidColor = pbo->iSolidColor;
217
218 /* Check if this is a pattern brush */
219 if (pbo->iSolidColor == 0xFFFFFFFF)
220 {
221 /* Get the realized pattern bitmap */
223 if (!psoPattern)
224 {
225 __debugbreak();
226 return FALSE;
227 }
228
229 /* Set the pattern format info */
230 bltdata.siPat.iFormat = psoPattern->iBitmapFormat;
231 bltdata.siPat.pvScan0 = psoPattern->pvScan0;
232 bltdata.siPat.lDelta = psoPattern->lDelta;
233 bltdata.siPat.cjAdvanceY = bltdata.dy * psoPattern->lDelta;
234 bltdata.siPat.jBpp = gajBitsPerFormat[psoPattern->iBitmapFormat];
235
236 bltdata.ulPatWidth = psoPattern->sizlBitmap.cx;
237 bltdata.ulPatHeight = psoPattern->sizlBitmap.cy;
238
239 psizlPat = &psoPattern->sizlBitmap;
240 }
241 else
242 {
243 pptlBrush = NULL;
244 psizlPat = NULL;
245 }
246 }
247 else
248 {
249 pptlBrush = NULL;
250 psizlPat = NULL;
251 }
252
253 /* Check if the ROP uses a mask */
254 if (ROP4_USES_MASK(rop4))
255 {
256 //__debugbreak();
257
258 /* Check if we don't have a mask surface */
259 if (psoMask == NULL)
260 {
261 /* Must have a brush */
262 NT_ASSERT(pbo); // FIXME: test this!
263
264 /* Check if the BRUSHOBJ can provide the mask */
266 if (psoMask == NULL)
267 {
268 /* We have no mask, assume the mask is all foreground */
269 rop4 = (rop4 & 0xFF) || ((rop4 & 0xFF) << 8);
270 }
271 }
272
273 /* Set the mask format info */
274 bltdata.siMsk.iFormat = psoMask->iBitmapFormat;
275 bltdata.siMsk.pvScan0 = psoMask->pvScan0;
276 bltdata.siMsk.lDelta = psoMask->lDelta;
277 bltdata.siMsk.cjAdvanceY = bltdata.dy * psoMask->lDelta;
278 bltdata.siMsk.jBpp = 1;
279
280 /* Calculate the masking function index */
281 iFunctionIndex = ROP4_USES_PATTERN(rop4) ? 1 : 0;
282 iFunctionIndex |= ROP4_USES_SOURCE(rop4) ? 2 : 0;
283 iFunctionIndex |= ROP4_USES_DEST(rop4) ? 4 : 0;
284
285 /* Get the masking function */
286 pfnBitBlt = gapfnMaskFunction[iFunctionIndex];
287 }
288 else
289 {
290 /* Get the function index from the foreground ROP index*/
291 iFunctionIndex = gajIndexPerRop[ROP4_FGND(rop4)];
292
293 /* Get the dib function */
294 pfnBitBlt = gapfnDibFunction[iFunctionIndex];
295 }
296
297 /* If no clip object is given, use trivial one */
298 if (!pco) pco = (CLIPOBJ*)&gxcoTrivial;
299
300 /* Check if we need to enumerate rects */
301 if (pco->iDComplexity == DC_COMPLEX)
302 {
303 /* Start the enumeration of the clip object */
304 CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, iDirection, 0);
305 bEnumMore = CLIPOBJ_bEnum(pco, sizeof(rcenum), (ULONG*)&rcenum);
306 }
307 else if (pco->iDComplexity == DC_RECT)
308 {
309 /* Use the clip bounds */
310 rcenum.arcl[0] = pco->rclBounds;
311 rcenum.c = 1;
312 bEnumMore = FALSE;
313 }
314 else
315 {
316 /* Use the target rect */
317 rcenum.arcl[0] = rcTrg;
318 rcenum.c = 1;
319 bEnumMore = FALSE;
320 }
321
322 /* Enter enumeration loop */
323 while (TRUE)
324 {
325 /* Loop all rectangles we got */
326 for (i = 0; i < rcenum.c; i++)
327 {
328 /* Intersect this rect with the target rect */
329 if (!RECTL_bIntersectRect(&rcenum.arcl[i], &rcenum.arcl[i], &rcTrg))
330 {
331 /* This rect is outside the bounds, continue */
332 continue;
333 }
334
335 /* Calculate coordinates and pointers */
336 CalculateCoordinates(&bltdata,
337 &rcenum.arcl[i],
338 prclTrg,
339 pptlSrc,
340 pptlMask,
341 pptlBrush,
342 psizlPat);
343
344 /* Call the dib function */
345 pfnBitBlt(&bltdata);
346 }
347
348 /* Bail out, when there's nothing more to do */
349 if(!bEnumMore) break;
350
351 /* Enumerate more rectangles */
352 bEnumMore = CLIPOBJ_bEnum(pco, sizeof(rcenum), (ULONG*)&rcenum);
353 }
354
355 return TRUE;
356}
const UCHAR gajIndexPerRop[256]
Definition: DibLib.c:80
const PFN_DIBFUNCTION gapfnMaskFunction[8]
Definition: DibLib.c:341
const PFN_DIBFUNCTION gapfnDibFunction[]
Definition: DibLib.c:54
VOID(FASTCALL * PFN_DIBFUNCTION)(PBLTDATA pBltData)
const PFN_DOROP gapfnRop[256]
static void CalculateCoordinates(PBLTDATA pbltdata, PRECTL prclClipped, PRECTL prclOrg, PPOINTL pptlSrc, PPOINTL pptlMask, PPOINTL pptlPat, PSIZEL psizlPat)
Definition: bitblt_new.c:19
XCLIPOBJ gxcoTrivial
Definition: bitblt.c:20
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define BRUSHOBJ_psoPattern(pbo)
Definition: brush.h:175
#define BRUSHOBJ_psoMask(pbo)
Definition: brush.h:182
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ROP4_USES_DEST(Rop4)
Definition: inteng.h:44
#define ROP4_BKGND(Rop4)
Definition: inteng.h:52
#define ROP4_USES_PATTERN(Rop4)
Definition: inteng.h:46
#define ROP4_USES_MASK(Rop4)
Definition: inteng.h:47
#define ROP4_FGND(Rop4)
Definition: inteng.h:51
#define ROP4_USES_SOURCE(Rop4)
Definition: inteng.h:45
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
#define ASSERT(a)
Definition: mode.c:44
XLATEOBJ * pxlo
ULONG ulSolidColor
ULONG ulPatWidth
PFN_DOROP apfnDoRop[2]
ULONG ulPatHeight
PFN_XLATE pfnXlate
XLATEOBJ xlo
Definition: xlateobj.h:21
ULONG c
Definition: vgaddi.h:78
RECTL arcl[ENUM_RECT_LIMIT]
Definition: vgaddi.h:79
UCHAR gajBitsPerFormat[11]
Definition: surface.c:21
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
_Inout_ SURFOBJ _In_opt_ SURFOBJ * psoPattern
Definition: winddi.h:3960
#define BMF_1BPP
Definition: winddi.h:355
#define CT_RECTANGLES
Definition: winddi.h:1317
ENGAPI BOOL APIENTRY CLIPOBJ_bEnum(_In_ CLIPOBJ *pco, _In_ ULONG cj, _Out_bytecap_(cj) ULONG *pul)
Definition: clip.c:319
#define CD_RIGHTUP
Definition: winddi.h:1323
#define CD_LEFTDOWN
Definition: winddi.h:1321
#define DC_COMPLEX
Definition: winddi.h:261
_In_ SURFOBJ * psoSrc
Definition: winddi.h:3414
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL * prclTrg
Definition: winddi.h:3437
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL _In_opt_ POINTL _In_opt_ BRUSHOBJ _In_opt_ POINTL _In_ ROP4 rop4
Definition: winddi.h:3442
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL _In_opt_ POINTL _In_opt_ BRUSHOBJ _In_opt_ POINTL * pptlBrush
Definition: winddi.h:3441
_In_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ * pxlo
Definition: winddi.h:3416
_In_opt_ SURFOBJ _In_opt_ SURFOBJ * psoMask
Definition: winddi.h:3434
#define BMF_32BPP
Definition: winddi.h:360
ENGAPI ULONG APIENTRY CLIPOBJ_cEnumStart(_Inout_ CLIPOBJ *pco, _In_ BOOL bAll, _In_ ULONG iType, _In_ ULONG iDirection, _In_ ULONG cLimit)
Definition: clip.c:255
#define DC_RECT
Definition: winddi.h:260
#define CD_RIGHTDOWN
Definition: winddi.h:1320
#define CD_ANY
Definition: winddi.h:1326
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL _In_opt_ POINTL _In_opt_ BRUSHOBJ * pbo
Definition: winddi.h:3440
#define CD_LEFTUP
Definition: winddi.h:1325
_In_ SURFOBJ _In_ CLIPOBJ * pco
Definition: winddi.h:3415
#define NT_ASSERT
Definition: rtlfuncs.h:3310
EXLATEOBJ gexloTrivial
_Notnull_ FORCEINLINE PFN_XLATE XLATEOBJ_pfnXlate(_In_ XLATEOBJ *pxlo)
Definition: xlateobj.h:51

Referenced by EngCopyBits(), IntEngBitBlt(), and NtGdiEngBitBlt().

◆ EngCopyBits()

BOOL APIENTRY EngCopyBits ( SURFOBJ psoTrg,
SURFOBJ psoSrc,
CLIPOBJ pco,
XLATEOBJ pxlo,
RECTL prclTrg,
POINTL pptlSrc 
)

Definition at line 637 of file bitblt_new.c.

644{
645 PFN_DrvCopyBits pfnCopyBits;
646
647 /* Is the target surface device managed? */
648 if (SURFOBJ_flags(psoTrg) & HOOK_COPYBITS)
649 {
650 pfnCopyBits = GDIDEVFUNCS(psoTrg).CopyBits;
651 }
653 {
654 pfnCopyBits = GDIDEVFUNCS(psoSrc).CopyBits;
655 }
656 else
657 {
658 /* Use SRCCOPY for 2 bitmaps */
659 return EngBitBlt(psoTrg,
660 psoSrc,
661 NULL,
662 pco,
663 pxlo,
664 prclTrg,
665 pptlSrc,
666 NULL,
667 NULL,
668 NULL,
670 }
671
672 /* Forward to the driver */
673 return pfnCopyBits(psoTrg, psoSrc, pco, pxlo, prclTrg, pptlSrc);
674}
BOOL APIENTRY EngBitBlt(_Inout_ SURFOBJ *psoTrg, _In_opt_ SURFOBJ *psoSrc, _In_opt_ SURFOBJ *psoMask, _In_opt_ CLIPOBJ *pco, _In_opt_ XLATEOBJ *pxlo, _In_ RECTL *prclTrg, _When_(psoSrc, _In_) POINTL *pptlSrc, _When_(psoMask, _In_) POINTL *pptlMask, _In_opt_ BRUSHOBJ *pbo, _When_(pbo, _In_) POINTL *pptlBrush, _In_ ROP4 rop4)
Definition: bitblt_new.c:100
#define SURFOBJ_flags(pso)
Definition: bitblt_new.c:6
#define ROP4_SRCCOPY
Definition: dib.h:13
#define GDIDEVFUNCS(SurfObj)
Definition: surface.h:106
FN_DrvCopyBits * PFN_DrvCopyBits
Definition: winddi.h:3461
#define HOOK_COPYBITS
Definition: winddi.h:1429

Referenced by IntEngCopyBits().

◆ IntEngBitBlt()

BOOL APIENTRY IntEngBitBlt ( _Inout_ SURFOBJ psoTrg,
_In_opt_ SURFOBJ psoSrc,
_In_opt_ SURFOBJ psoMask,
_In_opt_ CLIPOBJ pco,
_In_opt_ XLATEOBJ pxlo,
_In_ RECTL prclTrg,
_When_(psoSrc, _In_) POINTL pptlSrc,
_When_(psoMask, _In_) POINTL pptlMask,
_In_opt_ BRUSHOBJ pbo,
_When_(pbo, _In_) POINTL pptlBrush,
_In_ ROP4  rop4 
)

Definition at line 384 of file bitblt_new.c.

396{
397 BOOL bResult;
398 RECTL rcClipped;
399 POINTL ptOffset, ptSrc, ptMask, ptBrush;
400 SIZEL sizTrg;
401 PFN_DrvBitBlt pfnBitBlt;
402
403//__debugbreak();
404
405 /* Sanity checks */
407 ASSERT(psoTrg);
408 ASSERT(psoTrg->iBitmapFormat >= BMF_1BPP);
409 ASSERT(psoTrg->iBitmapFormat <= BMF_32BPP);
411
412 /* Clip the target rect to the extents of the target surface */
413 if (!RECTL_bClipRectBySize(&rcClipped, prclTrg, &psoTrg->sizlBitmap))
414 {
415 /* Nothing left */
416 return TRUE;
417 }
418
419 /* If no clip object is given, use trivial one */
420 if (!pco) pco = (CLIPOBJ*)&gxcoTrivial;
421
422 /* Check if there is something to clip */
423 if (pco->iDComplexity != DC_TRIVIAL)
424 {
425 /* Clip the target rect to the bounds of the clipping region */
426 if (!RECTL_bIntersectRect(&rcClipped, &rcClipped, &pco->rclBounds))
427 {
428 /* Nothing left */
429 return TRUE;
430 }
431 }
432
433 /* Don't pass a clip object with a single rectangle */
434 if (pco->iDComplexity == DC_RECT) pco = (CLIPOBJ*)&gxcoTrivial;
435
436 /* Calculate initial offset and size */
437 ptOffset.x = rcClipped.left - prclTrg->left;
438 ptOffset.y = rcClipped.top - prclTrg->top;
439 sizTrg.cx = rcClipped.right - rcClipped.left;
440 sizTrg.cy = rcClipped.bottom - rcClipped.top;
441
442 /* Check if the ROP uses a source */
444 {
445 /* Must have a source surface and point */
446 ASSERT(psoSrc);
448
449 /* Get the source point */
450 ptSrc = *pptlSrc;
451
452 /* Clip against the extents of the source surface */
453 AdjustOffsetAndSize(&ptOffset, &sizTrg, &ptSrc, &psoSrc->sizlBitmap);
454 }
455 else
456 {
457 psoSrc = NULL;
458 ptSrc.x = 0;
459 ptSrc.y = 0;
460 }
461
462 /* Check if the ROP uses a mask */
463 if (ROP4_USES_MASK(rop4))
464 {
465 /* Must have a mask surface and point */
468
469 /* Get the mask point */
470 ptMask = *pptlMask;
471
472 /* Clip against the extents of the mask surface */
473 AdjustOffsetAndSize(&ptOffset, &sizTrg, &ptMask, &psoMask->sizlBitmap);
474 }
475 else
476 {
477 psoMask = NULL;
478 ptMask.x = 0;
479 ptMask.y = 0;
480 }
481
482 /* Check if all has been clipped away */
483 if ((sizTrg.cx <= 0) || (sizTrg.cy <= 0))
484 return TRUE;
485
486 /* Adjust the points */
487 ptSrc.x += ptOffset.x;
488 ptSrc.y += ptOffset.y;
489 ptMask.x += ptOffset.x;
490 ptMask.y += ptOffset.y;
491
492 /* Check if we have a brush origin */
493 if (pptlBrush)
494 {
495 /* calculate the new brush origin */
496 ptBrush.x = pptlBrush->x + ptOffset.x;
497 ptBrush.y = pptlBrush->y + ptOffset.y;
498 }
499
500 /* Recalculate the target rect */
501 rcClipped.left = prclTrg->left + ptOffset.x;
502 rcClipped.top = prclTrg->top + ptOffset.y;
503 rcClipped.right = rcClipped.left + sizTrg.cx;
504 rcClipped.bottom = rcClipped.top + sizTrg.cy;
505
506 /* Is the target surface device managed? */
507 if (SURFOBJ_flags(psoTrg) & HOOK_BITBLT)
508 {
509 /* Is the source a different device managed surface? */
510 if (psoSrc && (psoSrc->hdev != psoTrg->hdev) &&
512 {
513 ERR("Need to copy to standard bitmap format!\n");
514 ASSERT(FALSE);
515 }
516
517 pfnBitBlt = GDIDEVFUNCS(psoTrg).BitBlt;
518 }
519 /* Otherwise is the source surface device managed? */
520 else if (psoSrc && (SURFOBJ_flags(psoSrc) & HOOK_BITBLT))
521 {
522 pfnBitBlt = GDIDEVFUNCS(psoSrc).BitBlt;
523 }
524 else
525 {
526 pfnBitBlt = EngBitBlt;
527 }
528
529 bResult = pfnBitBlt(psoTrg,
530 psoSrc,
531 psoMask,
532 pco,
533 pxlo,
534 &rcClipped,
535 psoSrc ? &ptSrc : NULL,
536 psoMask ? &ptMask : NULL,
537 pbo,
538 pptlBrush ? &ptBrush : NULL,
539 rop4);
540
541 // FIXME: cleanup temp surface!
542
543 return bResult;
544}
static VOID AdjustOffsetAndSize(_Out_ PPOINTL pptOffset, _Out_ PSIZEL psizTrg, _In_ PPOINTL pptlSrc, _In_ PSIZEL psizSrc)
Definition: bitblt_new.c:361
#define ERR(fmt,...)
Definition: debug.h:110
#define IS_VALID_ROP4(rop)
Definition: inteng.h:49
FORCEINLINE BOOL RECTL_bClipRectBySize(_Out_ RECTL *prclDst, _In_ const RECTL *prclSrc, _In_ const SIZEL *pszl)
Definition: rect.h:72
#define DC_TRIVIAL
Definition: winddi.h:259
FN_DrvBitBlt * PFN_DrvBitBlt
Definition: winddi.h:3443
#define HOOK_BITBLT
Definition: winddi.h:1420

◆ IntEngCopyBits()

BOOL APIENTRY IntEngCopyBits ( SURFOBJ psoTrg,
SURFOBJ psoSrc,
CLIPOBJ pco,
XLATEOBJ pxlo,
RECTL prclTrg,
POINTL pptlSrc 
)

Definition at line 678 of file bitblt_new.c.

685{
686 return EngCopyBits(psoTrg, psoSrc, pco, pxlo, prclTrg, pptlSrc);
687}
BOOL APIENTRY EngCopyBits(SURFOBJ *psoTrg, SURFOBJ *psoSrc, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc)
Definition: bitblt_new.c:637

Referenced by EngSetPointerShape(), GreGetDIBitsInternal(), and IntSetDIBits().

◆ NtGdiEngBitBlt()

BOOL APIENTRY NtGdiEngBitBlt ( IN SURFOBJ psoTrgUMPD,
IN SURFOBJ psoSrcUMPD,
IN SURFOBJ psoMaskUMPD,
IN CLIPOBJ pcoUMPD,
IN XLATEOBJ pxloUMPD,
IN RECTL prclTrg,
IN POINTL pptlSrc,
IN POINTL pptlMask,
IN BRUSHOBJ pboUMPD,
IN POINTL pptlBrush,
IN ROP4  rop4 
)

Definition at line 548 of file bitblt_new.c.

560{
561 RECTL rclTrg;
562 POINTL ptlSrc, ptlMask, ptlBrush;
563 HSURF hsurfTrg, hsurfSrc = NULL, hsurfMask = NULL;
564 HANDLE hBrushObj; // HUMPDOBJ
565 SURFOBJ *psoTrg, *psoSrc, *psoMask;
566 CLIPOBJ *pco;
567 XLATEOBJ *pxlo;
568 BRUSHOBJ *pbo;
569 BOOL bResult;
570
572 {
573 ProbeForRead(prclTrg, sizeof(RECTL), 1);
574 rclTrg = *prclTrg;
575
576 ProbeForRead(psoTrgUMPD, sizeof(SURFOBJ), 1);
577 hsurfTrg = psoTrgUMPD->hsurf;
578
580 {
581 ProbeForRead(pptlSrc, sizeof(POINTL), 1);
582 ptlSrc = *pptlSrc;
583
584 ProbeForRead(psoSrcUMPD, sizeof(SURFOBJ), 1);
585 hsurfSrc = psoSrcUMPD->hsurf;
586 }
587
588 if (ROP4_USES_MASK(rop4))
589 {
590 ProbeForRead(pptlMask, sizeof(POINTL), 1);
591 ptlMask = *pptlMask;
592
593 ProbeForRead(psoMaskUMPD, sizeof(SURFOBJ), 1);
594 hsurfMask = psoMaskUMPD->hsurf;
595 }
596
598 {
599 ProbeForRead(pptlBrush, sizeof(POINTL), 1);
600 ptlBrush = *pptlBrush;
601
602 ProbeForRead(psoSrcUMPD, sizeof(SURFOBJ), 1);
603 hBrushObj = pboUMPD->pvRbrush; // FIXME
604 }
605 }
607 {
608 _SEH2_YIELD(return FALSE);
609 }
610 _SEH2_END;
611
612 // FIXME: these need to be converted/locked!
613 psoTrg = NULL;
614 psoSrc = NULL;
615 psoMask = NULL;
616 pco = NULL;
617 pxlo = NULL;
618 pbo = NULL;
619
620 bResult = EngBitBlt(psoTrg,
621 psoSrc,
622 psoMask,
623 pco,
624 pxlo,
625 &rclTrg,
626 pptlSrc ? &ptlSrc : NULL,
627 pptlMask ? &ptlMask : NULL,
628 pbo,
629 pptlBrush ? &ptlBrush : NULL,
630 rop4);
631
632 return bResult;
633}
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)

Variable Documentation

◆ gxcoTrivial

XCLIPOBJ gxcoTrivial
extern

Definition at line 20 of file bitblt.c.

Referenced by EngBitBlt(), and IntEngBitBlt().