ReactOS 0.4.16-dev-981-g80eb313
gdibatch.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for gdibatch.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL FASTCALL IntPatBlt (PDC, INT, INT, INT, INT, DWORD, PEBRUSHOBJ)
 
BOOL APIENTRY IntExtTextOutW (IN PDC, IN INT, IN INT, IN UINT, IN OPTIONAL PRECTL, IN LPCWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD)
 
VOID FASTCALL DoDeviceSync (SURFOBJ *Surface, PRECTL Rect, FLONG fl)
 
VOID FASTCALL SynchronizeDriver (FLONG Flags)
 
ULONG FASTCALL GdiFlushUserBatch (PDC dc, PGDIBATCHHDR pHdr)
 
__kernel_entry NTSTATUS APIENTRY NtGdiFlush (VOID)
 
NTSTATUS APIENTRY NtGdiFlushUserBatch (VOID)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 4 of file gdibatch.c.

Function Documentation

◆ DoDeviceSync()

VOID FASTCALL DoDeviceSync ( SURFOBJ Surface,
PRECTL  Rect,
FLONG  fl 
)

Definition at line 22 of file gdibatch.c.

23{
24 PPDEVOBJ Device = (PDEVOBJ*)Surface->hdev;
25// No punting and "Handle to a surface, provided that the surface is device-managed.
26// Otherwise, dhsurf is zero".
27 if (!(Device->flFlags & PDEV_DRIVER_PUNTED_CALL) && (Surface->dhsurf))
28 {
29 if (Device->DriverFunctions.SynchronizeSurface)
30 {
31 Device->DriverFunctions.SynchronizeSurface(Surface, Rect, fl);
32 }
33 else
34 {
35 if (Device->DriverFunctions.Synchronize)
36 {
37 Device->DriverFunctions.Synchronize(Surface->dhpdev, Rect);
38 }
39 }
40 }
41}
if(dx< 0)
Definition: linetemp.h:194
@ PDEV_DRIVER_PUNTED_CALL
Definition: pdevobj.h:21
DHPDEV dhpdev
Definition: winddi.h:1207
DHSURF dhsurf
Definition: winddi.h:1205
HDEV hdev
Definition: winddi.h:1208
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ FLONG fl
Definition: winddi.h:1279

Referenced by SynchronizeDriver().

◆ GdiFlushUserBatch()

ULONG FASTCALL GdiFlushUserBatch ( PDC  dc,
PGDIBATCHHDR  pHdr 
)

Definition at line 70 of file gdibatch.c.

