ReactOS  0.4.15-dev-4936-gc06ccce
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
if(dx==0 &&dy==0)
Definition: linetemp.h:174
DHSURF dhsurf
Definition: winddi.h:1205
_In_ FLONG fl
Definition: winddi.h:1279
HDEV hdev
Definition: winddi.h:1208
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474

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:1158
PATRECT pRect[1]
Definition: ntgdityp.h:501
ULONG ulBrushClr
Definition: ntgdityp.h:499
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4445
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:127
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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
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:126
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:186
long LONG
Definition: pedump.c:60
DWORD Count
Definition: ntgdityp.h:493
struct _GDIBSSETBRHORG * PGDIBSSETBRHORG
ULONG ulBackgroundClr
Definition: ntgdityp.h:498
COLORREF crBackgroundClr
Definition: ntgdityp.h:513
struct _GDIBSPPATBLT * PGDIBSPPATBLT
#define MAKEROP4(f, b)
Definition: wingdi.h:2946
COLORREF crBrushClr
Definition: ntgdityp.h:496
unsigned long FLONG
Definition: ntbasedef.h:366
UINT Options
Definition: ntgdityp.h:519
ULONG ulDirty_
Definition: ntgdihdl.h:290
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
COLORREF crForegroundClr
Definition: ntgdityp.h:512
HGDIOBJ hgdiobj
Definition: ntgdityp.h:560
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
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:125
#define DIRTY_FILL
Definition: ntgdihdl.h:123
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:5883
#define SLOW_WIDTHS
Definition: ntgdihdl.h:128
Definition: sacdrv.h:278
HANDLE hlfntNew
Definition: ntgdityp.h:524
ULONG ulBackgroundClr
Definition: ntgdityp.h:477
POINTL ptlBrushOrigin
Definition: ntgdihdl.h:345
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:188
_SEH2_END
Definition: create.c:4400
VOID NTAPI EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:112
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
unsigned short USHORT
Definition: pedump.c:61
ULONG ulForegroundClr
Definition: ntgdityp.h:476
#define NULL
Definition: types.h:112
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:135
#define DPRINT1
Definition: precomp.h:8
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:177
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:124
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
ULONG ulForegroundClr
Definition: ntgdityp.h:515
#define DPRINT
Definition: sndvol32.h:71
BOOL FASTCALL IntPatBlt(PDC, INT, INT, INT, INT, DWORD, PEBRUSHOBJ)
Definition: bitblt.c:837
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 5883 of file freetype.c.

