ReactOS  0.4.15-dev-1201-gb2cf5a4
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 }
DHPDEV dhpdev
Definition: winddi.h:1207
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2029
DHSURF dhsurf
Definition: winddi.h:1205
_In_ FLONG fl
Definition: winddi.h:1279
if(!(yy_init))
Definition: macro.lex.yy.c:714
HDEV hdev
Definition: winddi.h:1208

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 
80  _SEH2_TRY
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  }
90  _SEH2_END;
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);
228  BRUSH_ShareUnlockBrush(pbrush);
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;
289  flags |= DIRTY_CHARSET;
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  }
337  if (flags & DIRTY_BACKGROUND)
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  {
359  PGDIBSEXTTEXTOUT pgO;
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 
406  if (flags & DIRTY_BACKGROUND)
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 
426  case GdiBCExtSelClipRgn:
427  {
428  PGDIBSEXTSELCLPRGN pgO;
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 
442  DC_hSelectFont(dc, (HFONT)pgO->hgdiobj);
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 }
ULONG Buffer[1]
Definition: ntgdityp.h:529
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:114
DWORD rop4
Definition: ntgdityp.h:491
struct _GDIBSPATBLT * PGDIBSPATBLT
COLORREF crBackgroundClr
Definition: ntgdityp.h:495
ULONG ulBackgroundClr
Definition: ntgdityp.h:540
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1155
PATRECT pRect[1]
Definition: ntgdityp.h:501
ULONG ulBrushClr
Definition: ntgdityp.h:499
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4440
VOID NTAPI EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
Definition: engbrush.c:153
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc)
Definition: dcobjs.c:126
COLORREF crBackgroundClr
Definition: ntgdityp.h:472
SHORT Size
Definition: ntgdityp.h:458
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:113
#define WIN32_ROP4_USES_SOURCE(Rop)
Definition: intgdi.h:7
COLORREF crForegroundClr
Definition: ntgdityp.h:494
#define DIRTY_CHARSET
Definition: ntgdihdl.h:149
DWORD dwRop
Definition: ntgdityp.h:470
struct _GDIBSEXTTEXTOUT * PGDIBSEXTTEXTOUT
SHORT Cmd
Definition: ntgdityp.h:459
COLORREF crForegroundClr
Definition: ntgdityp.h:471
LONG top
Definition: windef.h:307
struct _GDIBSEXTSELCLPRGN * PGDIBSEXTSELCLPRGN
COLORREF crBrushClr
Definition: ntgdityp.h:473
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
struct _GDIBSOBJECT * PGDIBSOBJECT
int32_t INT
Definition: typedefs.h:58
int FASTCALL IntGdiExtSelectClipRect(PDC, PRECTL, int)
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:148
LONG lBkMode
Definition: ntgdityp.h:514
LONG y
Definition: windef.h:330
_SEH2_TRY
Definition: create.c:4226
FLONG flTextAlign
Definition: ntgdityp.h:525
struct _GDIBSTEXTOUT * PGDIBSTEXTOUT
HANDLE hbrush
Definition: ntgdityp.h:469
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
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
long LONG
Definition: pedump.c:60
DWORD Count
Definition: ntgdityp.h:493
struct _GDIBSSETBRHORG * PGDIBSSETBRHORG
ULONG ulBackgroundClr
Definition: ntgdityp.h:498
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
COLORREF crBackgroundClr
Definition: ntgdityp.h:513
struct _GDIBSPPATBLT * PGDIBSPPATBLT
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define MAKEROP4(f, b)
Definition: wingdi.h:2945
COLORREF crBrushClr
Definition: ntgdityp.h:496
unsigned long FLONG
Definition: ntbasedef.h:367
UINT Options
Definition: ntgdityp.h:519
ULONG ulDirty_
Definition: ntgdihdl.h:298
Definition: types.h:100
ULONG ulBackgroundClr
Definition: ntgdityp.h:516
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
HBRUSH hBrush
Definition: ntgdityp.h:485
RECT r
Definition: ntgdityp.h:484
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
__wchar_t WCHAR
Definition: xmlstorage.h:180
COLORREF crForegroundClr
Definition: ntgdityp.h:512
HGDIOBJ hgdiobj
Definition: ntgdityp.h:560
DWORD COLORREF
Definition: windef.h:300
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG x
Definition: windef.h:329
#define GDIBS_NORECT
Definition: ntgdityp.h:507
POINTL ptlViewportOrg
Definition: ntgdityp.h:539
GLbitfield flags
Definition: glext.h:7161
#define DIRTY_TEXT
Definition: ntgdihdl.h:147
#define DIRTY_FILL
Definition: ntgdihdl.h:145
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:5859
#define SLOW_WIDTHS
Definition: ntgdihdl.h:150
Definition: sacdrv.h:277
HANDLE hlfntNew
Definition: ntgdityp.h:524
ULONG ulBackgroundClr
Definition: ntgdityp.h:477
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
POINTL ptlBrushOrigin
Definition: ntgdihdl.h:353
WCHAR String[2]
Definition: ntgdityp.h:528
VOID NTAPI DC_vSetBrushOrigin(PDC pdc, LONG x, LONG y)
Definition: dcobjs.c:142
POINTL ptlViewportOrg
Definition: ntgdityp.h:526
ULONG ulBrushClr
Definition: ntgdityp.h:478
DWORD iCS_CP
Definition: ntgdityp.h:521
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4400
VOID NTAPI EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:112
unsigned short USHORT
Definition: pedump.c:61
ULONG ulForegroundClr
Definition: ntgdityp.h:476
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
#define DPRINT1
Definition: precomp.h:8
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
POINTL ptlBrushOrigin
Definition: ntgdityp.h:546
unsigned int ULONG
Definition: retypes.h:1
UINT cbCount
Definition: ntgdityp.h:522
LONG bottom
Definition: windef.h:309
#define DIRTY_LINE
Definition: ntgdihdl.h:146
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
ULONG ulForegroundClr
Definition: ntgdityp.h:515
BOOL FASTCALL IntPatBlt(PDC, INT, INT, INT, INT, DWORD, PEBRUSHOBJ)
Definition: bitblt.c:772
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
int * LPINT
Definition: windef.h:178
ULONG ulForegroundClr
Definition: ntgdityp.h:497
HFONT NTAPI DC_hSelectFont(_In_ PDC pdc, _In_ HFONT hlfntNew)
Definition: dcobjs.c:550

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 5859 of file freetype.c.