71{
72 ULONG Cmd = 0, Size = 0;
73 PDC_ATTR pdcattr = NULL;
74
75 if (dc)
76 {
77 pdcattr = dc->pdcattr;
78 }
79
81 {
82 Cmd = pHdr->Cmd;
83 Size = pHdr->Size; // Return the full size of the structure.
84 }
86 {
87 DPRINT1("WARNING! GdiBatch Fault!\n");
88 _SEH2_YIELD(return 0;)
89 }
91
92 switch(Cmd)
93 {
94 case GdiBCPatBlt:
95 {
96 PGDIBSPATBLT pgDPB;
97 DWORD dwRop, flags;
98 HBRUSH hOrgBrush;
99 COLORREF crColor, crBkColor, crBrushClr;
100 ULONG ulForegroundClr, ulBackgroundClr, ulBrushClr;
101 if (!dc) break;
102 pgDPB = (PGDIBSPATBLT) pHdr;
103 /* Convert the ROP3 to a ROP4 */
104 dwRop = pgDPB->dwRop;
105 dwRop = MAKEROP4(dwRop & 0xFF0000, dwRop);
106 /* Check if the rop uses a source */
107 if (WIN32_ROP4_USES_SOURCE(dwRop))
108 {
109 /* This is not possible */
110 break;
111 }
112 /* Check if the DC has no surface (empty mem or info DC) */
113 if (dc->dclevel.pSurface == NULL)
114 {
115 /* Nothing to do */
116 break;
117 }
118 // Save current attributes and flags
119 crColor = dc->pdcattr->crForegroundClr;
120 crBkColor = dc->pdcattr->ulBackgroundClr;
121 crBrushClr = dc->pdcattr->crBrushClr;
122 ulForegroundClr = dc->pdcattr->ulForegroundClr;
123 ulBackgroundClr = dc->pdcattr->ulBackgroundClr;
124 ulBrushClr = dc->pdcattr->ulBrushClr;
125 hOrgBrush = dc->pdcattr->hbrush;
126 flags = dc->pdcattr->ulDirty_ & (DIRTY_BACKGROUND | DIRTY_TEXT | DIRTY_FILL | DC_BRUSH_DIRTY);
127 // Set the attribute snapshot
128 dc->pdcattr->hbrush = pgDPB->hbrush;
129 dc->pdcattr->crForegroundClr = pgDPB->crForegroundClr;
130 dc->pdcattr->crBackgroundClr = pgDPB->crBackgroundClr;
131 dc->pdcattr->crBrushClr = pgDPB->crBrushClr;
132 dc->pdcattr->ulForegroundClr = pgDPB->ulForegroundClr;
133 dc->pdcattr->ulBackgroundClr = pgDPB->ulBackgroundClr;
134 dc->pdcattr->ulBrushClr = pgDPB->ulBrushClr;
135 // Process dirty attributes if any.
136 if (dc->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
138 if (dc->pdcattr->ulDirty_ & DIRTY_TEXT)
140 if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
142 /* Call the internal function */
143 IntPatBlt(dc, pgDPB->nXLeft, pgDPB->nYLeft, pgDPB->nWidth, pgDPB->nHeight, dwRop, &dc->eboFill);
144 // Restore attributes and flags
145 dc->pdcattr->hbrush = hOrgBrush;
146 dc->pdcattr->crForegroundClr = crColor;
147 dc->pdcattr->crBackgroundClr = crBkColor;
148 dc->pdcattr->crBrushClr = crBrushClr;
149 dc->pdcattr->ulForegroundClr = ulForegroundClr;
150 dc->pdcattr->ulBackgroundClr = ulBackgroundClr;
151 dc->pdcattr->ulBrushClr = ulBrushClr;
152 dc->pdcattr->ulDirty_ |= flags;
153 break;
154 }
155
156 case GdiBCPolyPatBlt:
157 {
158 PGDIBSPPATBLT pgDPB;
159 EBRUSHOBJ eboFill;
160 PBRUSH pbrush;
161 PPATRECT pRects;
162 INT i;
163 DWORD dwRop, flags;
164 COLORREF crColor, crBkColor, crBrushClr;
165 ULONG ulForegroundClr, ulBackgroundClr, ulBrushClr;
166 if (!dc) break;
167 pgDPB = (PGDIBSPPATBLT) pHdr;
168 /* Convert the ROP3 to a ROP4 */
169 dwRop = pgDPB->rop4;
170 dwRop = MAKEROP4(dwRop & 0xFF0000, dwRop);
171 /* Check if the rop uses a source */
172 if (WIN32_ROP4_USES_SOURCE(dwRop))
173 {
174 /* This is not possible */
175 break;
176 }
177 /* Check if the DC has no surface (empty mem or info DC) */
178 if (dc->dclevel.pSurface == NULL)
179 {
180 /* Nothing to do */
181 break;
182 }
183 // Save current attributes and flags
184 crColor = dc->pdcattr->crForegroundClr;
185 crBkColor = dc->pdcattr->ulBackgroundClr;
186 crBrushClr = dc->pdcattr->crBrushClr;
187 ulForegroundClr = dc->pdcattr->ulForegroundClr;
188 ulBackgroundClr = dc->pdcattr->ulBackgroundClr;
189 ulBrushClr = dc->pdcattr->ulBrushClr;
190 flags = dc->pdcattr->ulDirty_ & (DIRTY_BACKGROUND | DIRTY_TEXT | DIRTY_FILL | DC_BRUSH_DIRTY);
191 // Set the attribute snapshot
192 dc->pdcattr->crForegroundClr = pgDPB->crForegroundClr;
193 dc->pdcattr->crBackgroundClr = pgDPB->crBackgroundClr;
194 dc->pdcattr->crBrushClr = pgDPB->crBrushClr;
195 dc->pdcattr->ulForegroundClr = pgDPB->ulForegroundClr;
196 dc->pdcattr->ulBackgroundClr = pgDPB->ulBackgroundClr;
197 dc->pdcattr->ulBrushClr = pgDPB->ulBrushClr;
198 // Process dirty attributes if any
199 if (dc->pdcattr->ulDirty_ & DIRTY_TEXT)
201 if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
203
204 DPRINT1("GdiBCPolyPatBlt Testing\n");
205 pRects = &pgDPB->pRect[0];
206
207 for (i = 0; i < pgDPB->Count; i++)
208 {
209 pbrush = BRUSH_ShareLockBrush(pRects->hBrush);
210
211 /* Check if we could lock the brush */
212 if (pbrush != NULL)
213 {
214 /* Initialize a brush object */
215 EBRUSHOBJ_vInitFromDC(&eboFill, pbrush, dc);
216
217 IntPatBlt(
218 dc,
219 pRects->r.left,
220 pRects->r.top,
221 pRects->r.right,
222 pRects->r.bottom,
223 dwRop,
224 &eboFill);
225
226 /* Cleanup the brush object and unlock the brush */
227 EBRUSHOBJ_vCleanup(&eboFill);
229 }
230 pRects++;
231 }
232
233 // Restore attributes and flags
234 dc->pdcattr->crForegroundClr = crColor;
235 dc->pdcattr->crBackgroundClr = crBkColor;
236 dc->pdcattr->crBrushClr = crBrushClr;
237 dc->pdcattr->ulForegroundClr = ulForegroundClr;
238 dc->pdcattr->ulBackgroundClr = ulBackgroundClr;
239 dc->pdcattr->ulBrushClr = ulBrushClr;
240 dc->pdcattr->ulDirty_ |= flags;
241 break;
242 }
243
244 case GdiBCTextOut:
245 {
246 PGDIBSTEXTOUT pgO;
247 COLORREF crColor = -1, crBkColor;
248 ULONG ulForegroundClr, ulBackgroundClr;
249 DWORD flags = 0, flXform = 0, saveflags, saveflXform = 0;
250 FLONG flTextAlign = -1;
251 HANDLE hlfntNew;
252 PRECTL lprc;
253 USHORT jBkMode;
254 LONG lBkMode;
255 POINTL ptlViewportOrg;
256 if (!dc) break;
257 pgO = (PGDIBSTEXTOUT) pHdr;
258
259 // Save current attributes, flags and Set the attribute snapshots
261
262 // In this instance check for differences and set the appropriate dirty flags.
263 if ( dc->pdcattr->crForegroundClr != pgO->crForegroundClr)
264 {
265 crColor = dc->pdcattr->crForegroundClr;
266 dc->pdcattr->crForegroundClr = pgO->crForegroundClr;
267 ulForegroundClr = dc->pdcattr->ulForegroundClr;
268 dc->pdcattr->ulForegroundClr = pgO->ulForegroundClr;
270 }
271 if (dc->pdcattr->crBackgroundClr != pgO->crBackgroundClr)
272 {
273 crBkColor = dc->pdcattr->ulBackgroundClr;
274 dc->pdcattr->crBackgroundClr = pgO->crBackgroundClr;
275 ulBackgroundClr = dc->pdcattr->ulBackgroundClr;
276 dc->pdcattr->ulBackgroundClr = pgO->ulBackgroundClr;
278 }
279 if (dc->pdcattr->flTextAlign != pgO->flTextAlign)
280 {
281 flTextAlign = dc->pdcattr->flTextAlign;
282 dc->pdcattr->flTextAlign = pgO->flTextAlign;
283 }
284 if (dc->pdcattr->hlfntNew != pgO->hlfntNew)
285 {
286 hlfntNew = dc->pdcattr->hlfntNew;
287 dc->pdcattr->hlfntNew = pgO->hlfntNew;
288 dc->pdcattr->ulDirty_ &= ~SLOW_WIDTHS;
290 }
291
292 if ( dc->pdcattr->ptlViewportOrg.x != pgO->ptlViewportOrg.x ||
293 dc->pdcattr->ptlViewportOrg.y != pgO->ptlViewportOrg.y )
294 {
295 saveflXform = dc->pdcattr->flXform & (PAGE_XLATE_CHANGED|WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID);
296 ptlViewportOrg = dc->pdcattr->ptlViewportOrg;
297 dc->pdcattr->ptlViewportOrg = pgO->ptlViewportOrg;
299 }
300
301 dc->pdcattr->flXform |= flXform;
302 dc->pdcattr->ulDirty_ |= flags;
303
304 jBkMode = dc->pdcattr->jBkMode;
305 dc->pdcattr->jBkMode = pgO->lBkMode;
306 lBkMode = dc->pdcattr->lBkMode;
307 dc->pdcattr->lBkMode = pgO->lBkMode;
308
309 lprc = (pgO->Options & GDIBS_NORECT) ? NULL : &pgO->Rect;
310 pgO->Options &= ~GDIBS_NORECT;
311
313 pgO->x,
314 pgO->y,
315 pgO->Options,
316 lprc,
317 (LPCWSTR)&pgO->String[pgO->Size/sizeof(WCHAR)],
318 pgO->cbCount,
319 pgO->Size ? (LPINT)&pgO->Buffer : NULL,
320 pgO->iCS_CP );
321
322 // Restore attributes and flags
323 dc->pdcattr->jBkMode = jBkMode;
324 dc->pdcattr->lBkMode = lBkMode;
325
326 if (saveflXform)
327 {
328 dc->pdcattr->ptlViewportOrg = ptlViewportOrg;
329 dc->pdcattr->flXform |= saveflXform|flXform;
330 }
331
332 if (flags & DIRTY_TEXT && crColor != -1)
333 {
334 dc->pdcattr->crForegroundClr = crColor;
335 dc->pdcattr->ulForegroundClr = ulForegroundClr;
336 }
338 {
339 dc->pdcattr->crBackgroundClr = crBkColor;
340 dc->pdcattr->ulBackgroundClr = ulBackgroundClr;
341 }
342 if (flTextAlign != -1)
343 {
344 dc->pdcattr->flTextAlign = flTextAlign;
345 }
346
347 if (flags & DIRTY_CHARSET)
348 {
349 dc->pdcattr->hlfntNew = hlfntNew;
350 dc->pdcattr->ulDirty_ &= ~SLOW_WIDTHS;
351 }
352 dc->pdcattr->ulDirty_ |= saveflags | flags;
353 dc->pdcattr->flXform |= saveflXform | flXform;
354 break;
355 }
356
357 case GdiBCExtTextOut:
358 {
360 COLORREF crBkColor;
361 ULONG ulBackgroundClr;
362 POINTL ptlViewportOrg;
363 DWORD flags = 0, flXform = 0, saveflags, saveflXform = 0;
364 if (!dc) break;
365 pgO = (PGDIBSEXTTEXTOUT) pHdr;
366
367 saveflags = dc->pdcattr->ulDirty_ & (DIRTY_BACKGROUND|DIRTY_TEXT|DIRTY_FILL|DC_BRUSH_DIRTY|DIRTY_CHARSET);
368
369 if (dc->pdcattr->crBackgroundClr != pgO->ulBackgroundClr)
370 {
371 crBkColor = dc->pdcattr->crBackgroundClr;
372 ulBackgroundClr = dc->pdcattr->ulBackgroundClr;
373 dc->pdcattr->crBackgroundClr = pgO->ulBackgroundClr;
374 dc->pdcattr->ulBackgroundClr = pgO->ulBackgroundClr;
376 }
377
378 if ( dc->pdcattr->ptlViewportOrg.x != pgO->ptlViewportOrg.x ||
379 dc->pdcattr->ptlViewportOrg.y != pgO->ptlViewportOrg.y )
380 {
381 saveflXform = dc->pdcattr->flXform & (PAGE_XLATE_CHANGED|WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID);
382 ptlViewportOrg = dc->pdcattr->ptlViewportOrg;
383 dc->pdcattr->ptlViewportOrg = pgO->ptlViewportOrg;
385 }
386
387 dc->pdcattr->flXform |= flXform;
388 dc->pdcattr->ulDirty_ |= flags;
389
391 0,
392 0,
393 pgO->Options,
394 &pgO->Rect,
395 NULL,
396 pgO->Count,
397 NULL,
398 0 );
399
400 if (saveflXform)
401 {
402 dc->pdcattr->ptlViewportOrg = ptlViewportOrg;
403 dc->pdcattr->flXform |= saveflXform|flXform;
404 }
405
407 {
408 dc->pdcattr->crBackgroundClr = crBkColor;
409 dc->pdcattr->ulBackgroundClr = ulBackgroundClr;
410 }
411 dc->pdcattr->ulDirty_ |= saveflags | flags;
412 dc->pdcattr->flXform |= saveflXform | flXform;
413 break;
414 }
415
416 case GdiBCSetBrushOrg:
417 {
418 PGDIBSSETBRHORG pgSBO;
419 if (!dc) break;
420 pgSBO = (PGDIBSSETBRHORG) pHdr;
421 pdcattr->ptlBrushOrigin = pgSBO->ptlBrushOrigin;
423 break;
424 }
425
427 {
429 if (!dc) break;
430 pgO = (PGDIBSEXTSELCLPRGN) pHdr;
431 IntGdiExtSelectClipRect( dc, &pgO->rcl, pgO->fnMode);
432 break;
433 }
434
435 case GdiBCSelObj:
436 {
437 PGDIBSOBJECT pgO;
438
439 if (!dc) break;
440 pgO = (PGDIBSOBJECT) pHdr;
441
443 break;
444 }
445
446 case GdiBCDelRgn:
447 DPRINT("Delete Region Object!\n");
448 /* Fall through */
449 case GdiBCDelObj:
450 {
451 PGDIBSOBJECT pgO = (PGDIBSOBJECT) pHdr;
452 GreDeleteObject( pgO->hgdiobj );
453 break;
454 }
455
456 default:
457 break;
458 }
459
460 return Size;
461}
#define DPRINT1
Definition: precomp.h:8
int FASTCALL IntGdiExtSelectClipRect(PDC, PRECTL, int)
HDC dc
Definition: cylfrac.c:34
HFONT NTAPI DC_hSelectFont(_In_ PDC pdc, _In_ HFONT hlfntNew)
Definition: dcobjs.c:550
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc)
Definition: dcobjs.c:126
VOID NTAPI DC_vSetBrushOrigin(PDC pdc, LONG x, LONG y)
Definition: dcobjs.c:142
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
#define NULL
Definition: types.h:112
VOID NTAPI EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:112
VOID NTAPI EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
Definition: engbrush.c:153
unsigned long DWORD
Definition: ntddk_ex.h:95
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:117
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:118
BOOL APIENTRY IntExtTextOutW(IN PDC, IN INT, IN INT, IN UINT, IN OPTIONAL PRECTL, IN LPCWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD)
Definition: freetype.c:6841
BOOL FASTCALL IntPatBlt(PDC, INT, INT, INT, INT, DWORD, PEBRUSHOBJ)
Definition: bitblt.c:843
GLbitfield flags
Definition: glext.h:7161
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 EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define WIN32_ROP4_USES_SOURCE(Rop)
Definition: intgdi.h:7
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
unsigned long FLONG
Definition: ntbasedef.h:374
#define DIRTY_FILL
Definition: ntgdihdl.h:123
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:188
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:177
#define DIRTY_TEXT
Definition: ntgdihdl.h:125
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:186
#define DIRTY_LINE
Definition: ntgdihdl.h:124
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:126
#define DIRTY_CHARSET
Definition: ntgdihdl.h:127
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:135
struct _GDIBSEXTTEXTOUT * PGDIBSEXTTEXTOUT
struct _GDIBSPPATBLT * PGDIBSPPATBLT
struct _GDIBSSETBRHORG * PGDIBSSETBRHORG
struct _GDIBSTEXTOUT * PGDIBSTEXTOUT
struct _GDIBSOBJECT * PGDIBSOBJECT
struct _GDIBSEXTSELCLPRGN * PGDIBSEXTSELCLPRGN
@ GdiBCSelObj
Definition: ntgdityp.h:92
@ GdiBCPatBlt
Definition: ntgdityp.h:86
@ GdiBCDelRgn
Definition: ntgdityp.h:94
@ GdiBCDelObj
Definition: ntgdityp.h:93
@ GdiBCSetBrushOrg
Definition: ntgdityp.h:90
@ GdiBCPolyPatBlt
Definition: ntgdityp.h:87
@ GdiBCExtSelClipRgn
Definition: ntgdityp.h:91
@ GdiBCTextOut
Definition: ntgdityp.h:88
@ GdiBCExtTextOut
Definition: ntgdityp.h:89
#define GDIBS_NORECT
Definition: ntgdityp.h:507
struct _GDIBSPATBLT * PGDIBSPATBLT
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184
@ Cmd
Definition: sacdrv.h:278
#define DPRINT
Definition: sndvol32.h:73
Definition: types.h:101
ULONG ulDirty_
Definition: ntgdihdl.h:294
POINTL ptlBrushOrigin
Definition: ntgdihdl.h:349
SHORT Size
Definition: ntgdityp.h:458
SHORT Cmd
Definition: ntgdityp.h:459
POINTL ptlViewportOrg
Definition: ntgdityp.h:539
ULONG ulBackgroundClr
Definition: ntgdityp.h:540
HGDIOBJ hgdiobj
Definition: ntgdityp.h:560
ULONG ulBrushClr
Definition: ntgdityp.h:478
COLORREF crBackgroundClr
Definition: ntgdityp.h:472
ULONG ulForegroundClr
Definition: ntgdityp.h:476
COLORREF crBrushClr
Definition: ntgdityp.h:473
COLORREF crForegroundClr
Definition: ntgdityp.h:471
DWORD dwRop
Definition: ntgdityp.h:470
ULONG ulBackgroundClr
Definition: ntgdityp.h:477
HANDLE hbrush
Definition: ntgdityp.h:469
DWORD rop4
Definition: ntgdityp.h:491
ULONG ulForegroundClr
Definition: ntgdityp.h:497
ULONG ulBackgroundClr
Definition: ntgdityp.h:498
ULONG ulBrushClr
Definition: ntgdityp.h:499
COLORREF crForegroundClr
Definition: ntgdityp.h:494
PATRECT pRect[1]
Definition: ntgdityp.h:501
DWORD Count
Definition: ntgdityp.h:493
COLORREF crBackgroundClr
Definition: ntgdityp.h:495
COLORREF crBrushClr
Definition: ntgdityp.h:496
POINTL ptlBrushOrigin
Definition: ntgdityp.h:546
ULONG Buffer[1]
Definition: ntgdityp.h:529
POINTL ptlViewportOrg
Definition: ntgdityp.h:526
UINT cbCount
Definition: ntgdityp.h:522
UINT Options
Definition: ntgdityp.h:519
HANDLE hlfntNew
Definition: ntgdityp.h:524
WCHAR String[2]
Definition: ntgdityp.h:528
LONG lBkMode
Definition: ntgdityp.h:514
COLORREF crForegroundClr
Definition: ntgdityp.h:512
ULONG ulForegroundClr
Definition: ntgdityp.h:515
FLONG flTextAlign
Definition: ntgdityp.h:525
COLORREF crBackgroundClr
Definition: ntgdityp.h:513
ULONG ulBackgroundClr
Definition: ntgdityp.h:516
DWORD iCS_CP
Definition: ntgdityp.h:521
RECT r
Definition: ntgdityp.h:484
HBRUSH hBrush
Definition: ntgdityp.h:485
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
int * LPINT
Definition: windef.h:178
DWORD COLORREF
Definition: windef.h:300
#define MAKEROP4(f, b)
Definition: wingdi.h:2946
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4477
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by NtGdiFlushUserBatch().