5893 {
5894  /*
5895  * FIXME:
5896  * Call EngTextOut, which does the real work (calling DrvTextOut where
5897  * appropriate)
5898  */
5899 
5900  PDC_ATTR pdcattr;
5901  SURFOBJ *SurfObj;
5902  SURFACE *psurf = NULL;
5903  int error, glyph_index, i;
5904  FT_Face face;
5905  FT_GlyphSlot glyph;
5906  FT_BitmapGlyph realglyph;
5907  LONGLONG TextLeft, RealXStart;
5908  ULONG TextTop, previous, BackgroundLeft;
5909  FT_Bool use_kerning;
5910  RECTL DestRect, MaskRect;
5911  POINTL SourcePoint, BrushOrigin;
5912  HBITMAP HSourceGlyph;
5913  SURFOBJ *SourceGlyphSurf;
5914  SIZEL bitSize;
5915  INT yoff;
5916  FONTOBJ *FontObj;
5917  PFONTGDI FontGDI;
5918  PTEXTOBJ TextObj = NULL;
5919  EXLATEOBJ exloRGB2Dst, exloDst2RGB;
5920  FT_Render_Mode RenderMode;
5921  BOOLEAN Render;
5922  POINT Start;
5923  BOOL DoBreak = FALSE;
5924  USHORT DxShift;
5925  PMATRIX pmxWorldToDevice;
5926  LONG fixAscender, fixDescender;
5927  FLOATOBJ Scale;
5928  LOGFONTW *plf;
5929  BOOL EmuBold, EmuItalic;
5930  int thickness;
5931  BOOL bResult;
5932 
5933  /* Check if String is valid */
5934  if ((Count > 0xFFFF) || (Count > 0 && String == NULL))
5935  {
5937  return FALSE;
5938  }
5939 
5940  Render = IntIsFontRenderingEnabled();
5941 
5942  if (PATH_IsPathOpen(dc->dclevel))
5943  {
5944  bResult = PATH_ExtTextOut(dc,
5945  XStart,
5946  YStart,
5947  fuOptions,
5948  (const RECTL *)lprc,
5949  String,
5950  Count,
5951  (const INT *)Dx);
5952  return bResult;
5953  }
5954 
5956 
5957  if (!dc->dclevel.pSurface)
5958  {
5959  /* Memory DC with no surface selected */
5960  bResult = TRUE;
5961  goto Cleanup;
5962  }
5963 
5964  pdcattr = dc->pdcattr;
5965 
5966  if (lprc && (fuOptions & (ETO_OPAQUE | ETO_CLIPPED)))
5967  {
5968  IntLPtoDP(dc, (POINT *)lprc, 2);
5969  }
5970 
5971  if (pdcattr->flTextAlign & TA_UPDATECP)
5972  {
5973  Start.x = pdcattr->ptlCurrent.x;
5974  Start.y = pdcattr->ptlCurrent.y;
5975  } else {
5976  Start.x = XStart;
5977  Start.y = YStart;
5978  }
5979 
5980  IntLPtoDP(dc, &Start, 1);
5981  RealXStart = ((LONGLONG)Start.x + dc->ptlDCOrig.x) << 6;
5982  YStart = Start.y + dc->ptlDCOrig.y;
5983 
5984  SourcePoint.x = 0;
5985  SourcePoint.y = 0;
5986  MaskRect.left = 0;
5987  MaskRect.top = 0;
5988  BrushOrigin.x = 0;
5989  BrushOrigin.y = 0;
5990 
5991  if ((fuOptions & ETO_OPAQUE) && lprc)
5992  {
5993  DestRect.left = lprc->left;
5994  DestRect.top = lprc->top;
5995  DestRect.right = lprc->right;
5996  DestRect.bottom = lprc->bottom;
5997 
5998  DestRect.left += dc->ptlDCOrig.x;
5999  DestRect.top += dc->ptlDCOrig.y;
6000  DestRect.right += dc->ptlDCOrig.x;
6001  DestRect.bottom += dc->ptlDCOrig.y;
6002 
6003  if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
6004  {
6005  IntUpdateBoundsRect(dc, &DestRect);
6006  }
6007 
6008  if (pdcattr->ulDirty_ & DIRTY_BACKGROUND)
6010  if (dc->dctype == DCTYPE_DIRECT)
6011  MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
6012 
6013  psurf = dc->dclevel.pSurface;
6014  IntEngBitBlt(
6015  &psurf->SurfObj,
6016  NULL,
6017  NULL,
6018  (CLIPOBJ *)&dc->co,
6019  NULL,
6020  &DestRect,
6021  &SourcePoint,
6022  &SourcePoint,
6023  &dc->eboBackground.BrushObject,
6024  &BrushOrigin,
6026 
6027  if (dc->dctype == DCTYPE_DIRECT)
6028  MouseSafetyOnDrawEnd(dc->ppdev);
6029 
6030  fuOptions &= ~ETO_OPAQUE;
6031  }
6032  else
6033  {
6034  if (pdcattr->jBkMode == OPAQUE)
6035  {
6036  fuOptions |= ETO_OPAQUE;
6037  }
6038  }
6039 
6040  TextObj = RealizeFontInit(pdcattr->hlfntNew);
6041  if (TextObj == NULL)
6042  {
6043  bResult = FALSE;
6044  goto Cleanup;
6045  }
6046 
6047  FontObj = TextObj->Font;
6048  ASSERT(FontObj);
6049  FontGDI = ObjToGDI(FontObj, FONT);
6050  ASSERT(FontGDI);
6051 
6052  IntLockFreeType();
6053  face = FontGDI->SharedFace->Face;
6054 
6055  plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont;
6056  EmuBold = EMUBOLD_NEEDED(FontGDI->OriginalWeight, plf->lfWeight);
6057  EmuItalic = (plf->lfItalic && !FontGDI->OriginalItalic);
6058 
6059  if (Render)
6060  RenderMode = IntGetFontRenderMode(plf);
6061  else
6062  RenderMode = FT_RENDER_MODE_MONO;
6063 
6064  if (!TextIntUpdateSize(dc, TextObj, FontGDI, FALSE))
6065  {
6067  bResult = FALSE;
6068  goto Cleanup;
6069  }
6070 
6071  /* NOTE: Don't trust face->size->metrics.ascender and descender values. */
6072  if (dc->pdcattr->iGraphicsMode == GM_ADVANCED)
6073  {
6074  pmxWorldToDevice = DC_pmxWorldToDevice(dc);
6075  FtSetCoordinateTransform(face, pmxWorldToDevice);
6076 
6077  fixAscender = ScaleLong(FontGDI->tmAscent, &pmxWorldToDevice->efM22) << 6;
6078  fixDescender = ScaleLong(FontGDI->tmDescent, &pmxWorldToDevice->efM22) << 6;
6079  }
6080  else
6081  {
6082  pmxWorldToDevice = (PMATRIX)&gmxWorldToDeviceDefault;
6083  FtSetCoordinateTransform(face, pmxWorldToDevice);
6084 
6085  fixAscender = FontGDI->tmAscent << 6;
6086  fixDescender = FontGDI->tmDescent << 6;
6087  }
6088 
6089  /*
6090  * Process the vertical alignment and determine the yoff.
6091  */
6092 #define VALIGN_MASK (TA_TOP | TA_BASELINE | TA_BOTTOM)
6093  if ((pdcattr->flTextAlign & VALIGN_MASK) == TA_BASELINE)
6094  yoff = 0;
6095  else if ((pdcattr->flTextAlign & VALIGN_MASK) == TA_BOTTOM)
6096  yoff = -(fixDescender >> 6);
6097  else /* TA_TOP */
6098  yoff = fixAscender >> 6;
6099 #undef VALIGN_MASK
6100 
6101  use_kerning = FT_HAS_KERNING(face);
6102  previous = 0;
6103 
6104  /*
6105  * Process the horizontal alignment and modify XStart accordingly.
6106  */
6107  DxShift = (fuOptions & ETO_PDY) ? 1 : 0;
6108  if (pdcattr->flTextAlign & (TA_RIGHT | TA_CENTER))
6109  {
6110  ULONGLONG TextWidth = 0;
6111  LPCWSTR TempText = String;
6112  int iStart;
6113 
6114  /*
6115  * Calculate width of the text.
6116  */
6117 
6118  if (NULL != Dx)
6119  {
6120  iStart = Count < 2 ? 0 : Count - 2;
6121  TextWidth = Count < 2 ? 0 : (Dx[(Count-2)<<DxShift] << 6);
6122  }
6123  else
6124  {
6125  iStart = 0;
6126  }
6127  TempText = String + iStart;
6128 
6129  for (i = iStart; i < Count; i++)
6130  {
6131  glyph_index = get_glyph_index_flagged(face, *TempText, ETO_GLYPH_INDEX, fuOptions);
6132 
6133  if (EmuBold || EmuItalic)
6134  realglyph = NULL;
6135  else
6136  realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
6137  RenderMode, pmxWorldToDevice);
6138  if (!realglyph)
6139  {
6140  if (EmuItalic)
6141  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP);
6142  else
6143  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
6144  if (error)
6145  {
6146  DPRINT1("WARNING: Failed to load and render glyph! [index: %d]\n", glyph_index);
6147  }
6148 
6149  glyph = face->glyph;
6150  if (EmuBold || EmuItalic)
6151  {
6152  if (EmuBold)
6153  FT_GlyphSlot_Embolden(glyph);
6154  if (EmuItalic)
6155  FT_GlyphSlot_Oblique(glyph);
6156  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
6157  }
6158  else
6159  {
6160  realglyph = ftGdiGlyphCacheSet(face,
6161  glyph_index,
6162  plf->lfHeight,
6163  pmxWorldToDevice,
6164  glyph,
6165  RenderMode);
6166  }
6167  if (!realglyph)
6168  {
6169  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
6171  bResult = FALSE;
6172  goto Cleanup;
6173  }
6174 
6175  }
6176  /* Retrieve kerning distance */
6177  if (use_kerning && previous && glyph_index)
6178  {
6179  FT_Vector delta;
6180  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
6181  TextWidth += delta.x;
6182  }
6183 
6184  TextWidth += realglyph->root.advance.x >> 10;
6185 
6186  if (EmuBold || EmuItalic)
6187  {
6188  FT_Done_Glyph((FT_Glyph)realglyph);
6189  realglyph = NULL;
6190  }
6191 
6192  previous = glyph_index;
6193  TempText++;
6194  }
6195 
6196  previous = 0;
6197 
6198  if ((pdcattr->flTextAlign & TA_CENTER) == TA_CENTER)
6199  {
6200  RealXStart -= TextWidth / 2;
6201  }
6202  else
6203  {
6204  RealXStart -= TextWidth;
6205  }
6206  }
6207 
6208  psurf = dc->dclevel.pSurface;
6209  SurfObj = &psurf->SurfObj ;
6210 
6211  if ((fuOptions & ETO_OPAQUE) && (dc->pdcattr->ulDirty_ & DIRTY_BACKGROUND))
6213 
6214  if(dc->pdcattr->ulDirty_ & DIRTY_TEXT)
6216 
6217  if (!face->units_per_EM)
6218  {
6219  thickness = 1;
6220  }
6221  else
6222  {
6223  thickness = face->underline_thickness *
6224  face->size->metrics.y_ppem / face->units_per_EM;
6225  if (thickness <= 0)
6226  thickness = 1;
6227  }
6228 
6229  if ((fuOptions & ETO_OPAQUE) && plf->lfItalic)
6230  {
6231  /* Draw background */
6232  TextLeft = RealXStart;
6233  TextTop = YStart;
6234  BackgroundLeft = (RealXStart + 32) >> 6;
6235  for (i = 0; i < Count; ++i)
6236  {
6237  glyph_index = get_glyph_index_flagged(face, String[i], ETO_GLYPH_INDEX, fuOptions);
6238 
6239  if (EmuItalic)
6240  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP);
6241  else
6242  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
6243  if (error)
6244  {
6245  DPRINT1("Failed to load and render glyph! [index: %d]\n", glyph_index);
6247  bResult = FALSE;
6248  goto Cleanup;
6249  }
6250 
6251  glyph = face->glyph;
6252  if (EmuBold)
6253  FT_GlyphSlot_Embolden(glyph);
6254  if (EmuItalic)
6255  FT_GlyphSlot_Oblique(glyph);
6256  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
6257  if (!realglyph)
6258  {
6259  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
6261  bResult = FALSE;
6262  goto Cleanup;
6263  }
6264 
6265  /* retrieve kerning distance and move pen position */
6266  if (use_kerning && previous && glyph_index && NULL == Dx)
6267  {
6268  FT_Vector delta;
6269  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
6270  TextLeft += delta.x;
6271  }
6272  DPRINT("TextLeft: %I64d\n", TextLeft);
6273  DPRINT("TextTop: %lu\n", TextTop);
6274  DPRINT("Advance: %d\n", realglyph->root.advance.x);
6275 
6276  DestRect.left = BackgroundLeft;
6277  DestRect.right = (TextLeft + (realglyph->root.advance.x >> 10) + 32) >> 6;
6278  DestRect.top = TextTop + yoff - ((fixAscender + 32) >> 6);
6279  DestRect.bottom = DestRect.top + ((fixAscender + fixDescender) >> 6);
6280  MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
6281  if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
6282  {
6283  IntUpdateBoundsRect(dc, &DestRect);
6284  }
6285  IntEngBitBlt(
6286  &psurf->SurfObj,
6287  NULL,
6288  NULL,
6289  (CLIPOBJ *)&dc->co,
6290  NULL,
6291  &DestRect,
6292  &SourcePoint,
6293  &SourcePoint,
6294  &dc->eboBackground.BrushObject,
6295  &BrushOrigin,
6297  MouseSafetyOnDrawEnd(dc->ppdev);
6298  BackgroundLeft = DestRect.right;
6299 
6300  DestRect.left = ((TextLeft + 32) >> 6) + realglyph->left;
6301  DestRect.right = DestRect.left + realglyph->bitmap.width;
6302  DestRect.top = TextTop + yoff - realglyph->top;
6303  DestRect.bottom = DestRect.top + realglyph->bitmap.rows;
6304 
6305  bitSize.cx = realglyph->bitmap.width;
6306  bitSize.cy = realglyph->bitmap.rows;
6307  MaskRect.right = realglyph->bitmap.width;
6308  MaskRect.bottom = realglyph->bitmap.rows;
6309 
6310  if (NULL == Dx)
6311  {
6312  TextLeft += realglyph->root.advance.x >> 10;
6313  DPRINT("New TextLeft: %I64d\n", TextLeft);
6314  }
6315  else
6316  {
6317  // FIXME this should probably be a matrix transform with TextTop as well.
6318  Scale = pdcattr->mxWorldToDevice.efM11;
6319  if (FLOATOBJ_Equal0(&Scale))
6320  FLOATOBJ_Set1(&Scale);
6321 
6322  /* do the shift before multiplying to preserve precision */
6323  FLOATOBJ_MulLong(&Scale, Dx[i<<DxShift] << 6);
6324  TextLeft += FLOATOBJ_GetLong(&Scale);
6325  DPRINT("New TextLeft2: %I64d\n", TextLeft);
6326  }
6327 
6328  if (DxShift)
6329  {
6330  TextTop -= Dx[2 * i + 1] << 6;
6331  }
6332 
6333  previous = glyph_index;
6334 
6335  if (EmuBold || EmuItalic)
6336  {
6337  FT_Done_Glyph((FT_Glyph)realglyph);
6338  realglyph = NULL;
6339  }
6340  }
6341  }
6342 
6343  EXLATEOBJ_vInitialize(&exloRGB2Dst, &gpalRGB, psurf->ppal, 0, 0, 0);
6344  EXLATEOBJ_vInitialize(&exloDst2RGB, psurf->ppal, &gpalRGB, 0, 0, 0);
6345 
6346  /* Assume success */
6347  bResult = TRUE;
6348 
6349  /*
6350  * The main rendering loop.
6351  */
6352  TextLeft = RealXStart;
6353  TextTop = YStart;
6354  BackgroundLeft = (RealXStart + 32) >> 6;
6355  for (i = 0; i < Count; ++i)
6356  {
6357  glyph_index = get_glyph_index_flagged(face, String[i], ETO_GLYPH_INDEX, fuOptions);
6358 
6359  if (EmuBold || EmuItalic)
6360  realglyph = NULL;
6361  else
6362  realglyph = ftGdiGlyphCacheGet(face, glyph_index, plf->lfHeight,
6363  RenderMode, pmxWorldToDevice);
6364  if (!realglyph)
6365  {
6366  if (EmuItalic)
6367  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_BITMAP);
6368  else
6369  error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
6370  if (error)
6371  {
6372  DPRINT1("Failed to load and render glyph! [index: %d]\n", glyph_index);
6373  bResult = FALSE;
6374  break;
6375  }
6376 
6377  glyph = face->glyph;
6378  if (EmuBold || EmuItalic)
6379  {
6380  if (EmuBold)
6381  FT_GlyphSlot_Embolden(glyph);
6382  if (EmuItalic)
6383  FT_GlyphSlot_Oblique(glyph);
6384  realglyph = ftGdiGlyphSet(face, glyph, RenderMode);
6385  }
6386  else
6387  {
6388  realglyph = ftGdiGlyphCacheSet(face,
6389  glyph_index,
6390  plf->lfHeight,
6391  pmxWorldToDevice,
6392  glyph,
6393  RenderMode);
6394  }
6395  if (!realglyph)
6396  {
6397  DPRINT1("Failed to render glyph! [index: %d]\n", glyph_index);
6398  bResult = FALSE;
6399  break;
6400  }
6401  }
6402 
6403  /* retrieve kerning distance and move pen position */
6404  if (use_kerning && previous && glyph_index && NULL == Dx)
6405  {
6406  FT_Vector delta;
6407  FT_Get_Kerning(face, previous, glyph_index, 0, &delta);
6408  TextLeft += delta.x;
6409  }
6410  DPRINT("TextLeft: %I64d\n", TextLeft);
6411  DPRINT("TextTop: %lu\n", TextTop);
6412  DPRINT("Advance: %d\n", realglyph->root.advance.x);
6413 
6414  if ((fuOptions & ETO_OPAQUE) && !plf->lfItalic)
6415  {
6416  DestRect.left = BackgroundLeft;
6417  DestRect.right = (TextLeft + (realglyph->root.advance.x >> 10) + 32) >> 6;
6418  DestRect.top = TextTop + yoff - ((fixAscender + 32) >> 6);
6419  DestRect.bottom = DestRect.top + ((fixAscender + fixDescender) >> 6);
6420 
6421  if (dc->dctype == DCTYPE_DIRECT)
6422  MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
6423 
6424  if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
6425  {
6426  IntUpdateBoundsRect(dc, &DestRect);
6427  }
6428  IntEngBitBlt(
6429  &psurf->SurfObj,
6430  NULL,
6431  NULL,
6432  (CLIPOBJ *)&dc->co,
6433  NULL,
6434  &DestRect,
6435  &SourcePoint,
6436  &SourcePoint,
6437  &dc->eboBackground.BrushObject,
6438  &BrushOrigin,
6440 
6441  if (dc->dctype == DCTYPE_DIRECT)
6442  MouseSafetyOnDrawEnd(dc->ppdev);
6443 
6444  BackgroundLeft = DestRect.right;
6445  }
6446 
6447  DestRect.left = ((TextLeft + 32) >> 6) + realglyph->left;
6448  DestRect.right = DestRect.left + realglyph->bitmap.width;
6449  DestRect.top = TextTop + yoff - realglyph->top;
6450  DestRect.bottom = DestRect.top + realglyph->bitmap.rows;
6451 
6452  bitSize.cx = realglyph->bitmap.width;
6453  bitSize.cy = realglyph->bitmap.rows;
6454  MaskRect.right = realglyph->bitmap.width;
6455  MaskRect.bottom = realglyph->bitmap.rows;
6456 
6457  /* Check if the bitmap has any pixels */
6458  if ((bitSize.cx != 0) && (bitSize.cy != 0))
6459  {
6460  /*
6461  * We should create the bitmap out of the loop at the biggest possible
6462  * glyph size. Then use memset with 0 to clear it and sourcerect to
6463  * limit the work of the transbitblt.
6464  */
6465  HSourceGlyph = EngCreateBitmap(bitSize, realglyph->bitmap.pitch,
6467  realglyph->bitmap.buffer);
6468  if ( !HSourceGlyph )
6469  {
6470  DPRINT1("WARNING: EngCreateBitmap() failed!\n");
6471  // FT_Done_Glyph(realglyph);
6472  bResult = FALSE;
6473  break;
6474  }
6475  SourceGlyphSurf = EngLockSurface((HSURF)HSourceGlyph);
6476  if ( !SourceGlyphSurf )
6477  {
6478  EngDeleteSurface((HSURF)HSourceGlyph);
6479  DPRINT1("WARNING: EngLockSurface() failed!\n");
6480  bResult = FALSE;
6481  break;
6482  }
6483 
6484  /*
6485  * Use the font data as a mask to paint onto the DCs surface using a
6486  * brush.
6487  */
6488  if (lprc && (fuOptions & ETO_CLIPPED) &&
6489  DestRect.right >= lprc->right + dc->ptlDCOrig.x)
6490  {
6491  // We do the check '>=' instead of '>' to possibly save an iteration
6492  // through this loop, since it's breaking after the drawing is done,
6493  // and x is always incremented.
6494  DestRect.right = lprc->right + dc->ptlDCOrig.x;
6495  DoBreak = TRUE;
6496  }
6497  if (lprc && (fuOptions & ETO_CLIPPED) &&
6498  DestRect.bottom >= lprc->bottom + dc->ptlDCOrig.y)
6499  {
6500  DestRect.bottom = lprc->bottom + dc->ptlDCOrig.y;
6501  }
6502 
6503  if (dc->dctype == DCTYPE_DIRECT)
6504  MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom);
6505 
6506  if (!IntEngMaskBlt(
6507  SurfObj,
6508  SourceGlyphSurf,
6509  (CLIPOBJ *)&dc->co,
6510  &exloRGB2Dst.xlo,
6511  &exloDst2RGB.xlo,
6512  &DestRect,
6513  (PPOINTL)&MaskRect,
6514  &dc->eboText.BrushObject,
6515  &BrushOrigin))
6516  {
6517  DPRINT1("Failed to MaskBlt a glyph!\n");
6518  }
6519 
6520  if (dc->dctype == DCTYPE_DIRECT)
6521  MouseSafetyOnDrawEnd(dc->ppdev) ;
6522 
6523  EngUnlockSurface(SourceGlyphSurf);
6524  EngDeleteSurface((HSURF)HSourceGlyph);
6525  }
6526 
6527  if (DoBreak)
6528  {
6529  break;
6530  }
6531 
6532  if (plf->lfUnderline)
6533  {
6534  int i, position;
6535  if (!face->units_per_EM)
6536  {
6537  position = 0;
6538  }
6539  else
6540  {
6541  position = face->underline_position *
6542  face->size->metrics.y_ppem / face->units_per_EM;
6543  }
6544  for (i = -thickness / 2; i < -thickness / 2 + thickness; ++i)
6545  {
6546  EngLineTo(SurfObj,
6547  (CLIPOBJ *)&dc->co,
6548  &dc->eboText.BrushObject,
6549  (TextLeft >> 6),
6550  TextTop + yoff - position + i,
6551  ((TextLeft + (realglyph->root.advance.x >> 10)) >> 6),
6552  TextTop + yoff - position + i,
6553  NULL,
6555  }
6556  }
6557  if (plf->lfStrikeOut)
6558  {
6559  int i;
6560  for (i = -thickness / 2; i < -thickness / 2 + thickness; ++i)
6561  {
6562  EngLineTo(SurfObj,
6563  (CLIPOBJ *)&dc->co,
6564  &dc->eboText.BrushObject,
6565  (TextLeft >> 6),
6566  TextTop + yoff - (fixAscender >> 6) / 3 + i,
6567  ((TextLeft + (realglyph->root.advance.x >> 10)) >> 6),
6568  TextTop + yoff - (fixAscender >> 6) / 3 + i,
6569  NULL,
6571  }
6572  }
6573 
6574  if (NULL == Dx)
6575  {
6576  TextLeft += realglyph->root.advance.x >> 10;
6577  DPRINT("New TextLeft: %I64d\n", TextLeft);
6578  }
6579  else
6580  {
6581  // FIXME this should probably be a matrix transform with TextTop as well.
6582  Scale = pdcattr->mxWorldToDevice.efM11;
6583  if (FLOATOBJ_Equal0(&Scale))
6584  FLOATOBJ_Set1(&Scale);
6585 
6586  /* do the shift before multiplying to preserve precision */
6587  FLOATOBJ_MulLong(&Scale, Dx[i<<DxShift] << 6);
6588  TextLeft += FLOATOBJ_GetLong(&Scale);
6589  DPRINT("New TextLeft2: %I64d\n", TextLeft);
6590  }
6591 
6592  if (DxShift)
6593  {
6594  TextTop -= Dx[2 * i + 1] << 6;
6595  }
6596 
6597  previous = glyph_index;
6598 
6599  if (EmuBold || EmuItalic)
6600  {
6601  FT_Done_Glyph((FT_Glyph)realglyph);
6602  realglyph = NULL;
6603  }
6604  }
6605 
6606  if (pdcattr->flTextAlign & TA_UPDATECP) {
6607  pdcattr->ptlCurrent.x = DestRect.right - dc->ptlDCOrig.x;
6608  }
6609 
6611 
6612  EXLATEOBJ_vCleanup(&exloRGB2Dst);
6613  EXLATEOBJ_vCleanup(&exloDst2RGB);
6614 
6615 Cleanup:
6616 
6618 
6619  if (TextObj != NULL)
6620  TEXTOBJ_UnlockText(TextObj);
6621 
6622  return bResult;
6623 }
#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:4445
ENGAPI BOOL APIENTRY EngDeleteSurface(_In_ _Post_ptr_invalid_ HSURF hsurf)
Definition: surface.c:567
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:104
#define TRUE
Definition: types.h:120
#define FLOATOBJ_Set1(fo)
Definition: floatobj.h:119
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
FORCEINLINE VOID TEXTOBJ_UnlockText(PLFONT plfnt)
Definition: text.h:96
_In_ UINT iStart
Definition: wingdi.h:3620
_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawEnd(_Inout_ PPDEVOBJ ppdev)
Definition: mouse.c:99
#define R2_COPYPEN
Definition: wingdi.h:339
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:126
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:3195
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
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2430
LONG tmDescent
Definition: engobjects.h:160
#define FALSE
Definition: types.h:117
#define ETO_OPAQUE
Definition: wingdi.h:647
BOOL FASTCALL TextIntUpdateSize(PDC dc, PTEXTOBJ TextObj, PFONTGDI FontGDI, BOOL bDoLock)
Definition: freetype.c:3623
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:928
long top
Definition: polytest.cpp:53
HANDLE hlfntNew
Definition: ntgdihdl.h:326
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:929
_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
LONG cx
Definition: windef.h:334
#define ETO_CLIPPED
Definition: wingdi.h:648
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:5865
#define TA_UPDATECP
Definition: wingdi.h:936
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
ULONG ulDirty_
Definition: ntgdihdl.h:290
#define gmxWorldToDeviceDefault
Definition: freetype.c:53
#define TA_RIGHT
Definition: wingdi.h:933
#define FLOATOBJ_MulLong(pf, l)
Definition: winddi.h:2826
#define PATH_IsPathOpen(dclevel)
Definition: path.h:72
FT_GlyphRec root
Definition: ftglyph.h:162
int64_t LONGLONG
Definition: typedefs.h:68
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
int Count
Definition: noreturn.cpp:7
#define ASSERT(a)
Definition: mode.c:44
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:607
Definition: partlist.h:33
Definition: xlate.c:10
FT_Face Face
Definition: engobjects.h:129
#define DIRTY_TEXT
Definition: ntgdihdl.h:125
VOID FtSetCoordinateTransform(FT_Face face, PMATRIX pmx)
Definition: freetype.c:775
BOOL FASTCALL IntIsFontRenderingEnabled(VOID)
Definition: freetype.c:2017
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
#define OPAQUE
Definition: wingdi.h:949
#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:3741
MATRIX mxWorldToDevice
Definition: ntgdihdl.h:327
static const WCHAR Cleanup[]
Definition: register.c:80
LONG APIENTRY FLOATOBJ_GetLong(FLOATOBJ *pf)
Definition: floatobj.c:17
ENUMLOGFONTEXDVW logfont
Definition: text.h:70
BYTE jBkMode
Definition: ntgdihdl.h:304
FLOATOBJ efM22
Definition: ntgdityp.h:415
FONTOBJ * Font
Definition: text.h:66
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
FT_BitmapGlyph APIENTRY ftGdiGlyphCacheSet(FT_Face Face, INT GlyphIndex, INT Height, PMATRIX pmx, FT_GlyphSlot GlyphSlot, FT_Render_Mode RenderMode)
Definition: freetype.c:3236
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:2356
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:3158
ENGAPI VOID APIENTRY EngUnlockSurface(_In_ _Post_ptr_invalid_ SURFOBJ *pso)
Definition: surface.c:628
#define NULL
Definition: types.h:112
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:657
FLONG flTextAlign
Definition: ntgdihdl.h:320
#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:2702
VOID FASTCALL IntUpdateBoundsRect(PDC, PRECTL)
Definition: dcutil.c:694
FT_Render_Mode FASTCALL IntGetFontRenderMode(LOGFONTW *logfont)
Definition: freetype.c:2029
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:135
#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:931
LONG lfWeight
Definition: dimm.idl:63
ENUMLOGFONTEXW elfEnumLogfontEx
Definition: wingdi.h:2779
#define DPRINT
Definition: sndvol32.h:71
BYTE lfUnderline
Definition: dimm.idl:65
FT_Done_Glyph(FT_Glyph glyph)
Definition: ftglyph.c:633
POINTL ptlCurrent
Definition: ntgdihdl.h:307
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:28
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:656
unsigned int width
Definition: ftimage.h:264
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182
#define GM_ADVANCED
Definition: wingdi.h:865