5869 {
5870  /*
5871  * FIXME:
5872  * Call EngTextOut, which does the real work (calling DrvTextOut where
5873  * appropriate)
5874  */
5875 
5876  PDC_ATTR pdcattr;
5877  SURFOBJ *SurfObj;
5878  SURFACE *psurf = NULL;
5879  int error, glyph_index, i;
5880  FT_Face face;
5881  FT_GlyphSlot glyph;
5882  FT_BitmapGlyph realglyph;
5883  LONGLONG TextLeft, RealXStart;
5884  ULONG TextTop, previous, BackgroundLeft;
5885  FT_Bool use_kerning;
5886  RECTL DestRect, MaskRect;
5887  POINTL SourcePoint, BrushOrigin;
5888  HBITMAP HSourceGlyph;
5889  SURFOBJ *SourceGlyphSurf;
5890  SIZEL bitSize;
5891  INT yoff;
5892  FONTOBJ *FontObj;
5893  PFONTGDI FontGDI;
5894  PTEXTOBJ TextObj = NULL;
5895  EXLATEOBJ exloRGB2Dst, exloDst2RGB;
5896  FT_Render_Mode RenderMode;
5897  BOOLEAN Render;
5898  POINT Start;
5899  BOOL DoBreak = FALSE;
5900  USHORT DxShift;
5901  PMATRIX pmxWorldToDevice;
5902  LONG fixAscender, fixDescender;
5903  FLOATOBJ Scale;
5904  LOGFONTW *plf;
5905  BOOL EmuBold, EmuItalic;
5906  int thickness;
5907  BOOL bResult;
5908 
5909  /* Check if String is valid */
5910  if ((Count > 0xFFFF) || (Count > 0 && String == NULL))
5911  {
5913  return FALSE;
5914  }
5915 
5916  Render = IntIsFontRenderingEnabled();
5917 
5918  if (PATH_IsPathOpen(dc->dclevel))
5919  {
5920  bResult = PATH_ExtTextOut(dc,
5921  XStart,
5922  YStart,
5923  fuOptions,
5924  (const RECTL *)lprc,
5925  String,
5926  Count,
5927  (const INT *)Dx);
5928  return bResult;
5929  }
5930 
5932 
5933  if (!dc->dclevel.pSurface)
5934  {
5935  /* Memory DC with no surface selected */
5936  bResult = TRUE;
5937  goto Cleanup;
5938  }
5939 
5940  pdcattr = dc->pdcattr;
5941 
5942  if (lprc && (fuOptions & (ETO_OPAQUE | ETO_CLIPPED)))
5943  {
5944  IntLPtoDP(dc, (POINT *)lprc, 2);
5945  }
5946 
5947  if (pdcattr->flTextAlign & TA_UPDATECP)
5948  {
5949  Start.x = pdcattr->ptlCurrent.x;
5950  Start.y = pdcattr->ptlCurrent.y;
5951  } else {
5952  Start.x = XStart;
5953  Start.y = YStart;
5954  }
5955 
5956  IntLPtoDP(dc, &Start, 1);
5957  RealXStart = ((LONGLONG)Start.x + dc->ptlDCOrig.x) << 6;
5958  YStart = Start.y + dc->ptlDCOrig.y;
5959 
5960  SourcePoint.x = 0;
5961  SourcePoint.y = 0;
5962  MaskRect.left = 0;
5963  MaskRect.top = 0;
5964  BrushOrigin.x = 0;
5965  BrushOrigin.y = 0;
5966 
5967  if ((fuOptions & ETO_OPAQUE) && lprc)
5968  {
5969  DestRect.left = lprc->left;
5970  DestRect.top = lprc->top;
5971  DestRect.right = lprc->right;
5972  DestRect.bottom = lprc->bottom;
5973 
5974  DestRect.left += dc->ptlDCOrig.x;
5975  DestRect.top += dc->ptlDCOrig.y;
5976  DestRect.right += dc->ptlDCOrig.x;
5977  DestRect.bottom += dc->ptlDCOrig.y;
5978 
5979  if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
5980  {
5981  IntUpdateBoundsRect(dc, &DestRect);
5982  }
5983 
5984  if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
5986  if (dc->dctype == DCTYPE_DIRECT)
5987  MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
5988 
5989  psurf = dc->dclevel.pSurface;
5990  IntEngBitBlt(
5991  &psurf->SurfObj,
5992  NULL,
5993  NULL,
5994  (CLIPOBJ *)&dc->co,
5995  NULL,
5996  &DestRect,
5997  &SourcePoint,
5998  &SourcePoint,
5999  &dc->eboBackground.BrushObject,
6000  &BrushOrigin,
6002 
6003  if (dc->dctype == DCTYPE_DIRECT)
6004  MouseSafetyOnDrawEnd(dc->ppdev);
6005 
6006  fuOptions &= ~ETO_OPAQUE;
6007  }
6008  else
6009  {
6010  if (pdcattr->jBkMode == OPAQUE)
6011  {
6012  fuOptions |= ETO_OPAQUE;
6013  }
6014  }
6015 
6016  TextObj = RealizeFontInit(pdcattr->hlfntNew);
6017  if (TextObj == NULL)
6018  {
6019  bResult = FALSE;
6020  goto Cleanup;
6021  }
6022 
6023  FontObj = TextObj->Font;
6024  ASSERT(FontObj);
6025  FontGDI = ObjToGDI(FontObj, FONT);
6026  ASSERT(FontGDI);
6027 
6028  IntLockFreeType();
6029  face = FontGDI->SharedFace->Face;
6030 
6031  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
6032  EmuBold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
6033  EmuItalic = (plf->lfItalic && !FontGDI->OriginalItalic);
6034 
6035  if (Render)
6036  RenderMode = IntGetFontRenderMode(plf);
6037  else
6038  RenderMode = FT_RENDER_MODE_MONO;
6039 
6040  if (!TextIntUpdateSize(dc, TextObj, FontGDI, FALSE))
6041  {
6043  bResult = FALSE;
6044  goto Cleanup;
6045  }
6046 
6047  /* NOTE: Don't trust face->size->metrics.ascender and descender values. */
6048  if (dc->pdcattr->iGraphicsMode == GM_ADVANCED)
6049  {
6050  pmxWorldToDevice = DC_pmxWorldToDevice(dc);
6051  FtSetCoordinateTransform(face, pmxWorldToDevice);
6052 
6053  fixAscender = ScaleLong(FontGDI->tmAscent, &pmxWorldToDevice->efM22) << 6;
6054  fixDescender = ScaleLong(FontGDI->tmDescent, &pmxWorldToDevice->efM22) << 6;
6055  }
6056  else
6057  {
6058  pmxWorldToDevice = (PMATRIX)&gmxWorldToDeviceDefault;
6059  FtSetCoordinateTransform(face, pmxWorldToDevice);
6060 
6061  fixAscender = FontGDI->tmAscent << 6;
6062  fixDescender = FontGDI->tmDescent << 6;
6063  }
6064 
6065  /*
6066  * Process the vertical alignment and determine the yoff.
6067  */
6068 #define VALIGN_MASK (TA_TOP | TA_BASELINE | TA_BOTTOM)
6069  if ((pdcattr->flTextAlign & VALIGN_MASK) == TA_BASELINE)
6070  yoff = 0;
6071  else if ((pdcattr->flTextAlign & VALIGN_MASK) == TA_BOTTOM)
6072  yoff = -(fixDescender >> 6);
6073  else /* TA_TOP */
6074  yoff = fixAscender >> 6;
6075 #undef VALIGN_MASK
6076 
6077  use_kerning = FT_HAS_KERNING(face);
6078  previous = 0;
6079 
6080  /*
6081  * Process the horizontal alignment and modify XStart accordingly.
6082  */
6083  DxShift = (fuOptions & ETO_PDY) ? 1 : 0;
6084  if (pdcattr->flTextAlign & (TA_RIGHT | TA_CENTER))
6085  {
6086  ULONGLONG TextWidth = 0;
6087  LPCWSTR TempText = String;
6088  int iStart;
6089 
6090  /*
6091  * Calculate width of the text.
6092  */
6093 
6094  if (NULL != Dx)
6095  {
6096  iStart = Count < 2 ? 0 : Count - 2;
6097  TextWidth = Count < 2 ? 0 : (Dx[(Count-2)<<DxShift] << 6);
6098  }
6099  else
6100  {
6101  iStart = 0;
6102  }
6103  TempText = String + iStart;
6104 
6105  for (i = iStart; i < Count; i++)
6106  {
6107  glyph_index = get_glyph_index_flagged(face, *TempText, ETO_GLYPH_INDEX, fuOptions);
6108 
6109  if (EmuBold || EmuItalic)
6110  realglyph = NULL;
6111  else
6112  realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
6113  RenderMode, pmxWorldToDevice);
6114  if (!realglyph)
6115  {
6116  if (EmuItalic)
6117  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP);
6118  else
6119  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
6120  if (error)
6121  {
6122  DPRINT1("WARNING: Failed to load and render glyph! [index: %d]\n", glyph_index);
6123  }
6124 
6125  glyph = face->glyph;
6126  if (EmuBold || EmuItalic)
6127  {
6128  if (EmuBold)
6129  FT_GlyphSlot_Embolden(glyph);
6130  if (EmuItalic)
6131  FT_GlyphSlot_Oblique(glyph);
6132  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
6133  }
6134  else
6135  {
6136  realglyph = ftGdiGlyphCacheSet(face,
6137  glyph_index,
6138  plf->lfHeight,
6139  pmxWorldToDevice,
6140  glyph,
6141  RenderMode);
6142  }
6143  if (!realglyph)
6144  {
6145  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
6147  goto Cleanup;
6148  }
6149 
6150  }
6151  /* Retrieve kerning distance */
6152  if (use_kerning && previous && glyph_index)
6153  {
6154  FT_Vector delta;
6155  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
6156  TextWidth += delta.x;
6157  }
6158 
6159  TextWidth += realglyph->root.advance.x >> 10;
6160 
6161  if (EmuBold || EmuItalic)
6162  {
6163  FT_Done_Glyph((FT_Glyph)realglyph);
6164  realglyph = NULL;
6165  }
6166 
6167  previous = glyph_index;
6168  TempText++;
6169  }
6170 
6171  previous = 0;
6172 
6173  if ((pdcattr->flTextAlign & TA_CENTER) == TA_CENTER)
6174  {
6175  RealXStart -= TextWidth / 2;
6176  }
6177  else
6178  {
6179  RealXStart -= TextWidth;
6180  }
6181  }
6182 
6183  psurf = dc->dclevel.pSurface;
6184  SurfObj = &psurf->SurfObj ;
6185 
6186  if ((fuOptions & ETO_OPAQUE) && (dc->pdcattr->ulDirty_ & DIRTY_BACKGROUND))
6188 
6189  if(dc->pdcattr->ulDirty_ & DIRTY_TEXT)
6191 
6192  if (!face->units_per_EM)
6193  {
6194  thickness = 1;
6195  }
6196  else
6197  {
6198  thickness = face->underline_thickness *
6199  face->size->metrics.y_ppem / face->units_per_EM;
6200  if (thickness <= 0)
6201  thickness = 1;
6202  }
6203 
6204  if ((fuOptions & ETO_OPAQUE) && plf->lfItalic)
6205  {
6206  /* Draw background */
6207  TextLeft = RealXStart;
6208  TextTop = YStart;
6209  BackgroundLeft = (RealXStart + 32) >> 6;
6210  for (i = 0; i < Count; ++i)
6211  {
6212  glyph_index = get_glyph_index_flagged(face, String[i], ETO_GLYPH_INDEX, fuOptions);
6213 
6214  if (EmuItalic)
6215  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP);
6216  else
6217  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
6218  if (error)
6219  {
6220  DPRINT1("Failed to load and render glyph! [index: %d]\n", glyph_index);
6222  goto Cleanup;
6223  }
6224 
6225  glyph = face->glyph;
6226  if (EmuBold)
6227  FT_GlyphSlot_Embolden(glyph);
6228  if (EmuItalic)
6229  FT_GlyphSlot_Oblique(glyph);
6230  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
6231  if (!realglyph)
6232  {
6233  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
6235  goto Cleanup;
6236  }
6237 
6238  /* retrieve kerning distance and move pen position */
6239  if (use_kerning && previous && glyph_index && NULL == Dx)
6240  {
6241  FT_Vector delta;
6242  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
6243  TextLeft += delta.x;
6244  }
6245  DPRINT("TextLeft: %I64d\n", TextLeft);
6246  DPRINT("TextTop: %lu\n", TextTop);
6247  DPRINT("Advance: %d\n", realglyph->root.advance.x);
6248 
6249  DestRect.left = BackgroundLeft;
6250  DestRect.right = (TextLeft + (realglyph->root.advance.x >> 10) + 32) >> 6;
6251  DestRect.top = TextTop + yoff - ((fixAscender + 32) >> 6);
6252  DestRect.bottom = DestRect.top + ((fixAscender + fixDescender) >> 6);
6253  MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
6254  if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
6255  {
6256  IntUpdateBoundsRect(dc, &DestRect);
6257  }
6258  IntEngBitBlt(
6259  &psurf->SurfObj,
6260  NULL,
6261  NULL,
6262  (CLIPOBJ *)&dc->co,
6263  NULL,
6264  &DestRect,
6265  &SourcePoint,
6266  &SourcePoint,
6267  &dc->eboBackground.BrushObject,
6268  &BrushOrigin,
6270  MouseSafetyOnDrawEnd(dc->ppdev);
6271  BackgroundLeft = DestRect.right;
6272 
6273  DestRect.left = ((TextLeft + 32) >> 6) + realglyph->left;
6274  DestRect.right = DestRect.left + realglyph->bitmap.width;
6275  DestRect.top = TextTop + yoff - realglyph->top;
6276  DestRect.bottom = DestRect.top + realglyph->bitmap.rows;
6277 
6278  bitSize.cx = realglyph->bitmap.width;
6279  bitSize.cy = realglyph->bitmap.rows;
6280  MaskRect.right = realglyph->bitmap.width;
6281  MaskRect.bottom = realglyph->bitmap.rows;
6282 
6283  if (NULL == Dx)
6284  {
6285  TextLeft += realglyph->root.advance.x >> 10;
6286  DPRINT("New TextLeft: %I64d\n", TextLeft);
6287  }
6288  else
6289  {
6290  // FIXME this should probably be a matrix transform with TextTop as well.
6291  Scale = pdcattr->mxWorldToDevice.efM11;
6292  if (FLOATOBJ_Equal0(&Scale))
6293  FLOATOBJ_Set1(&Scale);
6294 
6295  /* do the shift before multiplying to preserve precision */
6296  FLOATOBJ_MulLong(&Scale, Dx[i<<DxShift] << 6);
6297  TextLeft += FLOATOBJ_GetLong(&Scale);
6298  DPRINT("New TextLeft2: %I64d\n", TextLeft);
6299  }
6300 
6301  if (DxShift)
6302  {
6303  TextTop -= Dx[2 * i + 1] << 6;
6304  }
6305 
6306  previous = glyph_index;
6307 
6308  if (EmuBold || EmuItalic)
6309  {
6310  FT_Done_Glyph((FT_Glyph)realglyph);
6311  realglyph = NULL;
6312  }
6313  }
6314  }
6315 
6316  EXLATEOBJ_vInitialize(&exloRGB2Dst, &gpalRGB, psurf->ppal, 0, 0, 0);
6317  EXLATEOBJ_vInitialize(&exloDst2RGB, psurf->ppal, &gpalRGB, 0, 0, 0);
6318 
6319  /* Assume success */
6320  bResult = TRUE;
6321 
6322  /*
6323  * The main rendering loop.
6324  */
6325  TextLeft = RealXStart;
6326  TextTop = YStart;
6327  BackgroundLeft = (RealXStart + 32) >> 6;
6328  for (i = 0; i < Count; ++i)
6329  {
6330  glyph_index = get_glyph_index_flagged(face, String[i], ETO_GLYPH_INDEX, fuOptions);
6331 
6332  if (EmuBold || EmuItalic)
6333  realglyph = NULL;
6334  else
6335  realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
6336  RenderMode, pmxWorldToDevice);
6337  if (!realglyph)
6338  {
6339  if (EmuItalic)
6340  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP);
6341  else
6342  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
6343  if (error)
6344  {
6345  DPRINT1("Failed to load and render glyph! [index: %d]\n", glyph_index);
6346  bResult = FALSE;
6347  break;
6348  }
6349 
6350  glyph = face->glyph;
6351  if (EmuBold || EmuItalic)
6352  {
6353  if (EmuBold)
6354  FT_GlyphSlot_Embolden(glyph);
6355  if (EmuItalic)
6356  FT_GlyphSlot_Oblique(glyph);
6357  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
6358  }
6359  else
6360  {
6361  realglyph = ftGdiGlyphCacheSet(face,
6362  glyph_index,
6363  plf->lfHeight,
6364  pmxWorldToDevice,
6365  glyph,
6366  RenderMode);
6367  }
6368  if (!realglyph)
6369  {
6370  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
6371  bResult = FALSE;
6372  break;
6373  }
6374  }
6375 
6376  /* retrieve kerning distance and move pen position */
6377  if (use_kerning && previous && glyph_index && NULL == Dx)
6378  {
6379  FT_Vector delta;
6380  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
6381  TextLeft += delta.x;
6382  }
6383  DPRINT("TextLeft: %I64d\n", TextLeft);
6384  DPRINT("TextTop: %lu\n", TextTop);
6385  DPRINT("Advance: %d\n", realglyph->root.advance.x);
6386 
6387  if ((fuOptions & ETO_OPAQUE) && !plf->lfItalic)
6388  {
6389  DestRect.left = BackgroundLeft;
6390  DestRect.right = (TextLeft + (realglyph->root.advance.x >> 10) + 32) >> 6;
6391  DestRect.top = TextTop + yoff - ((fixAscender + 32) >> 6);
6392  DestRect.bottom = DestRect.top + ((fixAscender + fixDescender) >> 6);
6393 
6394  if (dc->dctype == DCTYPE_DIRECT)
6395  MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
6396 
6397  if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
6398  {
6399  IntUpdateBoundsRect(dc, &DestRect);
6400  }
6401  IntEngBitBlt(
6402  &psurf->SurfObj,
6403  NULL,
6404  NULL,
6405  (CLIPOBJ *)&dc->co,
6406  NULL,
6407  &DestRect,
6408  &SourcePoint,
6409  &SourcePoint,
6410  &dc->eboBackground.BrushObject,
6411  &BrushOrigin,
6413 
6414  if (dc->dctype == DCTYPE_DIRECT)
6415  MouseSafetyOnDrawEnd(dc->ppdev);
6416 
6417  BackgroundLeft = DestRect.right;
6418  }
6419 
6420  DestRect.left = ((TextLeft + 32) >> 6) + realglyph->left;
6421  DestRect.right = DestRect.left + realglyph->bitmap.width;
6422  DestRect.top = TextTop + yoff - realglyph->top;
6423  DestRect.bottom = DestRect.top + realglyph->bitmap.rows;
6424 
6425  bitSize.cx = realglyph->bitmap.width;
6426  bitSize.cy = realglyph->bitmap.rows;
6427  MaskRect.right = realglyph->bitmap.width;
6428  MaskRect.bottom = realglyph->bitmap.rows;
6429 
6430  /* Check if the bitmap has any pixels */
6431  if ((bitSize.cx != 0) && (bitSize.cy != 0))
6432  {
6433  /*
6434  * We should create the bitmap out of the loop at the biggest possible
6435  * glyph size. Then use memset with 0 to clear it and sourcerect to
6436  * limit the work of the transbitblt.
6437  */
6438  HSourceGlyph = EngCreateBitmap(bitSize, realglyph->bitmap.pitch,
6440  realglyph->bitmap.buffer);
6441  if ( !HSourceGlyph )
6442  {
6443  DPRINT1("WARNING: EngCreateBitmap() failed!\n");
6444  // FT_Done_Glyph(realglyph);
6445  bResult = FALSE;
6446  break;
6447  }
6448  SourceGlyphSurf = EngLockSurface((HSURF)HSourceGlyph);
6449  if ( !SourceGlyphSurf )
6450  {
6451  EngDeleteSurface((HSURF)HSourceGlyph);
6452  DPRINT1("WARNING: EngLockSurface() failed!\n");
6453  bResult = FALSE;
6454  break;
6455  }
6456 
6457  /*
6458  * Use the font data as a mask to paint onto the DCs surface using a
6459  * brush.
6460  */
6461  if (lprc && (fuOptions & ETO_CLIPPED) &&
6462  DestRect.right >= lprc->right + dc->ptlDCOrig.x)
6463  {
6464  // We do the check '>=' instead of '>' to possibly save an iteration
6465  // through this loop, since it's breaking after the drawing is done,
6466  // and x is always incremented.
6467  DestRect.right = lprc->right + dc->ptlDCOrig.x;
6468  DoBreak = TRUE;
6469  }
6470  if (lprc && (fuOptions & ETO_CLIPPED) &&
6471  DestRect.bottom >= lprc->bottom + dc->ptlDCOrig.y)
6472  {
6473  DestRect.bottom = lprc->bottom + dc->ptlDCOrig.y;
6474  }
6475 
6476  if (dc->dctype == DCTYPE_DIRECT)
6477  MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
6478 
6479  if (!IntEngMaskBlt(
6480  SurfObj,
6481  SourceGlyphSurf,
6482  (CLIPOBJ *)&dc->co,
6483  &exloRGB2Dst.xlo,
6484  &exloDst2RGB.xlo,
6485  &DestRect,
6486  (PPOINTL)&MaskRect,
6487  &dc->eboText.BrushObject,
6488  &BrushOrigin))
6489  {
6490  DPRINT1("Failed to MaskBlt a glyph!\n");
6491  }
6492 
6493  if (dc->dctype == DCTYPE_DIRECT)
6494  MouseSafetyOnDrawEnd(dc->ppdev) ;
6495 
6496  EngUnlockSurface(SourceGlyphSurf);
6497  EngDeleteSurface((HSURF)HSourceGlyph);
6498  }
6499 
6500  if (DoBreak)
6501  {
6502  break;
6503  }
6504 
6505  if (plf->lfUnderline)
6506  {
6507  int i, position;
6508  if (!face->units_per_EM)
6509  {
6510  position = 0;
6511  }
6512  else
6513  {
6514  position = face->underline_position *
6515  face->size->metrics.y_ppem / face->units_per_EM;
6516  }
6517  for (i = -thickness / 2; i < -thickness / 2 + thickness; ++i)
6518  {
6519  EngLineTo(SurfObj,
6520  (CLIPOBJ *)&dc->co,
6521  &dc->eboText.BrushObject,
6522  (TextLeft >> 6),
6523  TextTop + yoff - position + i,
6524  ((TextLeft + (realglyph->root.advance.x >> 10)) >> 6),
6525  TextTop + yoff - position + i,
6526  NULL,
6528  }
6529  }
6530  if (plf->lfStrikeOut)
6531  {
6532  int i;
6533  for (i = -thickness / 2; i < -thickness / 2 + thickness; ++i)
6534  {
6535  EngLineTo(SurfObj,
6536  (CLIPOBJ *)&dc->co,
6537  &dc->eboText.BrushObject,
6538  (TextLeft >> 6),
6539  TextTop + yoff - (fixAscender >> 6) / 3 + i,
6540  ((TextLeft + (realglyph->root.advance.x >> 10)) >> 6),
6541  TextTop + yoff - (fixAscender >> 6) / 3 + i,
6542  NULL,
6544  }
6545  }
6546 
6547  if (NULL == Dx)
6548  {
6549  TextLeft += realglyph->root.advance.x >> 10;
6550  DPRINT("New TextLeft: %I64d\n", TextLeft);
6551  }
6552  else
6553  {
6554  // FIXME this should probably be a matrix transform with TextTop as well.
6555  Scale = pdcattr->mxWorldToDevice.efM11;
6556  if (FLOATOBJ_Equal0(&Scale))
6557  FLOATOBJ_Set1(&Scale);
6558 
6559  /* do the shift before multiplying to preserve precision */
6560  FLOATOBJ_MulLong(&Scale, Dx[i<<DxShift] << 6);
6561  TextLeft += FLOATOBJ_GetLong(&Scale);
6562  DPRINT("New TextLeft2: %I64d\n", TextLeft);
6563  }
6564 
6565  if (DxShift)
6566  {
6567  TextTop -= Dx[2 * i + 1] << 6;
6568  }
6569 
6570  previous = glyph_index;
6571 
6572  if (EmuBold || EmuItalic)
6573  {
6574  FT_Done_Glyph((FT_Glyph)realglyph);
6575  realglyph = NULL;
6576  }
6577  }
6578 
6579  if (pdcattr->flTextAlign & TA_UPDATECP) {
6580  pdcattr->ptlCurrent.x = DestRect.right - dc->ptlDCOrig.x;
6581  }
6582 
6584 
6585  EXLATEOBJ_vCleanup(&exloRGB2Dst);
6586  EXLATEOBJ_vCleanup(&exloDst2RGB);
6587 
6588 Cleanup:
6589 
6591 
6592  if (TextObj != NULL)
6593  TEXTOBJ_UnlockText(TextObj);
6594 
6595  return bResult;
6596 }
#define ROP2_TO_MIX(Rop2)
Definition: inteng.h:40
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
FT_Bitmap bitmap
Definition: ftglyph.h:165
FT_Get_Kerning(FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, FT_UInt kern_mode, FT_Vector *akerning)
Definition: ftobjs.c:3347
ENGAPI BOOL APIENTRY EngLineTo(_Inout_ SURFOBJ *pso, _In_ CLIPOBJ *pco, _In_ BRUSHOBJ *pbo, _In_ LONG x1, _In_ LONG y1, _In_ LONG x2, _In_ LONG y2, _In_opt_ RECTL *prclBounds, _In_ MIX mix)
Definition: lineto.c:440
LONG tmAscent
Definition: engobjects.h:159
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4440
ENGAPI BOOL APIENTRY EngDeleteSurface(_In_ _Post_ptr_invalid_ HSURF hsurf)
Definition: surface.c:564
unsigned int rows
Definition: ftimage.h:263
#define error(str)
Definition: mkdosfs.c:1605
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc)
Definition: dcobjs.c:126
FT_Pos x
Definition: ftimage.h:76
#define FLOATOBJ_Equal0(pf)
Definition: floatobj.h:106
#define TRUE
Definition: types.h:120
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
#define FLOATOBJ_Set1(fo)
Definition: floatobj.h:120
struct _MATRIX * PMATRIX
enum FT_Render_Mode_ FT_Render_Mode
LONG lfHeight
Definition: dimm.idl:59
struct _PALETTE *const ppal
Definition: surface.h:11
#define BMF_TOPDOWN
Definition: winddi.h:1180
LONG top
Definition: windef.h:307
long bottom
Definition: polytest.cpp:53
unsigned char * buffer
Definition: ftimage.h:266
#define FLOATOBJ_GetLong(pf)
Definition: winddi.h:2817
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1223
_In_ UINT iStart
Definition: wingdi.h:3619
static WCHAR String[]
Definition: stringtable.c:55
_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawEnd(_Inout_ PPDEVOBJ ppdev)
Definition: mouse.c:99
#define R2_COPYPEN
Definition: wingdi.h:338
LONG left
Definition: windef.h:306
#define FT_LOAD_DEFAULT
Definition: freetype.h:3008
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:148
LONG y
Definition: windef.h:330
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
#define FT_HAS_KERNING(face)
Definition: freetype.h:1297
XLATEOBJ xlo
Definition: xlateobj.h:21
long right
Definition: polytest.cpp:53
FT_BitmapGlyph APIENTRY ftGdiGlyphSet(FT_Face Face, FT_GlyphSlot GlyphSlot, FT_Render_Mode RenderMode)
Definition: freetype.c:3171
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
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
LONG tmDescent
Definition: engobjects.h:160
#define FALSE
Definition: types.h:117
#define ETO_OPAQUE
Definition: wingdi.h:646
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:3599
Definition: text.h:59
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:760
#define TA_BASELINE
Definition: wingdi.h:927
long top
Definition: polytest.cpp:53
HANDLE hlfntNew
Definition: ntgdihdl.h:334
SURFOBJ SurfObj
Definition: surface.h:8
FT_BEGIN_HEADER FT_GlyphSlot_Embolden(FT_GlyphSlot slot)
Definition: ftsynth.c:90
BYTE OriginalItalic
Definition: engobjects.h:153
unsigned char BOOLEAN
FT_GlyphSlot_Oblique(FT_GlyphSlot slot)
Definition: ftsynth.c:48
#define TA_BOTTOM
Definition: wingdi.h:928
_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawStart(_Inout_ PPDEVOBJ ppdev, _In_ LONG HazardX1, _In_ LONG HazardY1, _In_ LONG HazardX2, _In_ LONG HazardY2)
Definition: mouse.c:41
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
void DPRINT(...)
Definition: polytest.cpp:61
#define ETO_CLIPPED
Definition: wingdi.h:647
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
long left
Definition: polytest.cpp:53
static LONG ScaleLong(LONG lValue, PFLOATOBJ pef)
Definition: freetype.c:5841
#define TA_UPDATECP
Definition: wingdi.h:935
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
ULONG ulDirty_
Definition: ntgdihdl.h:298
#define gmxWorldToDeviceDefault
Definition: freetype.c:53
#define TA_RIGHT
Definition: wingdi.h:932
#define FLOATOBJ_MulLong(pf, l)
Definition: winddi.h:2826
#define PATH_IsPathOpen(dclevel)
Definition: path.h:74
FT_GlyphRec root
Definition: ftglyph.h:162
int64_t LONGLONG
Definition: typedefs.h:68
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
FLOAT FLOATOBJ
Definition: winddi.h:677
uint64_t ULONGLONG
Definition: typedefs.h:67
LONG OriginalWeight
Definition: engobjects.h:154
#define IntUnLockFreeType()
Definition: freetype.c:82
WORD face[3]
Definition: mesh.c:4747
LONG x
Definition: windef.h:329
ENGAPI SURFOBJ *APIENTRY EngLockSurface(_In_ HSURF hsurf)
Definition: surface.c:604
Definition: partlist.h:33
FT_Face Face
Definition: engobjects.h:129
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define DIRTY_TEXT
Definition: ntgdihdl.h:147
VOID FtSetCoordinateTransform(FT_Face face, PMATRIX pmx)
Definition: freetype.c:775
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:1993
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:1028
#define OPAQUE
Definition: wingdi.h:948
#define IntLockFreeType()
Definition: freetype.c:79
static FT_UInt FASTCALL get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
Definition: freetype.c:3717
MATRIX mxWorldToDevice
Definition: ntgdihdl.h:335
static const WCHAR Cleanup[]
Definition: register.c:80
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
BYTE jBkMode
Definition: ntgdihdl.h:312
FLOATOBJ efM22
Definition: ntgdityp.h:415
FONTOBJ * Font
Definition: text.h:66
FT_BitmapGlyph APIENTRY ftGdiGlyphCacheSet(FT_Face Face, INT GlyphIndex, INT Height, PMATRIX pmx, FT_GlyphSlot GlyphSlot, FT_Render_Mode RenderMode)
Definition: freetype.c:3212
PSHARED_FACE SharedFace
Definition: engobjects.h:142
unsigned short USHORT
Definition: pedump.c:61
PTEXTOBJ FASTCALL RealizeFontInit(HFONT hFont)
Definition: font.c:422
BYTE lfStrikeOut
Definition: dimm.idl:66
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:2286
Definition: xlate.c:10
BYTE lfItalic
Definition: dimm.idl:64
FT_BitmapGlyph APIENTRY ftGdiGlyphCacheGet(FT_Face Face, INT GlyphIndex, INT Height, FT_Render_Mode RenderMode, PMATRIX pmx)
Definition: freetype.c:3134
ENGAPI VOID APIENTRY EngUnlockSurface(_In_ _Post_ptr_invalid_ SURFOBJ *pso)
Definition: surface.c:625
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
int pitch
Definition: ftimage.h:265
#define ETO_PDY
Definition: wingdi.h:656
FLONG flTextAlign
Definition: ntgdihdl.h:328
#define DPRINT1
Definition: precomp.h:8
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
#define VALIGN_MASK
FT_Vector advance
Definition: ftglyph.h:113
LOGFONTW elfLogFont
Definition: wingdi.h:2701
VOID FASTCALL IntUpdateBoundsRect(PDC, PRECTL)
Definition: dcutil.c:694
FT_Render_Mode FASTCALL IntGetFontRenderMode(LOGFONTW *logfont)
Definition: freetype.c:2005
unsigned int ULONG
Definition: retypes.h:1
LONG bottom
Definition: windef.h:309
#define ObjToGDI(ClipObj, Type)
Definition: engobjects.h:180
static const WCHAR dc[]
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
#define EMUBOLD_NEEDED(original, request)
Definition: freetype.c:45
PALETTE gpalRGB
Definition: palette.c:20
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
static HBITMAP
Definition: button.c:44
#define TA_CENTER
Definition: wingdi.h:930
LONG lfWeight
Definition: dimm.idl:63
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2778
BYTE lfUnderline
Definition: dimm.idl:65
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:633
POINTL ptlCurrent
Definition: ntgdihdl.h:315
LONG cy
Definition: windef.h:335
#define ROP4_FROM_INDEX(index)
Definition: inteng.h:42
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
ENGAPI HBITMAP APIENTRY EngCreateBitmap(_In_ SIZEL sizl, _In_ LONG lWidth, _In_ ULONG iFormat, _In_ FLONG fl, _In_opt_ PVOID pvBits)
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:604
unsigned int width
Definition: ftimage.h:264
#define GM_ADVANCED
Definition: wingdi.h:864