◆ IntExtTextOutW()

BOOL APIENTRY IntExtTextOutW ( IN  PDC,
IN  INT,
IN  INT,
IN  UINT,
IN OPTIONAL  PRECTL,
IN  LPCWSTR,
IN  INT,
IN OPTIONAL  LPINT,
IN  DWORD 
)

Definition at line 6841 of file freetype.c.

6851{
6852 /*
6853 * FIXME:
6854 * Call EngTextOut, which does the real work (calling DrvTextOut where
6855 * appropriate)
6856 */
6857
6858 PDC_ATTR pdcattr;
6859 SURFOBJ *psoDest, *psoGlyph;
6860 SURFACE *psurf;
6861 INT glyph_index, i;
6862 FT_Face face;
6863 FT_BitmapGlyph realglyph;
6864 LONGLONG X64, Y64, RealXStart64, RealYStart64, DeltaX64, DeltaY64;
6865 ULONG previous;
6866 RECTL DestRect, MaskRect;
6867 HBITMAP hbmGlyph;
6868 SIZEL glyphSize;
6869 FONTOBJ *FontObj;
6870 PFONTGDI FontGDI;
6871 PTEXTOBJ TextObj = NULL;
6872 EXLATEOBJ exloRGB2Dst, exloDst2RGB;
6873 POINT Start;
6874 PMATRIX pmxWorldToDevice;
6875 FT_Vector delta, vecAscent64, vecDescent64, vec;
6876 LOGFONTW *plf;
6877 BOOL use_kerning, bResult, DoBreak;
6879 FT_Matrix mat;
6880 BOOL bNoTransform;
6881 DWORD ch0, ch1;
6882 const DWORD del = 0x7f, nbsp = 0xa0; // DEL is ASCII DELETE and nbsp is a non-breaking space
6883 FONTLINK_CHAIN Chain;
6884 SIZE spaceWidth;
6885
6886 /* Check if String is valid */
6887 if (Count > 0xFFFF || (Count > 0 && String == NULL))
6888 {
6890 return FALSE;
6891 }
6892
6893 if (PATH_IsPathOpen(dc->dclevel))
6894 {
6895 return PATH_ExtTextOut(dc,
6896 XStart, YStart,
6897 fuOptions,
6898 lprc,
6899 String, Count,
6900 Dx);
6901 }
6902
6904
6905 if (!dc->dclevel.pSurface)
6906 {
6907 /* Memory DC with no surface selected */
6908 bResult = TRUE;
6909 goto Cleanup;
6910 }
6911
6912 pdcattr = dc->pdcattr;
6913 if (pdcattr->flTextAlign & TA_UPDATECP)
6914 {
6915 Start.x = pdcattr->ptlCurrent.x;
6916 Start.y = pdcattr->ptlCurrent.y;
6917 }
6918 else
6919 {
6920 Start.x = XStart;
6921 Start.y = YStart;
6922 }
6923
6924 IntLPtoDP(dc, &Start, 1);
6925 RealXStart64 = ((LONGLONG)Start.x + dc->ptlDCOrig.x) << 6;
6926 RealYStart64 = ((LONGLONG)Start.y + dc->ptlDCOrig.y) << 6;
6927
6928 MaskRect.left = 0;
6929 MaskRect.top = 0;
6930
6931 psurf = dc->dclevel.pSurface;
6932 psoDest = &psurf->SurfObj;
6933
6934 if (pdcattr->iGraphicsMode == GM_ADVANCED)
6935 pmxWorldToDevice = DC_pmxWorldToDevice(dc);
6936 else
6937 pmxWorldToDevice = (PMATRIX)&gmxWorldToDeviceDefault;
6938
6939 if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
6941
6942 if (lprc && (fuOptions & (ETO_CLIPPED | ETO_OPAQUE)))
6943 {
6944 IntLPtoDP(dc, (POINT*)lprc, 2);
6945 lprc->left += dc->ptlDCOrig.x;
6946 lprc->top += dc->ptlDCOrig.y;
6947 lprc->right += dc->ptlDCOrig.x;
6948 lprc->bottom += dc->ptlDCOrig.y;
6949 }
6950
6951 if (lprc && (fuOptions & ETO_OPAQUE))
6952 {
6954 lprc->left, lprc->top,
6955 lprc->right - lprc->left, lprc->bottom - lprc->top,
6956 &dc->eboBackground.BrushObject);
6957 fuOptions &= ~ETO_OPAQUE;
6958 }
6959 else
6960 {
6961 if (pdcattr->jBkMode == OPAQUE)
6962 {
6963 fuOptions |= ETO_OPAQUE;
6964 }
6965 }
6966
6967 TextObj = RealizeFontInit(pdcattr->hlfntNew);
6968 if (TextObj == NULL)
6969 {
6970 bResult = FALSE;
6971 goto Cleanup;
6972 }
6973
6974 FontObj = TextObj->Font;
6975 ASSERT(FontObj);
6976 FontGDI = ObjToGDI(FontObj, FONT);
6977 ASSERT(FontGDI);
6978
6980 Cache.Hashed.Face = face = FontGDI->SharedFace->Face;
6981
6982 plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
6983 Cache.Hashed.lfHeight = plf->lfHeight;
6984 Cache.Hashed.lfWidth = plf->lfWidth;
6985 Cache.Hashed.Aspect.Emu.Bold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
6986 Cache.Hashed.Aspect.Emu.Italic = (plf->lfItalic && !FontGDI->OriginalItalic);
6987
6989 Cache.Hashed.Aspect.RenderMode = (BYTE)IntGetFontRenderMode(plf);
6990 else
6991 Cache.Hashed.Aspect.RenderMode = (BYTE)FT_RENDER_MODE_MONO;
6992
6993 if (!TextIntUpdateSize(dc, TextObj, FontGDI, FALSE))
6994 {
6996 bResult = FALSE;
6997 goto Cleanup;
6998 }
6999
7000 FontLink_Chain_Init(&Chain, TextObj, face);
7001
7002 /* Apply lfEscapement */
7003 if (FT_IS_SCALABLE(face) && plf->lfEscapement != 0)
7004 IntEscapeMatrix(&Cache.Hashed.matTransform, plf->lfEscapement);
7005 else
7006 Cache.Hashed.matTransform = identityMat;
7007
7008 /* Apply the world transformation */
7009 IntMatrixFromMx(&mat, pmxWorldToDevice);
7010 FT_Matrix_Multiply(&mat, &Cache.Hashed.matTransform);
7011 FT_Set_Transform(face, &Cache.Hashed.matTransform, NULL);
7012
7013 /* Is there no transformation? */
7014 bNoTransform = ((mat.xy == 0) && (mat.yx == 0) &&
7015 (mat.xx == (1 << 16)) && (mat.yy == (1 << 16)));
7016
7017 /* Calculate the ascent point and the descent point */
7018 vecAscent64.x = 0;
7019 vecAscent64.y = (FontGDI->tmAscent << 6);
7020 FT_Vector_Transform(&vecAscent64, &Cache.Hashed.matTransform);
7021 vecDescent64.x = 0;
7022 vecDescent64.y = -(FontGDI->tmDescent << 6);
7023 FT_Vector_Transform(&vecDescent64, &Cache.Hashed.matTransform);
7024
7025 /* Process the vertical alignment and fix the real starting point. */
7026#define VALIGN_MASK (TA_TOP | TA_BASELINE | TA_BOTTOM)
7027 if ((pdcattr->flTextAlign & VALIGN_MASK) == TA_BASELINE)
7028 {
7029 NOTHING;
7030 }
7031 else if ((pdcattr->flTextAlign & VALIGN_MASK) == TA_BOTTOM)
7032 {
7033 RealXStart64 -= vecDescent64.x;
7034 RealYStart64 += vecDescent64.y;
7035 }
7036 else /* TA_TOP */
7037 {
7038 RealXStart64 -= vecAscent64.x;
7039 RealYStart64 += vecAscent64.y;
7040 }
7041#undef VALIGN_MASK
7042
7043 use_kerning = FT_HAS_KERNING(face);
7044
7045 /* Calculate the text width if necessary */
7046 if ((fuOptions & ETO_OPAQUE) || (pdcattr->flTextAlign & (TA_CENTER | TA_RIGHT)))
7047 {
7048 if (!IntGetTextDisposition(&DeltaX64, &DeltaY64, String, Count, Dx, &Cache,
7049 fuOptions, bNoTransform, &Chain))
7050 {
7051 FontLink_Chain_Finish(&Chain);
7053 bResult = FALSE;
7054 goto Cleanup;
7055 }
7056
7057 /* Adjust the horizontal position by horizontal alignment */
7058 if ((pdcattr->flTextAlign & TA_CENTER) == TA_CENTER)
7059 {
7060 RealXStart64 -= DeltaX64 / 2;
7061 RealYStart64 -= DeltaY64 / 2;
7062 }
7063 else if ((pdcattr->flTextAlign & TA_RIGHT) == TA_RIGHT)
7064 {
7065 RealXStart64 -= DeltaX64;
7066 RealYStart64 -= DeltaY64;
7067 }
7068
7069 /* Fill background */
7070 if (fuOptions & ETO_OPAQUE)
7071 {
7072 INT X0 = (RealXStart64 + vecAscent64.x + 32) >> 6;
7073 INT Y0 = (RealYStart64 - vecAscent64.y + 32) >> 6;
7074 INT DX = (DeltaX64 >> 6);
7075 if (Cache.Hashed.matTransform.xy == 0 && Cache.Hashed.matTransform.yx == 0)
7076 {
7077 INT CY = (vecAscent64.y - vecDescent64.y + 32) >> 6;
7078 IntEngFillBox(dc, X0, Y0, DX, CY, &dc->eboBackground.BrushObject);
7079 }
7080 else
7081 {
7082 INT DY = (DeltaY64 >> 6);
7083 INT X1 = ((RealXStart64 + vecDescent64.x + 32) >> 6);
7084 INT Y1 = ((RealYStart64 - vecDescent64.y + 32) >> 6);
7085 POINT Points[4] =
7086 {
7087 { X0, Y0 },
7088 { X0 + DX, Y0 + DY },
7089 { X1 + DX, Y1 + DY },
7090 { X1, Y1 },
7091 };
7092 IntEngFillPolygon(dc, Points, 4, &dc->eboBackground.BrushObject);
7093 }
7094 }
7095 }
7096
7097 EXLATEOBJ_vInitialize(&exloRGB2Dst, &gpalRGB, psurf->ppal, 0, 0, 0);
7098 EXLATEOBJ_vInitialize(&exloDst2RGB, psurf->ppal, &gpalRGB, 0, 0, 0);
7099
7100 if (pdcattr->ulDirty_ & DIRTY_TEXT)
7102
7103 /*
7104 * The main rendering loop.
7105 */
7106 X64 = RealXStart64;
7107 Y64 = RealYStart64;
7108 previous = 0;
7109 DoBreak = FALSE;
7110 bResult = TRUE; /* Assume success */
7111 for (i = 0; i < Count; ++i)
7112 {
7113 ch0 = *String++;
7114 if (IS_HIGH_SURROGATE(ch0))
7115 {
7116 ++i;
7117 if (i >= Count)
7118 break;
7119
7120 ch1 = *String++;
7121 if (IS_LOW_SURROGATE(ch1))
7122 ch0 = Utf32FromSurrogatePair(ch0, ch1);
7123 }
7124
7125 glyph_index = FontLink_Chain_FindGlyph(&Chain, &Cache, &face, ch0,
7126 (fuOptions & ETO_GLYPH_INDEX));
7127 Cache.Hashed.GlyphIndex = glyph_index;
7128
7129 realglyph = IntGetRealGlyph(&Cache);
7130 if (!realglyph)
7131 {
7132 bResult = FALSE;
7133 break;
7134 }
7135
7136 /* retrieve kerning distance and move pen position */
7137 if (use_kerning && previous && glyph_index && NULL == Dx)
7138 {
7139 FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
7140 X64 += delta.x;
7141 Y64 -= delta.y;
7142 }
7143
7144 DPRINT("X64, Y64: %I64d, %I64d\n", X64, Y64);
7145 DPRINT("Advance: %d, %d\n", realglyph->root.advance.x, realglyph->root.advance.y);
7146
7147 glyphSize.cx = realglyph->bitmap.width;
7148 glyphSize.cy = realglyph->bitmap.rows;
7149
7150 /* Do chars > space & not DEL & not nbsp have a glyphSize.cx of zero? */
7151 if (ch0 > L' ' && ch0 != del && ch0 != nbsp && glyphSize.cx == 0)
7152 DPRINT1("WARNING: WChar 0x%04x has a glyphSize.cx of zero\n", ch0);
7153
7154 /* Don't ignore spaces or non-breaking spaces when computing offset.
7155 * This completes the fix of CORE-11787. */
7156 if ((pdcattr->flTextAlign & TA_UPDATECP) && glyphSize.cx == 0 &&
7157 (ch0 == L' ' || ch0 == nbsp)) // Space chars needing x-dim widths
7158 {
7160 /* Get the width of the space character */
7161 TextIntGetTextExtentPoint(dc, TextObj, L" ", 1, 0, NULL, 0, &spaceWidth, 0);
7163 glyphSize.cx = spaceWidth.cx;
7164 realglyph->left = 0;
7165 }
7166
7167 MaskRect.right = realglyph->bitmap.width;
7168 MaskRect.bottom = realglyph->bitmap.rows;
7169
7170 DestRect.left = ((X64 + 32) >> 6) + realglyph->left;
7171 DestRect.right = DestRect.left + glyphSize.cx;
7172 DestRect.top = ((Y64 + 32) >> 6) - realglyph->top;
7173 DestRect.bottom = DestRect.top + glyphSize.cy;
7174
7175 /* Check if the bitmap has any pixels */
7176 if ((glyphSize.cx != 0) && (glyphSize.cy != 0))
7177 {
7178 /*
7179 * We should create the bitmap out of the loop at the biggest possible
7180 * glyph size. Then use memset with 0 to clear it and sourcerect to
7181 * limit the work of the transbitblt.
7182 */
7183 hbmGlyph = EngCreateBitmap(glyphSize, realglyph->bitmap.pitch,
7185 realglyph->bitmap.buffer);
7186 if (!hbmGlyph)
7187 {
7188 DPRINT1("WARNING: EngCreateBitmap() failed!\n");
7189 bResult = FALSE;
7190 break;
7191 }
7192
7193 psoGlyph = EngLockSurface((HSURF)hbmGlyph);
7194 if (!psoGlyph)
7195 {
7196 EngDeleteSurface((HSURF)hbmGlyph);
7197 DPRINT1("WARNING: EngLockSurface() failed!\n");
7198 bResult = FALSE;
7199 break;
7200 }
7201
7202 /*
7203 * Use the font data as a mask to paint onto the DCs surface using a
7204 * brush.
7205 */
7206 if (lprc && (fuOptions & ETO_CLIPPED))
7207 {
7208 // We do the check '>=' instead of '>' to possibly save an iteration
7209 // through this loop, since it's breaking after the drawing is done,
7210 // and x is always incremented.
7211 if (DestRect.right >= lprc->right)
7212 {
7213 DestRect.right = lprc->right;
7214 DoBreak = TRUE;
7215 }
7216
7217 if (DestRect.bottom >= lprc->bottom)
7218 {
7219 DestRect.bottom = lprc->bottom;
7220 }
7221 }
7222
7223 if (!IntEngMaskBlt(psoDest,
7224 psoGlyph,
7225 (CLIPOBJ *)&dc->co,
7226 &exloRGB2Dst.xlo,
7227 &exloDst2RGB.xlo,
7228 &DestRect,
7229 (PPOINTL)&MaskRect,
7230 &dc->eboText.BrushObject,
7231 &PointZero))
7232 {
7233 DPRINT1("Failed to MaskBlt a glyph!\n");
7234 }
7235
7236 EngUnlockSurface(psoGlyph);
7237 EngDeleteSurface((HSURF)hbmGlyph);
7238 }
7239
7240 if (DoBreak)
7241 break;
7242
7243 if (NULL == Dx)
7244 {
7245 X64 += realglyph->root.advance.x >> 10;
7246 Y64 -= realglyph->root.advance.y >> 10;
7247 }
7248 else if (fuOptions & ETO_PDY)
7249 {
7250 vec.x = (Dx[2 * i + 0] << 6);
7251 vec.y = (Dx[2 * i + 1] << 6);
7252 if (!bNoTransform)
7253 FT_Vector_Transform(&vec, &Cache.Hashed.matTransform);
7254 X64 += vec.x;
7255 Y64 -= vec.y;
7256 }
7257 else
7258 {
7259 vec.x = (Dx[i] << 6);
7260 vec.y = 0;
7261 if (!bNoTransform)
7262 FT_Vector_Transform(&vec, &Cache.Hashed.matTransform);
7263 X64 += vec.x;
7264 Y64 -= vec.y;
7265 }
7266
7267 DPRINT("New X64, New Y64: %I64d, %I64d\n", X64, Y64);
7268
7269 previous = glyph_index;
7270 }
7271 /* Don't update position if String == NULL. Fixes CORE-19721. */
7272 if ((pdcattr->flTextAlign & TA_UPDATECP) && String)
7273 pdcattr->ptlCurrent.x = DestRect.right - dc->ptlDCOrig.x;
7274
7275 if (plf->lfUnderline || plf->lfStrikeOut) /* Underline or strike-out? */
7276 {
7277 /* Calculate the position and the thickness */
7278 INT underline_position, thickness;
7279 FT_Vector vecA64, vecB64;
7280
7281 DeltaX64 = X64 - RealXStart64;
7282 DeltaY64 = Y64 - RealYStart64;
7283
7284 if (!face->units_per_EM)
7285 {
7287 thickness = 1;
7288 }
7289 else
7290 {
7292 face->underline_position * face->size->metrics.y_ppem / face->units_per_EM;
7293 thickness =
7294 face->underline_thickness * face->size->metrics.y_ppem / face->units_per_EM;
7295 if (thickness <= 0)
7296 thickness = 1;
7297 }
7298
7299 if (plf->lfUnderline) /* Draw underline */
7300 {
7301 vecA64.x = 0;
7302 vecA64.y = (-underline_position - thickness / 2) << 6;
7303 vecB64.x = 0;
7304 vecB64.y = vecA64.y + (thickness << 6);
7305 FT_Vector_Transform(&vecA64, &Cache.Hashed.matTransform);
7306 FT_Vector_Transform(&vecB64, &Cache.Hashed.matTransform);
7307 {
7308 INT X0 = (RealXStart64 - vecA64.x + 32) >> 6;
7309 INT Y0 = (RealYStart64 + vecA64.y + 32) >> 6;
7310 INT DX = (DeltaX64 >> 6);
7311 if (Cache.Hashed.matTransform.xy == 0 && Cache.Hashed.matTransform.yx == 0)
7312 {
7313 INT CY = (vecB64.y - vecA64.y + 32) >> 6;
7314 IntEngFillBox(dc, X0, Y0, DX, CY, &dc->eboText.BrushObject);
7315 }
7316 else
7317 {
7318 INT DY = (DeltaY64 >> 6);
7319 INT X1 = X0 + ((vecA64.x - vecB64.x + 32) >> 6);
7320 INT Y1 = Y0 + ((vecB64.y - vecA64.y + 32) >> 6);
7321 POINT Points[4] =
7322 {
7323 { X0, Y0 },
7324 { X0 + DX, Y0 + DY },
7325 { X1 + DX, Y1 + DY },
7326 { X1, Y1 },
7327 };
7328 IntEngFillPolygon(dc, Points, 4, &dc->eboText.BrushObject);
7329 }
7330 }
7331 }
7332
7333 if (plf->lfStrikeOut) /* Draw strike-out */
7334 {
7335 vecA64.x = 0;
7336 vecA64.y = -(FontGDI->tmAscent << 6) / 3;
7337 vecB64.x = 0;
7338 vecB64.y = vecA64.y + (thickness << 6);
7339 FT_Vector_Transform(&vecA64, &Cache.Hashed.matTransform);
7340 FT_Vector_Transform(&vecB64, &Cache.Hashed.matTransform);
7341 {
7342 INT X0 = (RealXStart64 - vecA64.x + 32) >> 6;
7343 INT Y0 = (RealYStart64 + vecA64.y + 32) >> 6;
7344 INT DX = (DeltaX64 >> 6);
7345 if (Cache.Hashed.matTransform.xy == 0 && Cache.Hashed.matTransform.yx == 0)
7346 {
7347 INT CY = (vecB64.y - vecA64.y + 32) >> 6;
7348 IntEngFillBox(dc, X0, Y0, DX, CY, &dc->eboText.BrushObject);
7349 }
7350 else
7351 {
7352 INT DY = (DeltaY64 >> 6);
7353 INT X1 = X0 + ((vecA64.x - vecB64.x + 32) >> 6);
7354 INT Y1 = Y0 + ((vecB64.y - vecA64.y + 32) >> 6);
7355 POINT Points[4] =
7356 {
7357 { X0, Y0 },
7358 { X0 + DX, Y0 + DY },
7359 { X1 + DX, Y1 + DY },
7360 { X1, Y1 },
7361 };
7362 IntEngFillPolygon(dc, Points, 4, &dc->eboText.BrushObject);
7363 }
7364 }
7365 }
7366 }
7367
7368 FontLink_Chain_Finish(&Chain);
7369
7371
7372 EXLATEOBJ_vCleanup(&exloRGB2Dst);
7373 EXLATEOBJ_vCleanup(&exloDst2RGB);
7374
7375Cleanup:
7377
7378 if (TextObj != NULL)
7379 TEXTOBJ_UnlockText(TextObj);
7380
7381 return bResult;
7382}
static VOID del(LPHIST_ENTRY item)
Definition: history.c:199
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:135
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
WORD face[3]
Definition: mesh.c:4747
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static const WCHAR Cleanup[]
Definition: register.c:80
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:184
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:4302
VOID APIENTRY IntEngFillPolygon(IN OUT PDC dc, IN POINTL *pPoints, IN UINT cPoints, IN BRUSHOBJ *BrushObj)
Definition: freetype.c:6758
static UINT FontLink_Chain_FindGlyph(_Inout_ PFONTLINK_CHAIN pChain, _Out_ PFONT_CACHE_ENTRY pCache, _Inout_ FT_Face *pFace, _In_ UINT code, _In_ BOOL fCodeAsIndex)
Definition: freetype.c:4451
#define IS_HIGH_SURROGATE(ch0)
Definition: freetype.c:334
BOOL FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, INT Count, ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size, FLONG fl)
Definition: freetype.c:5039
static DWORD Utf32FromSurrogatePair(DWORD ch0, DWORD ch1)
Definition: freetype.c:338
#define IS_LOW_SURROGATE(ch1)
Definition: freetype.c:335
#define IntUnLockFreeType()
Definition: freetype.c:386
static VOID FASTCALL IntMatrixFromMx(FT_Matrix *pmat, const MATRIX *pmx)
Definition: freetype.c:1131
static VOID FASTCALL IntEscapeMatrix(FT_Matrix *pmat, LONG lfEscapement)
Definition: freetype.c:1118
static POINTL PointZero
Definition: freetype.c:355
#define IntLockFreeType()
Definition: freetype.c:380
#define EMUBOLD_NEEDED(original, request)
Definition: freetype.c:349
static const FT_Matrix identityMat
Definition: freetype.c:354
static FT_BitmapGlyph IntGetRealGlyph(IN OUT PFONT_CACHE_ENTRY Cache)
Definition: freetype.c:4999
#define VALIGN_MASK
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:2708
#define gmxWorldToDeviceDefault
Definition: freetype.c:358
static VOID FontLink_Chain_Finish(_Inout_ PFONTLINK_CHAIN pChain)
Definition: freetype.c:277
static VOID FontLink_Chain_Init(_Out_ PFONTLINK_CHAIN pChain, _Inout_ PTEXTOBJ pTextObj, _In_ FT_Face face)
Definition: freetype.c:1297
FT_Render_Mode FASTCALL IntGetFontRenderMode(LOGFONTW *logfont)
Definition: freetype.c:2720
static BOOL IntGetTextDisposition(OUT LONGLONG *pX64, OUT LONGLONG *pY64, IN LPCWSTR String, IN INT Count, IN OPTIONAL LPINT Dx, IN OUT PFONT_CACHE_ENTRY Cache, IN UINT fuOptions, IN BOOL bNoTransform, IN OUT PFONTLINK_CHAIN pChain)
Definition: freetype.c:6673
VOID FASTCALL IntEngFillBox(IN OUT PDC dc, IN INT X, IN INT Y, IN INT Width, IN INT Height, IN BRUSHOBJ *BrushObj)
Definition: freetype.c:6794
FT_Set_Transform(FT_Face face, FT_Matrix *matrix, FT_Vector *delta)
Definition: ftobjs.c:690
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1284
FT_Vector_Transform(FT_Vector *vector, const FT_Matrix *matrix)
Definition: ftoutln.c:675
@ FT_RENDER_MODE_MONO
Definition: freetype.h:3258
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3391
#define FT_HAS_KERNING(face)
Definition: freetype.h:1269
FT_Vector * vec
Definition: ftbbox.c:470
FT_Matrix_Multiply(const FT_Matrix *a, FT_Matrix *b)
Definition: ftcalc.c:661
return pTarget Start()
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
#define DX
Definition: i386-dis.c:425
#define NOTHING
Definition: input_list.c:10
#define ASSERT(a)
Definition: mode.c:44
static HBITMAP
Definition: button.c:44
static const MAT2 mat
Definition: font.c:66
int Count
Definition: noreturn.cpp:7
struct _MATRIX * PMATRIX
#define L(x)
Definition: ntvdm.h:50
#define PATH_IsPathOpen(dclevel)
Definition: path.h:72
Definition: fatfs.h:173
FT_Bitmap bitmap
Definition: ftglyph.h:173
FT_GlyphRec root
Definition: ftglyph.h:170
unsigned int width
Definition: ftimage.h:264
unsigned char * buffer
Definition: ftimage.h:266
unsigned int rows
Definition: ftimage.h:263
int pitch
Definition: ftimage.h:265
FT_Vector advance
Definition: ftglyph.h:118
FT_Pos x
Definition: ftimage.h:78
FT_Pos y
Definition: ftimage.h:79
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
LONG lfWidth
Definition: dimm.idl:60
BYTE lfUnderline
Definition: dimm.idl:65
LONG lfEscapement
Definition: dimm.idl:61
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
POINTL ptlCurrent
Definition: ntgdihdl.h:311
BYTE jBkMode
Definition: ntgdihdl.h:308
INT iGraphicsMode
Definition: ntgdihdl.h:306
HANDLE hlfntNew
Definition: ntgdihdl.h:330
FLONG flTextAlign
Definition: ntgdihdl.h:324
XLATEOBJ xlo
Definition: xlateobj.h:21
LONG tmAscent
Definition: engobjects.h:162
LONG tmDescent
Definition: engobjects.h:163
BYTE OriginalItalic
Definition: engobjects.h:156
PSHARED_FACE SharedFace
Definition: engobjects.h:145
LONG OriginalWeight
Definition: engobjects.h:157
Definition: font.h:56
Definition: text.h:60
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
FONTOBJ * Font
Definition: text.h:66
FT_Face Face
Definition: engobjects.h:132
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
SURFOBJ SurfObj
Definition: surface.h:8
struct _PALETTE *const ppal
Definition: surface.h:11
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2779
LOGFONTW elfLogFont
Definition: wingdi.h:2702
T1_FIELD_DICT_FONTDICT T1_FIELD_DICT_FONTDICT T1_FIELD_DICT_FONTDICT underline_position
Definition: t1tokens.h:40
int64_t LONGLONG
Definition: typedefs.h:68
Definition: compat.h:2255
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
BOOL APIENTRY IntEngMaskBlt(_Inout_ SURFOBJ *psoDest, _In_ SURFOBJ *psoMask, _In_ CLIPOBJ *pco, _In_ XLATEOBJ *pxloDest, _In_ XLATEOBJ *pxloSource, _In_ RECTL *prclDest, _In_ POINTL *pptlMask, _In_ BRUSHOBJ *pbo, _In_ POINTL *pptlBrushOrg)
Definition: bitblt.c:1103
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
PALETTE gpalRGB
Definition: palette.c:20
BOOL FASTCALL PATH_ExtTextOut(PDC dc, INT x, INT y, UINT flags, const RECTL *lprc, LPCWSTR str, UINT count, const INT *dx)
Definition: path.c:2355
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define BMF_8BPP
Definition: winddi.h:357
ENGAPI BOOL APIENTRY EngDeleteSurface(_In_ _Post_ptr_invalid_ HSURF hsurf)
Definition: surface.c:567
ENGAPI SURFOBJ *APIENTRY EngLockSurface(_In_ HSURF hsurf)
Definition: surface.c:607
ENGAPI HBITMAP APIENTRY EngCreateBitmap(_In_ SIZEL sizl, _In_ LONG lWidth, _In_ ULONG iFormat, _In_ FLONG fl, _In_opt_ PVOID pvBits)
#define BMF_TOPDOWN
Definition: winddi.h:1180
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
ENGAPI VOID APIENTRY EngUnlockSurface(_In_ _Post_ptr_invalid_ SURFOBJ *pso)
Definition: surface.c:628
#define GM_ADVANCED
Definition: wingdi.h:865
#define TA_UPDATECP
Definition: wingdi.h:936
#define TA_RIGHT
Definition: wingdi.h:933
#define ETO_CLIPPED
Definition: wingdi.h:648
#define ETO_OPAQUE
Definition: wingdi.h:647
#define OPAQUE
Definition: wingdi.h:949
#define ETO_PDY
Definition: wingdi.h:657
#define TA_BOTTOM
Definition: wingdi.h:929
#define TA_BASELINE
Definition: wingdi.h:928
#define TA_CENTER
Definition: wingdi.h:931
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
Definition: xlateobj.c:358
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
unsigned char BYTE
Definition: xxhash.c:193

