ReactOS  0.4.14-dev-49-gfb4591c
dclife.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS kernel
4  * PURPOSE: Functions for creation and destruction of DCs
5  * FILE: win32ss/gdi/ntgdi/dclife.c
6  * PROGRAMER: Timo Kreuzer (timo.kreuzer@rectos.org)
7  */
8 
9 #include <win32k.h>
10 
11 #define NDEBUG
12 #include <debug.h>
13 
14 // FIXME: Windows uses 0x0012009f
15 #define DIRTY_DEFAULT DIRTY_CHARSET|DIRTY_BACKGROUND|DIRTY_TEXT|DIRTY_LINE|DIRTY_FILL
16 
19 
21 {
25  0, 0, 0x4b
26 };
27 
29 {
33  0, 0, 0x53
34 };
35 
37 {
41  0, 0, 0x63
42 };
43 
44 // HACK!! Fix XFORMOBJ then use 1:16 / 16:1
45 #define gmxWorldToDeviceDefault gmxWorldToPageDefault
46 #define gmxDeviceToWorldDefault gmxWorldToPageDefault
47 
50 INIT_FUNCTION
52 NTAPI
54 {
56  if (!psurfDefaultBitmap)
57  return STATUS_UNSUCCESSFUL;
58 
60  if (!pbrDefaultBrush)
61  return STATUS_UNSUCCESSFUL;
62 
63  return STATUS_SUCCESS;
64 }
65 
66 
67 PDC
68 NTAPI
70 {
71  PDC pdc;
72 
73  NT_ASSERT((eDcObjType == GDILoObjType_LO_DC_TYPE) ||
74  (eDcObjType == GDILoObjType_LO_ALTDC_TYPE));
75 
76  /* Allocate the object */
78  sizeof(DC),
80  if (!pdc)
81  {
82  DPRINT1("Could not allocate a DC.\n");
83  return NULL;
84  }
85 
86  /* Set the actual DC type */
87  pdc->BaseObject.hHmgr = UlongToHandle(eDcObjType);
88 
89  pdc->pdcattr = &pdc->dcattr;
90 
91  /* Insert the object */
92  if (!GDIOBJ_hInsertObject(&pdc->BaseObject, GDI_OBJ_HMGR_POWNED))
93  {
94  DPRINT1("Could not insert DC into handle table.\n");
95  GDIOBJ_vFreeObject(&pdc->BaseObject);
96  return NULL;
97  }
98 
99  return pdc;
100 }
101 
102 
103 void
105 {
106  if (defaultDCstate == NULL)
107  {
110  RtlZeroMemory(defaultDCstate, sizeof(DC));
111  defaultDCstate->pdcattr = &defaultDCstate->dcattr;
113  }
114 
115  if (prgnDefault == NULL)
116  {
117  prgnDefault = IntSysCreateRectpRgn(0, 0, 0, 0);
118  }
119 
120  TextIntRealizeFont(pdc->pdcattr->hlfntNew,NULL);
121  pdc->pdcattr->iCS_CP = ftGdiGetTextCharsetInfo(pdc,NULL,0);
122 
123  /* This should never fail */
124  ASSERT(pdc->dclevel.ppal);
125 }
126 
127 VOID
128 NTAPI
130  PDC pdc,
131  DCTYPE dctype,
132  PPDEVOBJ ppdev)
133 {
134  /* Setup some basic fields */
135  pdc->dctype = dctype;
136  pdc->ppdev = ppdev;
137  pdc->dhpdev = ppdev->dhpdev;
138  pdc->hsem = ppdev->hsemDevLock;
139  pdc->flGraphicsCaps = ppdev->devinfo.flGraphicsCaps;
140  pdc->flGraphicsCaps2 = ppdev->devinfo.flGraphicsCaps2;
141  pdc->fs = DC_DIRTY_RAO;
142 
143  /* Setup dc attribute */
144  pdc->pdcattr = &pdc->dcattr;
145  pdc->dcattr.pvLDC = NULL;
146  pdc->dcattr.ulDirty_ = DIRTY_DEFAULT;
147  if (ppdev == gppdevPrimary)
148  pdc->dcattr.ulDirty_ |= DC_PRIMARY_DISPLAY;
149 
150  /* Setup the DC size */
151  if (dctype == DCTYPE_MEMORY)
152  {
153  /* Memory DCs have a 1 x 1 bitmap by default */
154  pdc->dclevel.sizl.cx = 1;
155  pdc->dclevel.sizl.cy = 1;
156  }
157  else
158  {
159  /* Other DC's are as big as the related PDEV */
160  pdc->dclevel.sizl.cx = ppdev->gdiinfo.ulHorzRes;
161  pdc->dclevel.sizl.cy = ppdev->gdiinfo.ulVertRes;
162  }
163 
164  /* Setup Window rect based on DC size */
165  pdc->erclWindow.left = 0;
166  pdc->erclWindow.top = 0;
167  pdc->erclWindow.right = pdc->dclevel.sizl.cx;
168  pdc->erclWindow.bottom = pdc->dclevel.sizl.cy;
169 
170  if (dctype == DCTYPE_DIRECT)
171  {
172  /* Direct DCs get the surface from the PDEV */
173  pdc->dclevel.pSurface = PDEVOBJ_pSurface(ppdev);
174 
175  pdc->erclBounds.left = 0x7fffffff;
176  pdc->erclBounds.top = 0x7fffffff;
177  pdc->erclBounds.right = 0x80000000;
178  pdc->erclBounds.bottom = 0x80000000;
179  pdc->erclBoundsApp.left = 0xffffffff;
180  pdc->erclBoundsApp.top = 0xfffffffc;
181  pdc->erclBoundsApp.right = 0x00007ffc; // FIXME
182  pdc->erclBoundsApp.bottom = 0x00000333; // FIXME
183  pdc->erclClip = pdc->erclBounds;
184  pdc->co = gxcoTrivial;
185  }
186  else
187  {
188  /* Non-direct DCs don't have a surface by default */
189  pdc->dclevel.pSurface = NULL;
190 
191  pdc->erclBounds.left = 0;
192  pdc->erclBounds.top = 0;
193  pdc->erclBounds.right = 0;
194  pdc->erclBounds.bottom = 0;
195  pdc->erclBoundsApp = pdc->erclBounds;
196  pdc->erclClip = pdc->erclWindow;
197  pdc->co = gxcoTrivial;
198  }
199 
200  //pdc->dcattr.VisRectRegion:
201 
202  /* Setup coordinate transformation data */
203  pdc->dclevel.mxWorldToDevice = gmxWorldToDeviceDefault;
204  pdc->dclevel.mxDeviceToWorld = gmxDeviceToWorldDefault;
205  pdc->dclevel.mxWorldToPage = gmxWorldToPageDefault;
206  pdc->dclevel.efM11PtoD = gef16;
207  pdc->dclevel.efM22PtoD = gef16;
208  pdc->dclevel.efDxPtoD = gef0;
209  pdc->dclevel.efDyPtoD = gef0;
210  pdc->dclevel.efM11_TWIPS = gef0;
211  pdc->dclevel.efM22_TWIPS = gef0;
212  pdc->dclevel.efPr11 = gef0;
213  pdc->dclevel.efPr22 = gef0;
214  pdc->dcattr.mxWorldToDevice = pdc->dclevel.mxWorldToDevice;
215  pdc->dcattr.mxDeviceToWorld = pdc->dclevel.mxDeviceToWorld;
216  pdc->dcattr.mxWorldToPage = pdc->dclevel.mxWorldToPage;
217  pdc->dcattr.efM11PtoD = pdc->dclevel.efM11PtoD;
218  pdc->dcattr.efM22PtoD = pdc->dclevel.efM22PtoD;
219  pdc->dcattr.efDxPtoD = pdc->dclevel.efDxPtoD;
220  pdc->dcattr.efDyPtoD = pdc->dclevel.efDyPtoD;
221  pdc->dcattr.iMapMode = MM_TEXT;
222  pdc->dcattr.dwLayout = 0;
223  pdc->dcattr.flXform = PAGE_TO_DEVICE_SCALE_IDENTITY |
226 
227  /* Setup more coordinates */
228  pdc->ptlDCOrig.x = 0;
229  pdc->ptlDCOrig.y = 0;
230  pdc->dcattr.lWindowOrgx = 0;
231  pdc->dcattr.ptlWindowOrg.x = 0;
232  pdc->dcattr.ptlWindowOrg.y = 0;
233  pdc->dcattr.szlWindowExt.cx = 1;
234  pdc->dcattr.szlWindowExt.cy = 1;
235  pdc->dcattr.ptlViewportOrg.x = 0;
236  pdc->dcattr.ptlViewportOrg.y = 0;
237  pdc->dcattr.szlViewportExt.cx = 1;
238  pdc->dcattr.szlViewportExt.cy = 1;
239  pdc->dcattr.szlVirtualDevicePixel.cx = ppdev->gdiinfo.ulHorzRes;
240  pdc->dcattr.szlVirtualDevicePixel.cy = ppdev->gdiinfo.ulVertRes;
241  pdc->dcattr.szlVirtualDeviceMm.cx = ppdev->gdiinfo.ulHorzSize;
242  pdc->dcattr.szlVirtualDeviceMm.cy = ppdev->gdiinfo.ulVertSize;
243  pdc->dcattr.szlVirtualDeviceSize.cx = 0;
244  pdc->dcattr.szlVirtualDeviceSize.cy = 0;
245 
246  /* Setup regions */
247  pdc->prgnAPI = NULL;
248  pdc->prgnRao = NULL;
249  pdc->dclevel.prgnClip = NULL;
250  pdc->dclevel.prgnMeta = NULL;
251  /* Allocate a Vis region */
252  pdc->prgnVis = IntSysCreateRectpRgn(0, 0, pdc->dclevel.sizl.cx, pdc->dclevel.sizl.cy);
253  ASSERT(pdc->prgnVis);
254 
255  /* Setup Vis Region Attribute information */
256  UpdateVisRgn(pdc);
257 
258  /* Initialize Clip object */
259  IntEngInitClipObj(&pdc->co);
260 
261  /* Setup palette */
262  pdc->dclevel.hpal = StockObjects[DEFAULT_PALETTE];
263  pdc->dclevel.ppal = PALETTE_ShareLockPalette(pdc->dclevel.hpal);
264 
265  /* Setup path */
266  pdc->dclevel.hPath = NULL;
267  pdc->dclevel.flPath = 0;
268 // pdc->dclevel.lapath:
269 
270  /* Setup colors */
271  pdc->dcattr.crBackgroundClr = RGB(0xff, 0xff, 0xff);
272  pdc->dcattr.ulBackgroundClr = RGB(0xff, 0xff, 0xff);
273  pdc->dcattr.crForegroundClr = RGB(0, 0, 0);
274  pdc->dcattr.ulForegroundClr = RGB(0, 0, 0);
275  pdc->dcattr.crBrushClr = RGB(0xff, 0xff, 0xff);
276  pdc->dcattr.ulBrushClr = RGB(0xff, 0xff, 0xff);
277  pdc->dcattr.crPenClr = RGB(0, 0, 0);
278  pdc->dcattr.ulPenClr = RGB(0, 0, 0);
279 
280  /* Select the default fill and line brush */
281  pdc->dcattr.hbrush = StockObjects[WHITE_BRUSH];
282  pdc->dcattr.hpen = StockObjects[BLACK_PEN];
283  pdc->dclevel.pbrFill = BRUSH_ShareLockBrush(pdc->pdcattr->hbrush);
284  pdc->dclevel.pbrLine = PEN_ShareLockPen(pdc->pdcattr->hpen);
285  pdc->dclevel.ptlBrushOrigin.x = 0;
286  pdc->dclevel.ptlBrushOrigin.y = 0;
287  pdc->dcattr.ptlBrushOrigin = pdc->dclevel.ptlBrushOrigin;
288 
289  /* Initialize EBRUSHOBJs */
290  EBRUSHOBJ_vInitFromDC(&pdc->eboFill, pdc->dclevel.pbrFill, pdc);
291  EBRUSHOBJ_vInitFromDC(&pdc->eboLine, pdc->dclevel.pbrLine, pdc);
292  EBRUSHOBJ_vInitFromDC(&pdc->eboText, pbrDefaultBrush, pdc);
293  EBRUSHOBJ_vInitFromDC(&pdc->eboBackground, pbrDefaultBrush, pdc);
294 
295  /* Setup fill data */
296  pdc->dcattr.jROP2 = R2_COPYPEN;
297  pdc->dcattr.jBkMode = 2;
298  pdc->dcattr.lBkMode = 2;
299  pdc->dcattr.jFillMode = ALTERNATE;
300  pdc->dcattr.lFillMode = 1;
301  pdc->dcattr.jStretchBltMode = 1;
302  pdc->dcattr.lStretchBltMode = 1;
303  pdc->ptlFillOrigin.x = 0;
304  pdc->ptlFillOrigin.y = 0;
305 
306  /* Setup drawing position */
307  pdc->dcattr.ptlCurrent.x = 0;
308  pdc->dcattr.ptlCurrent.y = 0;
309  pdc->dcattr.ptfxCurrent.x = 0;
310  pdc->dcattr.ptfxCurrent.y = 0;
311 
312  /* Setup ICM data */
313  pdc->dclevel.lIcmMode = 0;
314  pdc->dcattr.lIcmMode = 0;
315  pdc->dcattr.hcmXform = NULL;
316  pdc->dcattr.flIcmFlags = 0;
317  pdc->dcattr.IcmBrushColor = CLR_INVALID;
318  pdc->dcattr.IcmPenColor = CLR_INVALID;
319  pdc->dcattr.pvLIcm = NULL;
320  pdc->dcattr.hColorSpace = NULL; // FIXME: 0189001f
321  pdc->dclevel.pColorSpace = NULL; // FIXME
322  pdc->pClrxFormLnk = NULL;
323 // pdc->dclevel.ca =
324 
325  /* Setup font data */
326  pdc->hlfntCur = NULL; // FIXME: 2f0a0cf8
327  pdc->pPFFList = NULL;
328  pdc->flSimulationFlags = 0;
329  pdc->lEscapement = 0;
330  pdc->prfnt = NULL;
331  pdc->dcattr.flFontMapper = 0;
332  pdc->dcattr.flTextAlign = 0;
333  pdc->dcattr.lTextAlign = 0;
334  pdc->dcattr.lTextExtra = 0;
335  pdc->dcattr.lRelAbs = 1;
336  pdc->dcattr.lBreakExtra = 0;
337  pdc->dcattr.cBreak = 0;
338  pdc->dcattr.hlfntNew = StockObjects[SYSTEM_FONT];
339  pdc->dclevel.plfnt = LFONT_ShareLockFont(pdc->dcattr.hlfntNew);
340 
341  /* Other stuff */
342  pdc->hdcNext = NULL;
343  pdc->hdcPrev = NULL;
344  pdc->ipfdDevMax = 0;
345  pdc->ulCopyCount = -1;
346  pdc->ptlDoBanding.x = 0;
347  pdc->ptlDoBanding.y = 0;
348  pdc->dclevel.lSaveDepth = 1;
349  pdc->dclevel.hdcSave = NULL;
350  pdc->dcattr.iGraphicsMode = GM_COMPATIBLE;
351  pdc->dcattr.iCS_CP = 0;
352  pdc->pSurfInfo = NULL;
353 }
354 
355 VOID
356 NTAPI
357 DC_vCleanup(PVOID ObjectBody)
358 {
359  PDC pdc = (PDC)ObjectBody;
360 
361  /* Free DC_ATTR */
362  DC_vFreeDcAttr(pdc);
363 
364  /* Delete saved DCs */
365  DC_vRestoreDC(pdc, 1);
366 
367  /* Deselect dc objects */
368  DC_vSelectSurface(pdc, NULL);
371  DC_vSelectPalette(pdc, NULL);
372 
373  /* Cleanup the dc brushes */
374  EBRUSHOBJ_vCleanup(&pdc->eboFill);
375  EBRUSHOBJ_vCleanup(&pdc->eboLine);
376  EBRUSHOBJ_vCleanup(&pdc->eboText);
377  EBRUSHOBJ_vCleanup(&pdc->eboBackground);
378 
379  /* Release font */
380  if (pdc->dclevel.plfnt)
381  LFONT_ShareUnlockFont(pdc->dclevel.plfnt);
382 
383  /* Free regions */
384  if (pdc->dclevel.prgnClip)
385  REGION_Delete(pdc->dclevel.prgnClip);
386  if (pdc->dclevel.prgnMeta)
387  REGION_Delete(pdc->dclevel.prgnMeta);
388  if (pdc->prgnVis)
389  REGION_Delete(pdc->prgnVis);
390  if (pdc->prgnRao)
391  REGION_Delete(pdc->prgnRao);
392  if (pdc->prgnAPI)
393  REGION_Delete(pdc->prgnAPI);
394 
395  /* Free CLIPOBJ resources */
396  IntEngFreeClipResources(&pdc->co);
397 
398  if (pdc->dclevel.hPath)
399  {
400  DPRINT("DC_vCleanup Path\n");
401  PATH_Delete(pdc->dclevel.hPath);
402  pdc->dclevel.hPath = 0;
403  pdc->dclevel.flPath = 0;
404  }
405  if (pdc->dclevel.pSurface)
406  SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
407 
408  if (pdc->ppdev)
409  PDEVOBJ_vRelease(pdc->ppdev);
410 }
411 
412 VOID
413 NTAPI
414 DC_vSetOwner(PDC pdc, ULONG ulOwner)
415 {
416  /* Delete saved DCs */
417  DC_vRestoreDC(pdc, 1);
418 
419  if (pdc->dclevel.hPath)
420  {
421  GreSetObjectOwner(pdc->dclevel.hPath, ulOwner);
422  }
423 
424  /* Dereference current brush and pen */
425  BRUSH_ShareUnlockBrush(pdc->dclevel.pbrFill);
426  BRUSH_ShareUnlockBrush(pdc->dclevel.pbrLine);
427 
428  /* Select the default fill and line brush */
429  pdc->dcattr.hbrush = StockObjects[WHITE_BRUSH];
430  pdc->dcattr.hpen = StockObjects[BLACK_PEN];
431  pdc->dclevel.pbrFill = BRUSH_ShareLockBrush(pdc->pdcattr->hbrush);
432  pdc->dclevel.pbrLine = PEN_ShareLockPen(pdc->pdcattr->hpen);
433 
434  /* Mark them as dirty */
435  pdc->pdcattr->ulDirty_ |= DIRTY_FILL|DIRTY_LINE;
436 
437  /* Allocate or free DC attribute */
438  if (ulOwner == GDI_OBJ_HMGR_PUBLIC || ulOwner == GDI_OBJ_HMGR_NONE)
439  {
440  if (pdc->pdcattr != &pdc->dcattr)
441  DC_vFreeDcAttr(pdc);
442  }
443  else if (ulOwner == GDI_OBJ_HMGR_POWNED)
444  {
445  if (pdc->pdcattr == &pdc->dcattr)
446  DC_bAllocDcAttr(pdc);
447  }
448 
449  /* Set the DC's ownership */
450  GDIOBJ_vSetObjectOwner(&pdc->BaseObject, ulOwner);
451 }
452 
453 BOOL
454 NTAPI
456 {
457  PDC pdc;
458 
459  pdc = DC_LockDc(hdc);
460  if (!pdc)
461  {
462  DPRINT1("GreSetDCOwner: Could not lock DC\n");
463  return FALSE;
464  }
465 
466  /* Call the internal DC function */
467  DC_vSetOwner(pdc, ulOwner);
468 
469  DC_UnlockDc(pdc);
470  return TRUE;
471 }
472 
473 static
474 void
476 {
477  // PREGION VisRgn ;
478  PPDEVOBJ ppdev = pdc->ppdev;
479 
480  pdc->dhpdev = ppdev->dhpdev;
481 
482  SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
483  pdc->dclevel.pSurface = PDEVOBJ_pSurface(ppdev);
484 
485  PDEVOBJ_sizl(pdc->ppdev, &pdc->dclevel.sizl);
486 #if 0
487  VisRgn = IntSysCreateRectpRgn(0, 0, pdc->dclevel.sizl.cx, pdc->dclevel.sizl.cy);
488  ASSERT(VisRgn);
489  GdiSelectVisRgn(pdc->BaseObject.hHmgr, VisRgn);
490  REGION_Delete(VisRgn);
491 #endif
492 
493  pdc->flGraphicsCaps = ppdev->devinfo.flGraphicsCaps;
494  pdc->flGraphicsCaps2 = ppdev->devinfo.flGraphicsCaps2;
495 
496  /* Mark EBRUSHOBJs as dirty */
497  pdc->pdcattr->ulDirty_ |= DIRTY_DEFAULT ;
498 }
499 
500 /* Prepare a blit for up to 2 DCs */
501 /* rc1 and rc2 are the rectangles where we want to draw or
502  * from where we take pixels. */
503 VOID
504 FASTCALL
506  PDC pdcDest,
507  const RECT* rcDest,
508  PDC pdcSrc,
509  const RECT* rcSrc)
510 {
511  PDC pdcFirst, pdcSecond;
512  const RECT *prcFirst, *prcSecond;
513 
514  /* Update brushes */
515  if (pdcDest->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
516  DC_vUpdateFillBrush(pdcDest);
517  if (pdcDest->pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
518  DC_vUpdateLineBrush(pdcDest);
519  if(pdcDest->pdcattr->ulDirty_ & DIRTY_TEXT)
520  DC_vUpdateTextBrush(pdcDest);
521 
522  /* Lock them in good order */
523  if (pdcSrc)
524  {
525  if((ULONG_PTR)pdcDest->ppdev->hsemDevLock >=
526  (ULONG_PTR)pdcSrc->ppdev->hsemDevLock)
527  {
528  pdcFirst = pdcDest;
529  prcFirst = rcDest;
530  pdcSecond = pdcSrc;
531  prcSecond = rcSrc;
532  }
533  else
534  {
535  pdcFirst = pdcSrc;
536  prcFirst = rcSrc;
537  pdcSecond = pdcDest;
538  prcSecond = rcDest;
539  }
540  }
541  else
542  {
543  pdcFirst = pdcDest;
544  prcFirst = rcDest;
545  pdcSecond = NULL;
546  prcSecond = NULL;
547  }
548 
549  if (pdcDest->fs & DC_FLAG_DIRTY_RAO)
550  CLIPPING_UpdateGCRegion(pdcDest);
551 
552  /* Lock and update first DC */
553  if (pdcFirst->dctype == DCTYPE_DIRECT)
554  {
555  EngAcquireSemaphore(pdcFirst->ppdev->hsemDevLock);
556 
557  /* Update surface if needed */
558  if (pdcFirst->ppdev->pSurface != pdcFirst->dclevel.pSurface)
559  {
560  DC_vUpdateDC(pdcFirst);
561  }
562  }
563 
564  if (pdcFirst->dctype == DCTYPE_DIRECT)
565  {
566  if (!prcFirst)
567  prcFirst = &pdcFirst->erclClip;
568 
569  MouseSafetyOnDrawStart(pdcFirst->ppdev,
570  prcFirst->left,
571  prcFirst->top,
572  prcFirst->right,
573  prcFirst->bottom) ;
574  }
575 
576 #if DBG
577  pdcFirst->fs |= DC_PREPARED;
578 #endif
579 
580  if (!pdcSecond)
581  return;
582 
583  /* Lock and update second DC */
584  if (pdcSecond->dctype == DCTYPE_DIRECT)
585  {
586  EngAcquireSemaphore(pdcSecond->ppdev->hsemDevLock);
587 
588  /* Update surface if needed */
589  if (pdcSecond->ppdev->pSurface != pdcSecond->dclevel.pSurface)
590  {
591  DC_vUpdateDC(pdcSecond);
592  }
593  }
594 
595  if (pdcSecond->dctype == DCTYPE_DIRECT)
596  {
597  if (!prcSecond)
598  prcSecond = &pdcSecond->erclClip;
599  MouseSafetyOnDrawStart(pdcSecond->ppdev,
600  prcSecond->left,
601  prcSecond->top,
602  prcSecond->right,
603  prcSecond->bottom) ;
604  }
605 
606 #if DBG
607  pdcSecond->fs |= DC_PREPARED;
608 #endif
609 }
610 
611 /* Finishes a blit for one or two DCs */
612 VOID
613 FASTCALL
614 DC_vFinishBlit(PDC pdc1, PDC pdc2)
615 {
616  if (pdc1->dctype == DCTYPE_DIRECT)
617  {
618  MouseSafetyOnDrawEnd(pdc1->ppdev);
619  EngReleaseSemaphore(pdc1->ppdev->hsemDevLock);
620  }
621 #if DBG
622  pdc1->fs &= ~DC_PREPARED;
623 #endif
624 
625  if (pdc2)
626  {
627  if (pdc2->dctype == DCTYPE_DIRECT)
628  {
629  MouseSafetyOnDrawEnd(pdc2->ppdev);
630  EngReleaseSemaphore(pdc2->ppdev->hsemDevLock);
631  }
632 #if DBG
633  pdc2->fs &= ~DC_PREPARED;
634 #endif
635  }
636 }
637 
638 HDC
639 NTAPI
641  PUNICODE_STRING pustrDevice,
642  DEVMODEW *pdmInit,
643  PUNICODE_STRING pustrLogAddr,
644  ULONG iType,
645  BOOL bDisplay,
646  HANDLE hspool,
647  VOID *pDriverInfo2,
648  PVOID *pUMdhpdev)
649 {
650  PPDEVOBJ ppdev;
651  PDC pdc;
652  HDC hdc;
653 
654  DPRINT("GreOpenDCW(%S, iType=%lu)\n",
655  pustrDevice ? pustrDevice->Buffer : NULL, iType);
656 
657  /* Get a PDEVOBJ for the device */
658  ppdev = EngpGetPDEV(pustrDevice);
659  if (!ppdev)
660  {
661  DPRINT1("Didn't find a suitable PDEV\n");
662  return NULL;
663  }
664 
665  DPRINT("GreOpenDCW - ppdev = %p\n", ppdev);
666 
668  if (!pdc)
669  {
670  DPRINT1("Could not Allocate a DC\n");
671  PDEVOBJ_vRelease(ppdev);
672  return NULL;
673  }
674  hdc = pdc->BaseObject.hHmgr;
675 
676  /* Lock ppdev and initialize the new DC */
677  DC_vInitDc(pdc, iType, ppdev);
678  if (pUMdhpdev) *pUMdhpdev = ppdev->dhpdev;
679  /* FIXME: HACK! */
680  DC_InitHack(pdc);
681 
682  DC_bAllocDcAttr(pdc);
683 
684  DC_UnlockDc(pdc);
685 
686  DPRINT("Returning hdc = %p\n", hdc);
687 
688  return hdc;
689 }
690 
692 HDC
693 APIENTRY
695  _In_opt_ PUNICODE_STRING pustrDevice,
696  _In_ DEVMODEW *pdmInit,
697  _In_ PUNICODE_STRING pustrLogAddr,
698  _In_ ULONG iType,
699  _In_ BOOL bDisplay,
700  _In_opt_ HANDLE hspool,
701  /*_In_opt_ DRIVER_INFO2W *pdDriverInfo2, Need this soon!!!! */
702  _At_((PUMDHPDEV*)pUMdhpdev, _Out_) PVOID pUMdhpdev)
703 {
704  UNICODE_STRING ustrDevice;
705  WCHAR awcDevice[CCHDEVICENAME];
706  PVOID dhpdev;
707  HDC hdc;
708  WORD dmSize, dmDriverExtra;
709  DWORD Size;
710  DEVMODEW * _SEH2_VOLATILE pdmAllocated = NULL;
711 
712  /* Only if a devicename is given, we need any data */
713  if (pustrDevice)
714  {
715  /* Initialize destination string */
716  RtlInitEmptyUnicodeString(&ustrDevice, awcDevice, sizeof(awcDevice));
717 
718  _SEH2_TRY
719  {
720  /* Probe the UNICODE_STRING and the buffer */
721  ProbeForRead(pustrDevice, sizeof(UNICODE_STRING), 1);
722  ProbeForRead(pustrDevice->Buffer, pustrDevice->Length, 1);
723 
724  /* Copy the string */
725  RtlCopyUnicodeString(&ustrDevice, pustrDevice);
726 
727  /* Allocate and store pdmAllocated if pdmInit is not NULL */
728  if (pdmInit)
729  {
730  ProbeForRead(pdmInit, sizeof(DEVMODEW), 1);
731 
732  dmSize = pdmInit->dmSize;
733  dmDriverExtra = pdmInit->dmDriverExtra;
734  Size = dmSize + dmDriverExtra;
735  ProbeForRead(pdmInit, Size, 1);
736 
738  Size,
739  TAG_DC);
740  RtlCopyMemory(pdmAllocated, pdmInit, Size);
741  pdmAllocated->dmSize = dmSize;
742  pdmAllocated->dmDriverExtra = dmDriverExtra;
743  }
744 
745  if (pUMdhpdev)
746  {
747  ProbeForWrite(pUMdhpdev, sizeof(HANDLE), 1);
748  }
749  }
751  {
752  if (pdmAllocated)
753  {
754  ExFreePoolWithTag(pdmAllocated, TAG_DC);
755  }
757  _SEH2_YIELD(return NULL);
758  }
759  _SEH2_END
760  }
761  else
762  {
763  pdmInit = NULL;
764  pUMdhpdev = NULL;
765  // return UserGetDesktopDC(iType, FALSE, TRUE);
766  }
767 
768  /* FIXME: HACK! */
769  if (pustrDevice)
770  {
771  UNICODE_STRING ustrDISPLAY = RTL_CONSTANT_STRING(L"DISPLAY");
772  if (RtlEqualUnicodeString(&ustrDevice, &ustrDISPLAY, TRUE))
773  {
774  pustrDevice = NULL;
775  }
776  }
777 
778  /* Call the internal function */
779  hdc = GreOpenDCW(pustrDevice ? &ustrDevice : NULL,
780  pdmAllocated,
781  NULL, // FIXME: pwszLogAddress
782  iType,
783  bDisplay,
784  hspool,
785  NULL, // FIXME: pDriverInfo2
786  pUMdhpdev ? &dhpdev : NULL);
787 
788  /* If we got a HDC and a UM dhpdev is requested,... */
789  if (hdc && pUMdhpdev)
790  {
791  /* Copy dhpdev to caller */
792  _SEH2_TRY
793  {
794  /* Pointer was already probed */
795  *(HANDLE*)pUMdhpdev = dhpdev;
796  }
798  {
799  /* Ignore error */
800  (void)0;
801  }
802  _SEH2_END
803  }
804 
805  /* Free the allocated */
806  if (pdmAllocated)
807  {
808  ExFreePoolWithTag(pdmAllocated, TAG_DC);
809  }
810 
811  return hdc;
812 }
813 
814 
815 HDC
816 APIENTRY
818 {
819  GDILOOBJTYPE eDcObjType;
820  HDC hdcNew;
821  PPDEVOBJ ppdev;
822  PDC pdc, pdcNew;
823 
824  DPRINT("NtGdiCreateCompatibleDC(0x%p)\n", hdc);
825 
826  /* Did the caller provide a DC? */
827  if (hdc)
828  {
829  /* Yes, try to lock it */
830  pdc = DC_LockDc(hdc);
831  if (!pdc)
832  {
833  DPRINT1("Could not lock source DC %p\n", hdc);
834  return NULL;
835  }
836 
837  /* Get the pdev from the DC */
838  ppdev = pdc->ppdev;
840 
841  /* Unlock the source DC */
842  DC_UnlockDc(pdc);
843  }
844  else
845  {
846  /* No DC given, get default device */
847  ppdev = EngpGetPDEV(NULL);
848  }
849 
850  if (!ppdev)
851  {
852  DPRINT1("Didn't find a suitable PDEV\n");
853  return NULL;
854  }
855 
856  /* Allocate a new DC */
857  eDcObjType = bAltDc ? GDILoObjType_LO_ALTDC_TYPE : GDILoObjType_LO_DC_TYPE;
858  pdcNew = DC_AllocDcWithHandle(eDcObjType);
859  if (!pdcNew)
860  {
861  DPRINT1("Could not allocate a new DC\n");
862  PDEVOBJ_vRelease(ppdev);
863  return NULL;
864  }
865  hdcNew = pdcNew->BaseObject.hHmgr;
866 
867  /* Lock ppdev and initialize the new DC */
868  DC_vInitDc(pdcNew, bAltDc ? DCTYPE_INFO : DCTYPE_MEMORY, ppdev);
869  /* FIXME: HACK! */
870  DC_InitHack(pdcNew);
871 
872  /* Allocate a dc attribute */
873  DC_bAllocDcAttr(pdcNew);
874 
875  DC_UnlockDc(pdcNew);
876 
877  DPRINT("Leave NtGdiCreateCompatibleDC hdcNew = %p\n", hdcNew);
878 
879  return hdcNew;
880 }
881 
882 HDC
883 APIENTRY
885 {
886  /* Call the internal function to create a normal memory DC */
888 }
889 
890 BOOL
891 FASTCALL
893 {
894  PDC DCToDelete = DC_LockDc(hDC);
895 
896  if (DCToDelete == NULL)
897  {
899  return FALSE;
900  }
901 
902  if (!Force)
903  {
904  /* Windows permits NtGdiDeleteObjectApp to delete a permanent DC
905  * For some reason, it's still a valid handle, pointing to some kernel data.
906  * Not sure if this is a bug, a feature, some cache stuff... Who knows?
907  * See NtGdiDeleteObjectApp test for details */
908  if (DCToDelete->fs & DC_FLAG_PERMANENT)
909  {
910  DC_UnlockDc(DCToDelete);
911  if(UserReleaseDC(NULL, hDC, FALSE))
912  {
913  /* ReactOS feature: Call UserReleaseDC
914  * I don't think Windows does it.
915  * Still, complain, no one should ever call DeleteDC
916  * on a window DC */
917  DPRINT1("No, you naughty application!\n");
918  return TRUE;
919  }
920  else
921  {
922  /* This is not a window owned DC.
923  * Force its deletion */
924  return IntGdiDeleteDC(hDC, TRUE);
925  }
926  }
927  }
928 
929  DC_UnlockDc(DCToDelete);
930 
931  if (GreIsHandleValid(hDC))
932  {
933  if (!GreDeleteObject(hDC))
934  {
935  DPRINT1("DC_FreeDC failed\n");
936  return FALSE;
937  }
938  }
939  else
940  {
941  DPRINT1("Attempted to Delete 0x%p currently being destroyed!!!\n", hDC);
942  return FALSE;
943  }
944 
945  return TRUE;
946 }
947 
948 BOOL
949 APIENTRY
951 {
952  /* Complete all pending operations */
953  //NtGdiFlushUserBatch(); // FIXME: We shouldn't need this
954 
955  if (GDI_HANDLE_IS_STOCKOBJ(hobj)) return TRUE;
956 
958  {
960  return FALSE;
961  }
962 
964  return GreDeleteObject(hobj);
965 
966  // FIXME: Everything should be callback based
967  return IntGdiDeleteDC(hobj, FALSE);
968 }
969 
970 BOOL
971 FASTCALL
972 MakeInfoDC(PDC pdc, BOOL bSet)
973 {
975  SIZEL sizl;
976 
977  /* Can not be a display DC. */
978  if (pdc->fs & DC_FLAG_DISPLAY) return FALSE;
979  if (bSet)
980  {
981  if (pdc->fs & DC_FLAG_TEMPINFODC || pdc->dctype == DC_TYPE_DIRECT)
982  return FALSE;
983 
984  pSurface = pdc->dclevel.pSurface;
985  pdc->fs |= DC_FLAG_TEMPINFODC;
986  pdc->pSurfInfo = pSurface;
987  pdc->dctype = DC_TYPE_INFO;
988  pdc->dclevel.pSurface = NULL;
989 
990  PDEVOBJ_sizl(pdc->ppdev, &sizl);
991 
992  if ( sizl.cx == pdc->dclevel.sizl.cx &&
993  sizl.cy == pdc->dclevel.sizl.cy )
994  return TRUE;
995 
996  pdc->dclevel.sizl.cx = sizl.cx;
997  pdc->dclevel.sizl.cy = sizl.cy;
998  }
999  else
1000  {
1001  if (!(pdc->fs & DC_FLAG_TEMPINFODC) || pdc->dctype != DC_TYPE_INFO)
1002  return FALSE;
1003 
1004  pSurface = pdc->pSurfInfo;
1005  pdc->fs &= ~DC_FLAG_TEMPINFODC;
1006  pdc->dclevel.pSurface = pSurface;
1007  pdc->dctype = DC_TYPE_DIRECT;
1008  pdc->pSurfInfo = NULL;
1009 
1010  if ( !pSurface ||
1011  (pSurface->SurfObj.sizlBitmap.cx == pdc->dclevel.sizl.cx &&
1012  pSurface->SurfObj.sizlBitmap.cy == pdc->dclevel.sizl.cy) )
1013  return TRUE;
1014 
1015  pdc->dclevel.sizl.cx = pSurface->SurfObj.sizlBitmap.cx;
1016  pdc->dclevel.sizl.cy = pSurface->SurfObj.sizlBitmap.cy;
1017  }
1018  return IntSetDefaultRegion(pdc);
1019 }
1020 
1021 /*
1022 * @implemented
1023 */
1024 BOOL
1025 APIENTRY
1027  IN HDC hdc,
1028  IN BOOL bSet)
1029 {
1030  BOOL Ret;
1031  PDC pdc = DC_LockDc(hdc);
1032  if (pdc)
1033  {
1034  Ret = MakeInfoDC(pdc, bSet);
1035  DC_UnlockDc(pdc);
1036  return Ret;
1037  }
1038  return FALSE;
1039 }
1040 
1041 
1042 HDC FASTCALL
1045  PUNICODE_STRING pustrDevice,
1046  PVOID pUMdhpdev,
1047  CONST PDEVMODEW pdmInit,
1048  BOOL CreateAsIC)
1049 {
1050  HDC hdc;
1051 
1052  hdc = GreOpenDCW(pustrDevice,
1053  pdmInit,
1054  NULL,
1055  CreateAsIC ? DCTYPE_INFO :
1057  TRUE,
1058  NULL,
1059  NULL,
1060  pUMdhpdev);
1061 
1062  return hdc;
1063 }
1064 
1065 HDC FASTCALL
1066 IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC)
1067 {
1068  HDC hDC;
1069  UNIMPLEMENTED;
1070  ASSERT(FALSE);
1071 
1072  if (DcType == DC_TYPE_MEMORY)
1073  hDC = NtGdiCreateCompatibleDC(NULL); // OH~ Yuck! I think I taste vomit in my mouth!
1074  else
1075  hDC = IntGdiCreateDC(NULL, NULL, NULL, NULL, (DcType == DC_TYPE_INFO));
1076 
1077  return hDC;
1078 }
1079 
DHPDEV dhpdev
Definition: pdevobj.h:121
PBRUSH pbrDefaultBrush
Definition: dclife.c:18
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:114
struct DC * PDC
HDC APIENTRY NtGdiCreateCompatibleDC(HDC hdc)
Definition: dclife.c:884
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
#define TAG_DC
Definition: tags.h:21
#define IN
Definition: typedefs.h:38
LONG cPdevRefs
Definition: pdevobj.h:86
BOOL NTAPI GreSetObjectOwner(HGDIOBJ hobj, ULONG ulOwner)
Definition: gdiobj.c:1252
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1155
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
VOID FASTCALL IntEngInitClipObj(XCLIPOBJ *Clip)
Definition: clip.c:158
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1143
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
INIT_FUNCTION NTSTATUS NTAPI InitDcImpl(VOID)
Definition: dclife.c:53
VOID NTAPI EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
Definition: engbrush.c:153
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
XCLIPOBJ gxcoTrivial
Definition: bitblt.c:15
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FORCEINLINE VOID DC_vSelectSurface(PDC pdc, PSURFACE psurfNew)
Definition: dc.h:247
VOID FASTCALL GdiSelectVisRgn(HDC hdc, PREGION prgn)
Definition: cliprgn.c:57
BOOL APIENTRY NtGdiDeleteObjectApp(HANDLE hobj)
Definition: dclife.c:950
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
PDC NTAPI DC_AllocDcWithHandle(GDILOOBJTYPE eDcObjType)
Definition: dclife.c:69
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:113
FORCEINLINE VOID DC_vSelectPalette(PDC pdc, PPALETTE ppal)
Definition: dc.h:286
PSURFACE NTAPI PDEVOBJ_pSurface(PPDEVOBJ ppdev)
Definition: pdevobj.c:233
_In_ ULONG iType
Definition: winddi.h:3748
GDIINFO gdiinfo
Definition: pdevobj.h:124
PPDEVOBJ gppdevPrimary
Definition: pdevobj.c:13
static void DC_vUpdateDC(PDC pdc)
Definition: dclife.c:475
#define PAGE_TO_DEVICE_IDENTITY
Definition: ntgdihdl.h:199
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:158
PSURFACE psurfDefaultBitmap
Definition: dclife.c:17
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define LFONT_ShareUnlockFont(plfnt)
Definition: text.h:78
LONG NTSTATUS
Definition: precomp.h:26
static HDC
Definition: imagelist.c:92
#define CLR_INVALID
Definition: wingdi.h:882
VOID FASTCALL UpdateVisRgn(PDC pdc)
Definition: cliprgn.c:39
LONG top
Definition: windef.h:292
#define gmxDeviceToWorldDefault
Definition: dclife.c:46
BOOL FASTCALL MakeInfoDC(PDC pdc, BOOL bSet)
Definition: dclife.c:972
#define WHITE_BRUSH
Definition: wingdi.h:901
HDC APIENTRY GreCreateCompatibleDC(HDC hdc, BOOL bAltDc)
Definition: dclife.c:817
_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawEnd(_Inout_ PPDEVOBJ ppdev)
Definition: mouse.c:99
ULONG NTAPI GreGetObjectOwner(HGDIOBJ hobj)
Definition: gdiobj.c:1189
#define R2_COPYPEN
Definition: wingdi.h:338
LONG left
Definition: windef.h:291
#define SURFACE_ShareLockSurface(hBMObj)
Definition: surface.h:91
_In_ SIZEL sizl
Definition: winddi.h:3467
FORCEINLINE VOID DC_vSelectFillBrush(PDC pdc, PBRUSH pbrFill)
Definition: dc.h:262
LONG right
Definition: windef.h:293
#define FASTCALL
Definition: nt_native.h:50
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _In_opt_
Definition: no_sal2.h:213
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
_SEH2_TRY
Definition: create.c:4250
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define FLOATOBJ_1_16
Definition: floatobj.h:113
#define DC_PRIMARY_DISPLAY
Definition: ntgdihdl.h:161
ULONG ulVertSize
Definition: winddi.h:881
VOID FASTCALL IntEngFreeClipResources(XCLIPOBJ *Clip)
Definition: clip.c:164
#define DC_FLAG_DISPLAY
Definition: ntgdihdl.h:128
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2426
HGDIOBJ StockObjects[]
Definition: stockobj.c:100
#define ALTERNATE
Definition: constants.h:278
VOID NTAPI DC_vCleanup(PVOID ObjectBody)
Definition: dclife.c:357
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:5342
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FLOATOBJ_16
Definition: floatobj.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
ULONG ulHorzRes
Definition: winddi.h:882
_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
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
enum _DCTYPE DCTYPE
smooth NULL
Definition: ftsmooth.c:416
#define GDI_HANDLE_IS_STOCKOBJ(h)
Definition: gdi.h:37
#define _Out_
Definition: no_sal2.h:323
#define SYSTEM_FONT
Definition: wingdi.h:910
#define _At_(target, annos)
Definition: no_sal2.h:11
void DPRINT(...)
Definition: polytest.cpp:61
BOOL NTAPI DC_bAllocDcAttr(PDC pdc)
Definition: dcattr.c:31
#define DEFAULT_BITMAP
Definition: ntgdityp.h:194
HSEMAPHORE hsemDevLock
Definition: pdevobj.h:91
_In_ PCUNICODE_STRING _In_ PVOID Driver
Definition: cmfuncs.h:32
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
Definition: types.h:100
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define BLACK_BRUSH
Definition: wingdi.h:895
HDC NTAPI GreOpenDCW(PUNICODE_STRING pustrDevice, DEVMODEW *pdmInit, PUNICODE_STRING pustrLogAddr, ULONG iType, BOOL bDisplay, HANDLE hspool, VOID *pDriverInfo2, PVOID *pUMdhpdev)
Definition: dclife.c:640
#define FLOATOBJ_1
Definition: floatobj.h:111
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
Definition: polytest.cpp:40
PDC defaultDCstate
Definition: device.c:14
#define DEFAULT_PALETTE
Definition: wingdi.h:912
PREGION prgnDefault
Definition: region.c:130
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define __kernel_entry
Definition: specstrings.h:50
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: matrix.h:43
#define UlongToHandle(ul)
Definition: basetsd.h:97
DEVINFO devinfo
Definition: pdevobj.h:123
#define RGB(r, g, b)
Definition: wingdi.h:2935
#define DC_FLAG_DIRTY_RAO
Definition: ntgdihdl.h:132
unsigned short WORD
Definition: ntddk_ex.h:93
VOID FASTCALL CLIPPING_UpdateGCRegion(PDC pDC)
Definition: cliprgn.c:771
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG ulHorzSize
Definition: winddi.h:880
PSIZEL FASTCALL PDEVOBJ_sizl(PPDEVOBJ ppdev, PSIZEL psizl)
Definition: pdevobj.c:975
static const FLOATOBJ gef0
Definition: floatobj.h:115
#define GM_COMPATIBLE
Definition: wingdi.h:863
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define DIRTY_TEXT
Definition: ntgdihdl.h:147
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define DC_TYPE_MEMORY
Definition: ntgdihdl.h:124
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
Definition: dc.h:43
#define WORLD_TO_PAGE_IDENTITY
Definition: ntgdihdl.h:190
static const FLOATOBJ gef16
Definition: floatobj.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
BOOL FASTCALL IntSetDefaultRegion(PDC)
Definition: dcutil.c:350
#define PAGE_TO_DEVICE_SCALE_IDENTITY
Definition: ntgdihdl.h:200
#define _In_
Definition: no_sal2.h:204
#define DC_FLAG_PERMANENT
Definition: ntgdihdl.h:131
static HDC hDC
Definition: 3dtext.c:33
BOOL APIENTRY NtGdiMakeInfoDC(IN HDC hdc, IN BOOL bSet)
Definition: dclife.c:1026
VOID NTAPI DC_vInitDc(PDC pdc, DCTYPE dctype, PPDEVOBJ ppdev)
Definition: dclife.c:129
_SEH2_END
Definition: create.c:4424
VOID NTAPI EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:112
#define InterlockedIncrement
Definition: armddk.h:53
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DC_TYPE_INFO
Definition: ntgdihdl.h:125
#define CCHDEVICENAME
Definition: ddrawi.h:63
#define BLACK_PEN
Definition: wingdi.h:902
FLONG flGraphicsCaps
Definition: winddi.h:390
HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC)
Definition: dclife.c:1066
#define DIRTY_DEFAULT
Definition: dclife.c:15
HDC FASTCALL IntGdiCreateDC(PUNICODE_STRING Driver, PUNICODE_STRING pustrDevice, PVOID pUMdhpdev, CONST PDEVMODEW pdmInit, BOOL CreateAsIC)
Definition: dclife.c:1043
VOID NTAPI DC_vSetOwner(PDC pdc, ULONG ulOwner)
Definition: dclife.c:414
#define GDI_OBJ_HMGR_PUBLIC
Definition: ntgdihdl.h:116
BOOL NTAPI GreSetDCOwner(HDC hdc, ULONG ulOwner)
Definition: dclife.c:455
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
#define LFONT_ShareLockFont(hfont)
Definition: text.h:77
#define gmxWorldToDeviceDefault
Definition: dclife.c:45
#define DPRINT1
Definition: precomp.h:8
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
#define MM_TEXT
Definition: wingdi.h:872
#define FLOATOBJ_0
Definition: floatobj.h:110
#define GDI_OBJ_HMGR_NONE
Definition: ntgdihdl.h:118
unsigned int ULONG
Definition: retypes.h:1
__kernel_entry HDC APIENTRY NtGdiOpenDCW(_In_opt_ PUNICODE_STRING pustrDevice, _In_ DEVMODEW *pdmInit, _In_ PUNICODE_STRING pustrLogAddr, _In_ ULONG iType, _In_ BOOL bDisplay, _In_opt_ HANDLE hspool, _At_((PUMDHPDEV *) pUMdhpdev, _Out_) PVOID pUMdhpdev)
Definition: dclife.c:694
const MATRIX gmxWorldToPageDefault
Definition: dclife.c:36
#define UNIMPLEMENTED
Definition: debug.h:114
LONG bottom
Definition: windef.h:294
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
BOOL FASTCALL IntGdiDeleteDC(HDC hDC, BOOL Force)
Definition: dclife.c:892
#define DIRTY_LINE
Definition: ntgdihdl.h:146
VOID NTAPI GDIOBJ_vSetObjectOwner(POBJ pobj, ULONG ulNewOwner)
Definition: gdiobj.c:962
VOID FASTCALL DC_vCopyState(PDC pdcSrc, PDC pdcDst, BOOL To)
Definition: dcstate.c:16
void DC_InitHack(PDC pdc)
Definition: dclife.c:104
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define POOL_RAISE_IF_ALLOCATION_FAILURE
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
ULONG ulVertRes
Definition: winddi.h:883
enum GDILoObjType GDILOOBJTYPE
return STATUS_SUCCESS
Definition: btrfs.c:2966
INT FASTCALL ftGdiGetTextCharsetInfo(PDC Dc, LPFONTSIGNATURE lpSig, DWORD dwFlags)
Definition: freetype.c:4523
PBRUSH FASTCALL PEN_ShareLockPen(HPEN hobj)
Definition: pen.c:61
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2468
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
FLONG flGraphicsCaps2
Definition: winddi.h:399
#define CONST
Definition: pedump.c:81
FORCEINLINE VOID DC_vSelectLineBrush(PDC pdc, PBRUSH pbrLine)
Definition: dc.h:274
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:91
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
POBJ NTAPI GDIOBJ_AllocateObject(UCHAR objt, ULONG cjSize, FLONG fl)
Definition: gdiobj.c:559
VOID NTAPI DC_vRestoreDC(IN PDC pdc, INT iSaveLevel)
Definition: dcstate.c:138
#define APIENTRY
Definition: api.h:79
VOID NTAPI GDIOBJ_vFreeObject(POBJ pobj)
Definition: gdiobj.c:593
PPDEVOBJ NTAPI EngpGetPDEV(_In_opt_ PUNICODE_STRING pustrDeviceName)
Definition: pdevobj.c:593
VOID NTAPI PDEVOBJ_vRelease(PPDEVOBJ ppdev)
Definition: pdevobj.c:93
#define DC_FLAG_TEMPINFODC
Definition: ntgdihdl.h:138
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
_Inout_ PVCB _In_ BOOLEAN Force
Definition: cdprocs.h:1425
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define NT_ASSERT
Definition: rtlfuncs.h:3312
#define DC_TYPE_DIRECT
Definition: ntgdihdl.h:123
HGDIOBJ NTAPI GDIOBJ_hInsertObject(POBJ pobj, ULONG ulOwner)
Definition: gdiobj.c:909
VOID NTAPI DC_vFreeDcAttr(PDC pdc)
Definition: dcattr.c:59