Referenced by GdiFlushUserBatch(), and GreExtTextOutW().

◆ IntPatBlt()

BOOL FASTCALL IntPatBlt ( PDC  ,
INT  ,
INT  ,
INT  ,
INT  ,
DWORD  ,
PEBRUSHOBJ   
)

Definition at line 772 of file bitblt.c.

780 {
781  RECTL DestRect;
782  SURFACE *psurf;
783  POINTL BrushOrigin;
784  BOOL ret;
785  PBRUSH pbrush;
786 
787  ASSERT(pebo);
788  pbrush = pebo->pbrush;
789  ASSERT(pbrush);
790 
791  if (pbrush->flAttrs & BR_IS_NULL)
792  {
793  return TRUE;
794  }
795 
796  if (Width > 0)
797  {
798  DestRect.left = XLeft;
799  DestRect.right = XLeft + Width;
800  }
801  else
802  {
803  DestRect.left = XLeft + Width + 1;
804  DestRect.right = XLeft + 1;
805  }
806 
807  if (Height > 0)
808  {
809  DestRect.top = YLeft;
810  DestRect.bottom = YLeft + Height;
811  }
812  else
813  {
814  DestRect.top = YLeft + Height + 1;
815  DestRect.bottom = YLeft + 1;
816  }
817 
818  IntLPtoDP(pdc, (LPPOINT)&DestRect, 2);
819 
820  DestRect.left += pdc->ptlDCOrig.x;
821  DestRect.top += pdc->ptlDCOrig.y;
822  DestRect.right += pdc->ptlDCOrig.x;
823  DestRect.bottom += pdc->ptlDCOrig.y;
824 
825  if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
826  {
827  IntUpdateBoundsRect(pdc, &DestRect);
828  }
829 
830 #ifdef _USE_DIBLIB_
831  BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x + XLeft;
832  BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y + YLeft;
833 #else
834  BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x;
835  BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y;
836 #endif
837 
838  DC_vPrepareDCsForBlit(pdc, &DestRect, NULL, NULL);
839 
840  psurf = pdc->dclevel.pSurface;
841 
842  ret = IntEngBitBlt(&psurf->SurfObj,
843  NULL,
844  NULL,
845  (CLIPOBJ *)&pdc->co,
846  NULL,
847  &DestRect,
848  NULL,
849  NULL,
850  &pebo->BrushObject,
851  &BrushOrigin,
852  WIN32_ROP3_TO_ENG_ROP4(dwRop3));
853 
854  DC_vFinishBlit(pdc, NULL);
855 
856  return ret;
857 }
#define TRUE
Definition: types.h:120
long bottom
Definition: polytest.cpp:53
LONG y
Definition: windef.h:330
long right
Definition: polytest.cpp:53
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
SURFOBJ SurfObj
Definition: surface.h:8
#define WIN32_ROP3_TO_ENG_ROP4(dwRop4)
Definition: intgdi.h:4
smooth NULL
Definition: ftsmooth.c:416
long left
Definition: polytest.cpp:53
Definition: types.h:100
#define BR_IS_NULL
Definition: brush.h:101
LONG x
Definition: windef.h:329
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
int ret
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
VOID FASTCALL IntUpdateBoundsRect(PDC, PRECTL)
Definition: dcutil.c:694
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:604

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 }
signed char * PCHAR
Definition: retypes.h:7
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1143
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
static HDC
Definition: imagelist.c:92
ULONG Buffer[GDI_BATCH_BUFFER_SIZE]
Definition: compat.h:692
ULONG FASTCALL GdiFlushUserBatch(PDC dc, PGDIBATCHHDR pHdr)
Definition: gdibatch.c:70
#define GDIBATCHBUFSIZE
Definition: ntgdityp.h:200
smooth NULL
Definition: ftsmooth.c:416
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define PCHAR
Definition: match.c:90
Definition: polytest.cpp:40
if(!(yy_init))
Definition: macro.lex.yy.c:714
GDI_TEB_BATCH GdiTebBatch
Definition: compat.h:716
ULONG GdiBatchCount
Definition: compat.h:746
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
static HDC hDC
Definition: 3dtext.c:33
Definition: compat.h:694
ULONG Offset
Definition: compat.h:690
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:3014
HANDLE HDC
Definition: compat.h:691

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 
50  if (Flags & GCAPS2_SYNCFLUSH)
52  if (Flags & GCAPS2_SYNCTIMER)
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 }
#define DSS_TIMER_EVENT
Definition: winddi.h:4159
#define GCAPS2_SYNCTIMER
Definition: winddi.h:373
#define DSS_FLUSH_EVENT
Definition: winddi.h:4160
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID FASTCALL DoDeviceSync(SURFOBJ *Surface, PRECTL Rect, FLONG fl)
Definition: gdibatch.c:22
smooth NULL
Definition: ftsmooth.c:416
#define GCAPS2_SYNCFLUSH
Definition: winddi.h:372
ENGAPI VOID APIENTRY EngUnlockSurface(_In_ _Post_ptr_invalid_ SURFOBJ *pso)
Definition: surface.c:625

Referenced by NtGdiFlush().