Referenced by GdiFlushUserBatch(), and GreExtTextOutW().

◆ IntPatBlt()

BOOL FASTCALL IntPatBlt ( PDC  pdc,
INT  XLeft,
INT  YLeft,
INT  Width,
INT  Height,
DWORD  dwRop3,
PEBRUSHOBJ  pebo 
)

Definition at line 843 of file bitblt.c.

851{
852 RECTL DestRect;
853 SURFACE *psurf;
854 POINTL BrushOrigin;
855 BOOL ret;
856 PBRUSH pbrush;
857
858 ASSERT(pebo);
859 pbrush = pebo->pbrush;
860 ASSERT(pbrush);
861
862 if (pbrush->flAttrs & BR_IS_NULL)
863 {
864 return TRUE;
865 }
866
867 if (Width >= 0)
868 {
869 DestRect.left = XLeft;
870 DestRect.right = XLeft + Width;
871 }
872 else
873 {
874 DestRect.left = XLeft + Width;
875 DestRect.right = XLeft;
876 }
877
878 if (Height >= 0)
879 {
880 DestRect.top = YLeft;
881 DestRect.bottom = YLeft + Height;
882 }
883 else
884 {
885 DestRect.top = YLeft + Height;
886 DestRect.bottom = YLeft;
887 }
888
889 IntLPtoDP(pdc, (LPPOINT)&DestRect, 2);
890
891 DestRect.left += pdc->ptlDCOrig.x;
892 DestRect.top += pdc->ptlDCOrig.y;
893 DestRect.right += pdc->ptlDCOrig.x;
894 DestRect.bottom += pdc->ptlDCOrig.y;
895
896 if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
897 {
898 IntUpdateBoundsRect(pdc, &DestRect);
899 }
900
901#ifdef _USE_DIBLIB_
902 BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x + XLeft;
903 BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y + YLeft;
904#else
905 BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x;
906 BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y;
907#endif
908
909 DC_vPrepareDCsForBlit(pdc, &DestRect, NULL, NULL);
910
911 psurf = pdc->dclevel.pSurface;
912
913 ret = IntEngBitBlt(&psurf->SurfObj,
914 NULL,
915 NULL,
916 (CLIPOBJ *)&pdc->co,
917 NULL,
918 &DestRect,
919 NULL,
920 NULL,
921 &pebo->BrushObject,
922 &BrushOrigin,
923 WIN32_ROP3_TO_ENG_ROP4(dwRop3));
924
925 DC_vFinishBlit(pdc, NULL);
926
927 return ret;
928}
VOID FASTCALL IntUpdateBoundsRect(PDC, PRECTL)
Definition: dcutil.c:694
@ DC_ACCUM_APP
Definition: dc.h:25
@ DC_ACCUM_WMGR
Definition: dc.h:24
#define BR_IS_NULL
Definition: brush.h:105
#define WIN32_ROP3_TO_ENG_ROP4(dwRop4)
Definition: intgdi.h:4
PBRUSH pbrush
Definition: brush.h:88
BRUSHOBJ BrushObject
Definition: brush.h:71
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
int ret
BOOL APIENTRY IntEngBitBlt(SURFOBJ *psoTrg, SURFOBJ *psoSrc, SURFOBJ *psoMask, CLIPOBJ *pco, XLATEOBJ *pxlo, RECTL *prclTrg, POINTL *pptlSrc, POINTL *pptlMask, BRUSHOBJ *pbo, POINTL *pptlBrush, ROP4 Rop4)
Definition: bitblt.c:656