Referenced by GdiFlushUserBatch(), and GreExtTextOutW().

◆ IntPatBlt()

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

Definition at line 837 of file bitblt.c.

845 {
846  RECTL DestRect;
847  SURFACE *psurf;
848  POINTL BrushOrigin;
849  BOOL ret;
850  PBRUSH pbrush;
851 
852  ASSERT(pebo);
853  pbrush = pebo->pbrush;
854  ASSERT(pbrush);
855 
856  if (pbrush->flAttrs & BR_IS_NULL)
857  {
858  return TRUE;
859  }
860 
861  if (Width > 0)
862  {
863  DestRect.left = XLeft;
864  DestRect.right = XLeft + Width;
865  }
866  else
867  {
868  DestRect.left = XLeft + Width + 1;
869  DestRect.right = XLeft + 1;
870  }
871 
872  if (Height > 0)
873  {
874  DestRect.top = YLeft;
875  DestRect.bottom = YLeft + Height;
876  }
877  else
878  {
879  DestRect.top = YLeft + Height + 1;
880  DestRect.bottom = YLeft + 1;
881  }
882 
883  IntLPtoDP(pdc, (LPPOINT)&DestRect, 2);
884 
885  DestRect.left += pdc->ptlDCOrig.x;
886  DestRect.top += pdc->ptlDCOrig.y;
887  DestRect.right += pdc->ptlDCOrig.x;
888  DestRect.bottom += pdc->ptlDCOrig.y;
889 
890  if (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
891  {
892  IntUpdateBoundsRect(pdc, &DestRect);
893  }
894 
895 #ifdef _USE_DIBLIB_
896  BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x + XLeft;
897  BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y + YLeft;
898 #else
899  BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x;
900  BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y;
901 #endif
902 
903  DC_vPrepareDCsForBlit(pdc, &DestRect, NULL, NULL);
904 
905  psurf = pdc->dclevel.pSurface;
906 
907  ret = IntEngBitBlt(&psurf->SurfObj,
908  NULL,
909  NULL,
910  (CLIPOBJ *)&pdc->co,
911  NULL,
912  &DestRect,
913  NULL,
914  NULL,
915  &pebo->BrushObject,
916  &BrushOrigin,
917  WIN32_ROP3_TO_ENG_ROP4(dwRop3));
918 
919  DC_vFinishBlit(pdc, NULL);
920 
921  return ret;
922 }
#define TRUE
Definition: types.h:120
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:124
long bottom
Definition: polytest.cpp:53
_In_ HFONT _Out_ PUINT Height
Definition: font.h:124
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
long left
Definition: polytest.cpp:53
Definition: types.h:100
#define ASSERT(a)
Definition: mode.c:44
#define BR_IS_NULL
Definition: brush.h:101
LONG x
Definition: windef.h:329
int ret
#define NULL
Definition: types.h:112
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:656
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182

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:1146
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:217
static HDC
Definition: imagelist.c:92
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
if(dx==0 &&dy==0)
Definition: linetemp.h:174
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
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define PCHAR
Definition: match.c:90
Definition: polytest.cpp:40
GDI_TEB_BATCH GdiTebBatch
Definition: compat.h:716
ULONG GdiBatchCount
Definition: compat.h:746
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:235
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
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
VOID FASTCALL DoDeviceSync(SURFOBJ *Surface, PRECTL Rect, FLONG fl)
Definition: gdibatch.c:22
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define GCAPS2_SYNCFLUSH
Definition: winddi.h:372
ENGAPI VOID APIENTRY EngUnlockSurface(_In_ _Post_ptr_invalid_ SURFOBJ *pso)
Definition: surface.c:628
#define NULL
Definition: types.h:112

Referenced by NtGdiFlush().