Referenced by GdiFlushUserBatch(), IntGdiPolyPatBlt(), NtGdiPatBlt(), and NtGdiSetPixel().

◆ NtGdiFlush()

◆ NtGdiFlushUserBatch()

NTSTATUS APIENTRY NtGdiFlushUserBatch ( VOID  )

Definition at line 487 of file gdibatch.c.

488{
489 PTEB pTeb = NtCurrentTeb();
490 ULONG GdiBatchCount = pTeb->GdiBatchCount;
491
492 if( (GdiBatchCount > 0) && (GdiBatchCount <= (GDIBATCHBUFSIZE/4)))
493 {
494 HDC hDC = (HDC) pTeb->GdiTebBatch.HDC;
495
496 /* If hDC is zero and the buffer fills up with delete objects we need
497 to run anyway.
498 */
499 if (hDC || GdiBatchCount)
500 {
501 PCHAR pHdr = (PCHAR)&pTeb->GdiTebBatch.Buffer[0];
502 PDC pDC = NULL;
503
505 {
506 pDC = DC_LockDc(hDC);
507 }
508
509 // No need to init anything, just go!
510 for (; GdiBatchCount > 0; GdiBatchCount--)
511 {
512 ULONG Size;
513 // Process Gdi Batch!
514 Size = GdiFlushUserBatch(pDC, (PGDIBATCHHDR) pHdr);
515 if (!Size) break;
516 pHdr += Size;
517 }
518
519 if (pDC)
520 {
521 DC_UnlockDc(pDC);
522 }
523
524 // Exit and clear out for the next round.
525 pTeb->GdiTebBatch.Offset = 0;
526 pTeb->GdiBatchCount = 0;
527 pTeb->GdiTebBatch.HDC = 0;
528 }
529 }
530
531 // FIXME: On Windows XP the function returns &pTeb->RealClientId, maybe VOID?
532 return STATUS_SUCCESS;
533}
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
@ GDILoObjType_LO_DC_TYPE
Definition: gdi_private.h:34
ULONG FASTCALL GdiFlushUserBatch(PDC dc, PGDIBATCHHDR pHdr)
Definition: gdibatch.c:70
#define NtCurrentTeb
#define PCHAR
Definition: match.c:90
static HDC
Definition: imagelist.c:88
#define GDIBATCHBUFSIZE
Definition: ntgdityp.h:200
Definition: polytest.cpp:41
ULONG Buffer[GDI_BATCH_BUFFER_SIZE]
Definition: compat.h:833
HANDLE HDC
Definition: compat.h:832
ULONG Offset
Definition: compat.h:831
Definition: compat.h:836
GDI_TEB_BATCH GdiTebBatch
Definition: compat.h:857
ULONG GdiBatchCount
Definition: compat.h:887
char * PCHAR
Definition: typedefs.h:51
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1146

Referenced by DriverEntry().

◆ SynchronizeDriver()

VOID FASTCALL SynchronizeDriver ( FLONG  Flags)

Definition at line 45 of file gdibatch.c.

46{
47 SURFOBJ *SurfObj;
48 //PPDEVOBJ Device;
49
54
55 //Device = IntEnumHDev();
56// UNIMPLEMENTED;
57//ASSERT(FALSE);
58 SurfObj = 0;// EngLockSurface( Device->pSurface );
59 if(!SurfObj) return;
60 DoDeviceSync( SurfObj, NULL, Flags);
61 EngUnlockSurface(SurfObj);
62 return;
63}
VOID FASTCALL DoDeviceSync(SURFOBJ *Surface, PRECTL Rect, FLONG fl)
Definition: gdibatch.c:22
#define GCAPS2_SYNCTIMER
Definition: winddi.h:373
#define DSS_FLUSH_EVENT
Definition: winddi.h:4160
#define DSS_TIMER_EVENT
Definition: winddi.h:4159
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by NtGdiFlush().