ReactOS  r75385
dc.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DCLEVEL
 
struct  _DC
 

Macros

#define DC_FL_PAL_BACK   1
 
#define ASSERT_DC_PREPARED(pdc)   NT_ASSERT((pdc)->fs & DC_PREPARED)
 

Typedefs

typedef enum _DCTYPE DCTYPE
 
typedef struct _DCLEVEL DCLEVEL
 
typedef struct _DCLEVELPDCLEVEL
 
typedef struct _DC DC
 

Enumerations

enum  _FONT_STATE { DC_DIRTYFONT_XFORM = 1, DC_DIRTYFONT_LFONT = 2, DC_UFI_MAPPING = 4 }
 
enum  _DCFLAGS {
  DC_DISPLAY = 0x0001, DC_DIRECT = 0x0002, DC_CANCELED = 0x0004, DC_PERMANANT = 0x0008,
  DC_DIRTY_RAO = 0x0010, DC_ACCUM_WMGR = 0x0020, DC_ACCUM_APP = 0x0040, DC_RESET = 0x0080,
  DC_SYNCHRONIZEACCESS = 0x0100, DC_EPSPRINTINGESCAPE = 0x0200, DC_TEMPINFODC = 0x0400, DC_FULLSCREEN = 0x0800,
  DC_IN_CLONEPDEV = 0x1000, DC_REDIRECTION = 0x2000, DC_SHAREACCESS = 0x4000
}
 
enum  _DCTYPE { DCTYPE_DIRECT = 0, DCTYPE_MEMORY = 1, DCTYPE_INFO = 2 }
 

Functions

VOID FASTCALL DC_vUpdateFillBrush (PDC pdc)
 
VOID FASTCALL DC_vUpdateLineBrush (PDC pdc)
 
VOID FASTCALL DC_vUpdateTextBrush (PDC pdc)
 
VOID FASTCALL DC_vUpdateBackgroundBrush (PDC pdc)
 
HFONT NTAPI DC_hSelectFont (_In_ PDC pdc, _In_ HFONT hlfntNew)
 
HPALETTE NTAPI GdiSelectPalette (_In_ HDC hDC, _In_ HPALETTE hpal, _In_ BOOL ForceBackground)
 
COLORREF FASTCALL IntGdiSetBkColor (_In_ HDC hDC, _In_ COLORREF Color)
 
INT FASTCALL IntGdiSetBkMode (HDC hDC, INT backgroundMode)
 
COLORREF FASTCALL IntGdiSetTextColor (HDC hDC, COLORREF color)
 
UINT FASTCALL IntGdiSetTextAlign (HDC hDC, UINT Mode)
 
VOID FASTCALL DCU_SetDcUndeletable (HDC)
 
BOOL FASTCALL IntSetDefaultRegion (PDC)
 
ULONG TranslateCOLORREF (PDC pdc, COLORREF crColor)
 
int FASTCALL GreSetStretchBltMode (HDC hdc, int iStretchMode)
 
int FASTCALL GreGetBkMode (HDC)
 
int FASTCALL GreGetMapMode (HDC)
 
COLORREF FASTCALL GreGetTextColor (HDC)
 
COLORREF FASTCALL GreGetBkColor (HDC)
 
COLORREF FASTCALL IntSetDCBrushColor (HDC, COLORREF)
 
COLORREF FASTCALL IntSetDCPenColor (HDC, COLORREF)
 
int FASTCALL GreGetGraphicsMode (HDC)
 
BOOL FASTCALL GreSetBrushOrg (HDC, INT, INT, LPPOINT)
 
INIT_FUNCTION NTSTATUS NTAPI InitDcImpl (VOID)
 
PPDEVOBJ FASTCALL IntEnumHDev (VOID)
 
PDC NTAPI DC_AllocDcWithHandle (GDILOOBJTYPE eDcObjType)
 
BOOL NTAPI DC_bAllocDcAttr (PDC pdc)
 
VOID NTAPI DC_vCleanup (PVOID ObjectBody)
 
BOOL FASTCALL IntGdiDeleteDC (HDC, BOOL)
 
BOOL FASTCALL DC_InvertXform (const XFORM *xformSrc, XFORM *xformDest)
 
VOID FASTCALL DC_vUpdateViewportExt (PDC pdc)
 
VOID FASTCALL DC_vCopyState (PDC pdcSrc, PDC pdcDst, BOOL To)
 
VOID FASTCALL DC_vFinishBlit (PDC pdc1, PDC pdc2)
 
VOID FASTCALL DC_vPrepareDCsForBlit (PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
 
VOID NTAPI DC_vRestoreDC (IN PDC pdc, INT iSaveLevel)
 
VOID NTAPI DC_vFreeDcAttr (PDC pdc)
 
VOID NTAPI DC_vInitDc (PDC pdc, DCTYPE dctype, PPDEVOBJ ppdev)
 
VOID FASTCALL IntGdiReferencePdev (PPDEVOBJ pPDev)
 
VOID FASTCALL IntGdiUnreferencePdev (PPDEVOBJ pPDev, DWORD CleanUpType)
 
HDC FASTCALL IntGdiCreateDisplayDC (HDEV hDev, ULONG DcType, BOOL EmptyDC)
 
BOOL FASTCALL IntGdiCleanDC (HDC hDC)
 
VOID FASTCALL IntvGetDeviceCaps (PPDEVOBJ, PDEVCAPS)
 
VOID FASTCALL IntUpdateBoundsRect (PDC, PRECTL)
 
BOOL NTAPI GreSetDCOwner (HDC hdc, ULONG ulOwner)
 
HDC APIENTRY GreCreateCompatibleDC (HDC hdc, BOOL bAltDc)
 
VOID NTAPI DC_vSetBrushOrigin (PDC pdc, LONG x, LONG y)
 
FORCEINLINE PDC DC_LockDc (HDC hdc)
 
FORCEINLINE VOID DC_UnlockDc (PDC pdc)
 
FORCEINLINE VOID DC_vSelectSurface (PDC pdc, PSURFACE psurfNew)
 
FORCEINLINE VOID DC_vSelectFillBrush (PDC pdc, PBRUSH pbrFill)
 
FORCEINLINE VOID DC_vSelectLineBrush (PDC pdc, PBRUSH pbrLine)
 
FORCEINLINE VOID DC_vSelectPalette (PDC pdc, PPALETTE ppal)
 

Variables

PDC defaultDCstate
 
_Notnull_ PBRUSH pbrDefaultBrush
 
_Notnull_ PSURFACE psurfDefaultBitmap
 

Macro Definition Documentation

#define ASSERT_DC_PREPARED (   pdc)    NT_ASSERT((pdc)->fs & DC_PREPARED)

Definition at line 299 of file dc.h.

Referenced by IntFillRect(), and IntGdiLineTo().

#define DC_FL_PAL_BACK   1

Definition at line 15 of file dc.h.

Typedef Documentation

typedef struct _DC DC
typedef enum _DCTYPE DCTYPE

Enumeration Type Documentation

Enumerator
DC_DISPLAY 
DC_DIRECT 
DC_CANCELED 
DC_PERMANANT 
DC_DIRTY_RAO 
DC_ACCUM_WMGR 
DC_ACCUM_APP 
DC_RESET 
DC_SYNCHRONIZEACCESS 
DC_EPSPRINTINGESCAPE 
DC_TEMPINFODC 
DC_FULLSCREEN 
DC_IN_CLONEPDEV 
DC_REDIRECTION 
DC_SHAREACCESS 

Definition at line 17 of file dc.h.

18 {
19  DC_DISPLAY = 0x0001,
20  DC_DIRECT = 0x0002,
21  DC_CANCELED = 0x0004,
22  DC_PERMANANT = 0x0008,
23  DC_DIRTY_RAO = 0x0010,
24  DC_ACCUM_WMGR = 0x0020,
25  DC_ACCUM_APP = 0x0040,
26  DC_RESET = 0x0080,
27  DC_SYNCHRONIZEACCESS = 0x0100,
28  DC_EPSPRINTINGESCAPE = 0x0200,
29  DC_TEMPINFODC = 0x0400,
30  DC_FULLSCREEN = 0x0800,
31  DC_IN_CLONEPDEV = 0x1000,
32  DC_REDIRECTION = 0x2000,
33  DC_SHAREACCESS = 0x4000,
34 #if DBG
35  DC_PREPARED = 0x8000
36 #endif
37 };
Definition: dc.h:26
Definition: dc.h:21
Definition: dc.h:20
Definition: dc.h:19
Enumerator
DCTYPE_DIRECT 
DCTYPE_MEMORY 
DCTYPE_INFO 

Definition at line 39 of file dc.h.

40 {
41  DCTYPE_DIRECT = 0,
42  DCTYPE_MEMORY = 1,
43  DCTYPE_INFO = 2,
44 } DCTYPE;
enum _DCTYPE DCTYPE
Definition: dc.h:43
Enumerator
DC_DIRTYFONT_XFORM 
DC_DIRTYFONT_LFONT 
DC_UFI_MAPPING 

Definition at line 7 of file dc.h.

8 {
11  DC_UFI_MAPPING = 4
12 };

Function Documentation

PDC NTAPI DC_AllocDcWithHandle ( GDILOOBJTYPE  eDcObjType)

Definition at line 69 of file dclife.c.

Referenced by GreCreateCompatibleDC(), GreOpenDCW(), and NtGdiSaveDC().

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 }
struct DC * PDC
smooth NULL
Definition: ftsmooth.c:513
Definition: polytest.cpp:40
#define UlongToHandle(ul)
Definition: basetsd.h:96
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define DPRINT1
Definition: precomp.h:8
POBJ NTAPI GDIOBJ_AllocateObject(UCHAR objt, ULONG cjSize, FLONG fl)
Definition: gdiobj.c:557
VOID NTAPI GDIOBJ_vFreeObject(POBJ pobj)
Definition: gdiobj.c:591
#define NT_ASSERT
Definition: rtlfuncs.h:3312
HGDIOBJ NTAPI GDIOBJ_hInsertObject(POBJ pobj, ULONG ulOwner)
Definition: gdiobj.c:907
BOOL NTAPI DC_bAllocDcAttr ( PDC  pdc)

Definition at line 31 of file dcattr.c.

Referenced by DC_vSetOwner(), GreCreateCompatibleDC(), and GreOpenDCW().

32 {
33  PPROCESSINFO ppi;
34  PDC_ATTR pdcattr;
35 
37  ASSERT(ppi);
38 
39  pdcattr = GdiPoolAllocate(ppi->pPoolDcAttr);
40  if (!pdcattr)
41  {
42  DPRINT1("Could not allocate DC attr\n");
43  return FALSE;
44  }
45 
46  /* Copy the content from the kernel mode dc attr */
47  pdc->pdcattr = pdcattr;
48  *pdc->pdcattr = pdc->dcattr;
49 
50  /* Set the object attribute in the handle table */
51  GDIOBJ_vSetObjectAttr(&pdc->BaseObject, pdcattr);
52 
53  DPRINT("DC_AllocDcAttr: pdc=%p, pdc->pdcattr=%p\n", pdc, pdc->pdcattr);
54  return TRUE;
55 }
#define TRUE
Definition: types.h:120
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
#define FALSE
Definition: types.h:117
struct _GDI_POOL * pPoolDcAttr
Definition: win32.h:282
void DPRINT(...)
Definition: polytest.cpp:61
PVOID NTAPI GdiPoolAllocate(PGDI_POOL pPool)
Definition: gdipool.c:122
VOID NTAPI GDIOBJ_vSetObjectAttr(POBJ pobj, PVOID pvObjAttr)
Definition: gdiobj.c:1091
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
#define DPRINT1
Definition: precomp.h:8
HFONT NTAPI DC_hSelectFont ( _In_ PDC  pdc,
_In_ HFONT  hlfntNew 
)

Definition at line 550 of file dcobjs.c.

Referenced by GdiFlushUserBatch(), and NtGdiSelectFont().

553 {
554  PLFONT plfntNew;
555  HFONT hlfntOld;
556 
557  // Legacy crap that will die with font engine rewrite
558  if (!NT_SUCCESS(TextIntRealizeFont(hlfntNew, NULL)))
559  {
560  return NULL;
561  }
562 
563  /* Get the current selected font */
564  hlfntOld = pdc->dclevel.plfnt->BaseObject.hHmgr;
565 
566  /* Check if a new font should be selected */
567  if (hlfntNew != hlfntOld)
568  {
569  /* Lock the new font */
570  plfntNew = LFONT_ShareLockFont(hlfntNew);
571  if (plfntNew)
572  {
573  /* Success, dereference the old font */
574  LFONT_ShareUnlockFont(pdc->dclevel.plfnt);
575 
576  /* Select the new font */
577  pdc->dclevel.plfnt = plfntNew;
578  pdc->pdcattr->hlfntNew = hlfntNew;
579 
580  /* Update dirty flags */
581  pdc->pdcattr->ulDirty_ |= DIRTY_CHARSET;
582  pdc->pdcattr->ulDirty_ &= ~SLOW_WIDTHS;
583  }
584  else
585  {
586  /* Failed, restore old, return NULL */
587  pdc->pdcattr->hlfntNew = hlfntOld;
588  hlfntOld = NULL;
589  }
590  }
591 
592  return hlfntOld;
593 }
#define DIRTY_CHARSET
Definition: ntgdihdl.h:149
#define LFONT_ShareUnlockFont(plfnt)
Definition: text.h:80
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:4412
Definition: text.h:59
smooth NULL
Definition: ftsmooth.c:513
#define SLOW_WIDTHS
Definition: ntgdihdl.h:150
#define NT_SUCCESS(StatCode)
Definition: cmd.c:149
#define LFONT_ShareLockFont(hfont)
Definition: text.h:79
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL FASTCALL DC_InvertXform ( const XFORM xformSrc,
XFORM xformDest 
)
FORCEINLINE PDC DC_LockDc ( HDC  hdc)

Definition at line 219 of file dc.h.

Referenced by _Success_(), DC_vRestoreDC(), DceResetActiveDCEs(), DCU_SetDcUndeletable(), DxEngGetDCState(), DxEngLockDC(), DxEngSetDCState(), ftGdiGetTextMetricsW(), GdiSelectPalette(), GdiSelectVisRgn(), GreCreateCompatibleDC(), GreCreateDIBitmapInternal(), GreDPtoLP(), GreExtTextOutW(), GreGetBkColor(), GreGetBkMode(), GreGetDCOrgEx(), GreGetDCPoint(), GreGetDIBitsInternal(), GreGetGraphicsMode(), GreGetKerningPairs(), GreGetMapMode(), GreGetSetColorTable(), GreGetTextColor(), GreGetTextExtentExW(), GreGetTextExtentW(), GreGradientFill(), GreLPtoDP(), GreMovePointer(), GreMoveTo(), GreSetBrushOrg(), GreSetDCOrg(), GreSetDCOwner(), GreSetPointerShape(), GreSetStretchBltMode(), GreSetViewportOrgEx(), IntAnimatePalette(), intEnableReactXDriver(), IntGdiCleanDC(), IntGdiDeleteDC(), IntGdiPolyPatBlt(), IntGdiRealizePalette(), IntGdiSetBkColor(), IntGdiSetBkMode(), IntGdiSetHookFlags(), IntGdiSetTextAlign(), IntGdiSetTextColor(), IntGetCharDimensions(), IntGetSystemPaletteEntries(), IntPaintDesktop(), IntPolygon(), IntSetDCBrushColor(), IntSetDCPenColor(), NtGdiAbortPath(), NtGdiAngleArc(), NtGdiArcInternal(), NtGdiBeginPath(), NtGdiCloseFigure(), NtGdiCreateCompatibleBitmap(), NtGdiCreateDIBSection(), NtGdiCreateHalftonePalette(), NtGdiEllipse(), NtGdiEndPath(), NtGdiEscape(), NtGdiExcludeClipRect(), NtGdiExtEscape(), NtGdiExtFloodFill(), NtGdiExtSelectClipRgn(), NtGdiFillPath(), NtGdiFillRgn(), NtGdiFlattenPath(), NtGdiFlushUserBatch(), NtGdiGetBoundsRect(), NtGdiGetCharABCWidthsW(), NtGdiGetCharSet(), NtGdiGetCharWidthW(), NtGdiGetDCDword(), NtGdiGetDCObject(), NtGdiGetDeviceCaps(), NtGdiGetDeviceGammaRamp(), NtGdiGetDeviceWidth(), NtGdiGetFontData(), NtGdiGetFontUnicodeRanges(), NtGdiGetGlyphIndicesW(), NtGdiGetGlyphOutline(), NtGdiGetKerningPairs(), NtGdiGetNearestColor(), NtGdiGetOutlineTextMetricsInternalW(), NtGdiGetPath(), NtGdiGetPixel(), NtGdiGetRandomRgn(), NtGdiGetRealizationInfo(), NtGdiGetTextCharsetInfo(), NtGdiGetTextExtentExW(), NtGdiGetTextFaceW(), NtGdiGetTransform(), NtGdiIntersectClipRect(), NtGdiInvertRgn(), NtGdiLineTo(), NtGdiMakeInfoDC(), NtGdiMirrorWindowOrg(), NtGdiModifyWorldTransform(), NtGdiOffsetClipRgn(), NtGdiOffsetViewportOrgEx(), NtGdiOffsetWindowOrgEx(), NtGdiPatBlt(), NtGdiPathToRegion(), NtGdiPolyDraw(), NtGdiPolyPolyDraw(), NtGdiPtVisible(), NtGdiRectangle(), NtGdiRectVisible(), NtGdiRestoreDC(), NtGdiRoundRect(), NtGdiSaveDC(), NtGdiScaleViewportExtEx(), NtGdiScaleWindowExtEx(), NtGdiSelectBitmap(), NtGdiSelectBrush(), NtGdiSelectClipPath(), NtGdiSelectFont(), NtGdiSelectPen(), NtGdiSetBoundsRect(), NtGdiSetColorSpace(), NtGdiSetDeviceGammaRamp(), NtGdiSetDIBitsToDeviceInternal(), NtGdiSetLayout(), NtGdiSetMetaRgn(), NtGdiSetMiterLimit(), NtGdiSetPixel(), NtGdiSetPixelFormat(), NtGdiSetSizeDevice(), NtGdiSetTextJustification(), NtGdiSetViewportOrgEx(), NtGdiSetVirtualResolution(), NtGdiSetWindowOrgEx(), NtGdiStretchDIBitsInternal(), NtGdiStrokeAndFillPath(), NtGdiStrokePath(), NtGdiSwapBuffers(), NtGdiTransformPoints(), NtGdiWidenPath(), NtUserEnumDisplayMonitors(), UserDrawIconEx(), and UserScrollDC().

220 {
221  PDC pdc;
222 
224  if (pdc)
225  {
226  ASSERT((GDI_HANDLE_GET_TYPE(pdc->BaseObject.hHmgr) == GDILoObjType_LO_DC_TYPE) ||
227  (GDI_HANDLE_GET_TYPE(pdc->BaseObject.hHmgr) == GDILoObjType_LO_ALTDC_TYPE));
228  ASSERT(pdc->dclevel.plfnt != NULL);
229  ASSERT(GDI_HANDLE_GET_TYPE(((POBJ)pdc->dclevel.plfnt)->hHmgr) == GDILoObjType_LO_FONT_TYPE);
230  }
231 
232  return pdc;
233 }
struct DC * PDC
PGDIOBJ NTAPI GDIOBJ_LockObject(HGDIOBJ hobj, UCHAR objt)
Definition: gdiobj.c:821
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:513
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc ( PDC  pdc)

Definition at line 237 of file dc.h.

Referenced by _Success_(), DC_vRestoreDC(), DceResetActiveDCEs(), DCU_SetDcUndeletable(), DxEngGetDCState(), DxEngSetDCState(), DxEngUnlockDC(), ftGdiGetTextMetricsW(), GdiSelectPalette(), GdiSelectVisRgn(), GreCreateCompatibleDC(), GreCreateDIBitmapInternal(), GreDPtoLP(), GreExtTextOutW(), GreGetBkColor(), GreGetBkMode(), GreGetDCOrgEx(), GreGetDCPoint(), GreGetDIBitsInternal(), GreGetGraphicsMode(), GreGetKerningPairs(), GreGetMapMode(), GreGetSetColorTable(), GreGetTextColor(), GreGetTextExtentExW(), GreGetTextExtentW(), GreGradientFill(), GreLPtoDP(), GreMovePointer(), GreMoveTo(), GreOpenDCW(), GreSetBrushOrg(), GreSetDCOrg(), GreSetDCOwner(), GreSetPointerShape(), GreSetStretchBltMode(), GreSetViewportOrgEx(), GreStretchBltMask(), IntAnimatePalette(), intEnableReactXDriver(), IntGdiCleanDC(), IntGdiDeleteDC(), IntGdiPolyPatBlt(), IntGdiRealizePalette(), IntGdiSetBkColor(), IntGdiSetBkMode(), IntGdiSetHookFlags(), IntGdiSetTextAlign(), IntGdiSetTextColor(), IntGetCharDimensions(), IntGetSystemPaletteEntries(), IntPaintDesktop(), IntPolygon(), IntSetDCBrushColor(), IntSetDCPenColor(), NtGdiAbortPath(), NtGdiAngleArc(), NtGdiArcInternal(), NtGdiBeginPath(), NtGdiCloseFigure(), NtGdiCreateCompatibleBitmap(), NtGdiCreateDIBSection(), NtGdiCreateHalftonePalette(), NtGdiEllipse(), NtGdiEndPath(), NtGdiEscape(), NtGdiExcludeClipRect(), NtGdiExtEscape(), NtGdiExtFloodFill(), NtGdiExtSelectClipRgn(), NtGdiFillPath(), NtGdiFillRgn(), NtGdiFlattenPath(), NtGdiFlushUserBatch(), NtGdiGetBoundsRect(), NtGdiGetCharABCWidthsW(), NtGdiGetCharSet(), NtGdiGetCharWidthW(), NtGdiGetDCDword(), NtGdiGetDCObject(), NtGdiGetDeviceCaps(), NtGdiGetDeviceGammaRamp(), NtGdiGetDeviceWidth(), NtGdiGetFontData(), NtGdiGetFontUnicodeRanges(), NtGdiGetGlyphIndicesW(), NtGdiGetGlyphOutline(), NtGdiGetKerningPairs(), NtGdiGetNearestColor(), NtGdiGetOutlineTextMetricsInternalW(), NtGdiGetPath(), NtGdiGetPixel(), NtGdiGetRandomRgn(), NtGdiGetRealizationInfo(), NtGdiGetTextCharsetInfo(), NtGdiGetTextExtentExW(), NtGdiGetTextFaceW(), NtGdiGetTransform(), NtGdiIntersectClipRect(), NtGdiInvertRgn(), NtGdiLineTo(), NtGdiMakeInfoDC(), NtGdiMaskBlt(), NtGdiMirrorWindowOrg(), NtGdiModifyWorldTransform(), NtGdiOffsetClipRgn(), NtGdiOffsetViewportOrgEx(), NtGdiOffsetWindowOrgEx(), NtGdiPatBlt(), NtGdiPathToRegion(), NtGdiPolyDraw(), NtGdiPolyPolyDraw(), NtGdiPtVisible(), NtGdiRectangle(), NtGdiRectVisible(), NtGdiRestoreDC(), NtGdiRoundRect(), NtGdiSaveDC(), NtGdiScaleViewportExtEx(), NtGdiScaleWindowExtEx(), NtGdiSelectBitmap(), NtGdiSelectBrush(), NtGdiSelectClipPath(), NtGdiSelectFont(), NtGdiSelectPen(), NtGdiSetBoundsRect(), NtGdiSetColorSpace(), NtGdiSetDeviceGammaRamp(), NtGdiSetDIBitsToDeviceInternal(), NtGdiSetLayout(), NtGdiSetMetaRgn(), NtGdiSetMiterLimit(), NtGdiSetPixel(), NtGdiSetPixelFormat(), NtGdiSetSizeDevice(), NtGdiSetTextJustification(), NtGdiSetViewportOrgEx(), NtGdiSetVirtualResolution(), NtGdiSetWindowOrgEx(), NtGdiStretchDIBitsInternal(), NtGdiStrokeAndFillPath(), NtGdiStrokePath(), NtGdiSwapBuffers(), NtGdiTransformPoints(), NtGdiWidenPath(), NtUserEnumDisplayMonitors(), UserDrawIconEx(), and UserScrollDC().

238 {
239  ASSERT(pdc->dclevel.plfnt != NULL);
240  ASSERT(GDI_HANDLE_GET_TYPE(((POBJ)pdc->dclevel.plfnt)->hHmgr) == GDILoObjType_LO_FONT_TYPE);
241 
242  GDIOBJ_vUnlockObject(&pdc->BaseObject);
243 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
smooth NULL
Definition: ftsmooth.c:513
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
VOID NTAPI GDIOBJ_vUnlockObject(POBJ pobj)
Definition: gdiobj.c:875
VOID NTAPI DC_vCleanup ( PVOID  ObjectBody)

Definition at line 349 of file dclife.c.

350 {
351  PDC pdc = (PDC)ObjectBody;
352 
353  /* Free DC_ATTR */
354  DC_vFreeDcAttr(pdc);
355 
356  /* Delete saved DCs */
357  DC_vRestoreDC(pdc, 1);
358 
359  /* Deselect dc objects */
360  DC_vSelectSurface(pdc, NULL);
363  DC_vSelectPalette(pdc, NULL);
364 
365  /* Cleanup the dc brushes */
366  EBRUSHOBJ_vCleanup(&pdc->eboFill);
367  EBRUSHOBJ_vCleanup(&pdc->eboLine);
368  EBRUSHOBJ_vCleanup(&pdc->eboText);
369  EBRUSHOBJ_vCleanup(&pdc->eboBackground);
370 
371  /* Release font */
372  if (pdc->dclevel.plfnt)
373  LFONT_ShareUnlockFont(pdc->dclevel.plfnt);
374 
375  /* Free regions */
376  if (pdc->dclevel.prgnClip)
377  REGION_Delete(pdc->dclevel.prgnClip);
378  if (pdc->dclevel.prgnMeta)
379  REGION_Delete(pdc->dclevel.prgnMeta);
380  if (pdc->prgnVis)
381  REGION_Delete(pdc->prgnVis);
382  if (pdc->prgnRao)
383  REGION_Delete(pdc->prgnRao);
384  if (pdc->prgnAPI)
385  REGION_Delete(pdc->prgnAPI);
386 
387  /* Free CLIPOBJ resources */
388  IntEngFreeClipResources(&pdc->co);
389 
390  if (pdc->dclevel.hPath)
391  {
392  DPRINT("DC_vCleanup Path\n");
393  PATH_Delete(pdc->dclevel.hPath);
394  pdc->dclevel.hPath = 0;
395  pdc->dclevel.flPath = 0;
396  }
397  if (pdc->dclevel.pSurface)
398  SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
399 
400  if (pdc->ppdev)
401  PDEVOBJ_vRelease(pdc->ppdev);
402 }
struct DC * PDC
VOID NTAPI EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
Definition: engbrush.c:153
FORCEINLINE VOID DC_vSelectSurface(PDC pdc, PSURFACE psurfNew)
Definition: dc.h:247
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:95
FORCEINLINE VOID DC_vSelectPalette(PDC pdc, PPALETTE ppal)
Definition: dc.h:286
#define LFONT_ShareUnlockFont(plfnt)
Definition: text.h:80
FORCEINLINE VOID DC_vSelectFillBrush(PDC pdc, PBRUSH pbrFill)
Definition: dc.h:262
VOID FASTCALL IntEngFreeClipResources(XCLIPOBJ *Clip)
Definition: clip.c:164
smooth NULL
Definition: ftsmooth.c:513
void DPRINT(...)
Definition: polytest.cpp:61
Definition: polytest.cpp:40
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2428
FORCEINLINE VOID DC_vSelectLineBrush(PDC pdc, PBRUSH pbrLine)
Definition: dc.h:274
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
VOID NTAPI DC_vRestoreDC(IN PDC pdc, INT iSaveLevel)
Definition: dcstate.c:137
VOID NTAPI PDEVOBJ_vRelease(PPDEVOBJ ppdev)
Definition: pdevobj.c:93
VOID NTAPI DC_vFreeDcAttr(PDC pdc)
Definition: dcattr.c:59
VOID FASTCALL DC_vCopyState ( PDC  pdcSrc,
PDC  pdcDst,
BOOL  To 
)
Todo:
should aways be != NULL

Definition at line 16 of file dcstate.c.

Referenced by DC_InitHack(), DC_vRestoreDC(), IntGdiCleanDC(), and NtGdiSaveDC().

17 {
18  DPRINT("DC_vCopyState(%p, %p)\n", pdcSrc->BaseObject.hHmgr, pdcDst->BaseObject.hHmgr);
19 
20  /* Copy full DC attribute */
21  *pdcDst->pdcattr = *pdcSrc->pdcattr;
22 
23  /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
24  /* The VisRectRegion field needs to be set to a valid state */
25 
26  /* Mark some fields as dirty */
27  pdcDst->pdcattr->ulDirty_ |= (DIRTY_FILL|DIRTY_LINE|DIRTY_TEXT|DIRTY_BACKGROUND|DIRTY_CHARSET|DC_ICM_NOT_CALIBRATED|DC_ICM_NOT_SET); // Note: Use if, To is FALSE....
28 
29  /* Copy DC level */
30  pdcDst->dclevel.pColorSpace = pdcSrc->dclevel.pColorSpace;
31  pdcDst->dclevel.laPath = pdcSrc->dclevel.laPath;
32  pdcDst->dclevel.ca = pdcSrc->dclevel.ca;
33  pdcDst->dclevel.mxWorldToDevice = pdcSrc->dclevel.mxWorldToDevice;
34  pdcDst->dclevel.mxDeviceToWorld = pdcSrc->dclevel.mxDeviceToWorld;
35  pdcDst->dclevel.mxWorldToPage = pdcSrc->dclevel.mxWorldToPage;
36  pdcDst->dclevel.efM11PtoD = pdcSrc->dclevel.efM11PtoD;
37  pdcDst->dclevel.efM22PtoD = pdcSrc->dclevel.efM22PtoD;
38  pdcDst->dclevel.sizl = pdcSrc->dclevel.sizl;
39  pdcDst->dclevel.hpal = pdcSrc->dclevel.hpal;
40 
41  /* Handle references here correctly */
42  DC_vSelectFillBrush(pdcDst, pdcSrc->dclevel.pbrFill);
43  DC_vSelectLineBrush(pdcDst, pdcSrc->dclevel.pbrLine);
44  DC_vSelectPalette(pdcDst, pdcSrc->dclevel.ppal);
45 
46  /* Dereference the old font, reference the new one */
47  if (pdcDst->dclevel.plfnt) LFONT_ShareUnlockFont(pdcDst->dclevel.plfnt);
48  GDIOBJ_vReferenceObjectByPointer(&pdcSrc->dclevel.plfnt->BaseObject);
49  pdcDst->dclevel.plfnt = pdcSrc->dclevel.plfnt;
50 
51  /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
52  if (!To)
53  {
54  IntGdiExtSelectClipRgn(pdcDst, pdcSrc->dclevel.prgnClip, RGN_COPY);
55  if (pdcDst->dclevel.prgnMeta)
56  {
57  REGION_Delete(pdcDst->dclevel.prgnMeta);
58  pdcDst->dclevel.prgnMeta = NULL;
59  }
60  if (pdcSrc->dclevel.prgnMeta)
61  {
62  pdcDst->dclevel.prgnMeta = IntSysCreateRectpRgn(0, 0, 0, 0);
63  IntGdiCombineRgn(pdcDst->dclevel.prgnMeta, pdcSrc->dclevel.prgnMeta, NULL, RGN_COPY);
64  }
65  pdcDst->fs |= DC_FLAG_DIRTY_RAO;
66  }
67 }
FORCEINLINE VOID DC_vSelectPalette(PDC pdc, PPALETTE ppal)
Definition: dc.h:286
#define DIRTY_CHARSET
Definition: ntgdihdl.h:149
#define LFONT_ShareUnlockFont(plfnt)
Definition: text.h:80
int FASTCALL IntGdiExtSelectClipRgn(PDC dc, PREGION prgn, int fnMode)
Definition: cliprgn.c:68
FORCEINLINE VOID DC_vSelectFillBrush(PDC pdc, PBRUSH pbrFill)
Definition: dc.h:262
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:148
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2386
smooth NULL
Definition: ftsmooth.c:513
void DPRINT(...)
Definition: polytest.cpp:61
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2466
#define DC_FLAG_DIRTY_RAO
Definition: ntgdihdl.h:132
#define DIRTY_TEXT
Definition: ntgdihdl.h:147
#define DC_ICM_NOT_CALIBRATED
Definition: ntgdihdl.h:162
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define RGN_COPY
Definition: wingdi.h:355
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:729
#define DIRTY_LINE
Definition: ntgdihdl.h:146
#define DC_ICM_NOT_SET
Definition: ntgdihdl.h:165
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2428
FORCEINLINE VOID DC_vSelectLineBrush(PDC pdc, PBRUSH pbrLine)
Definition: dc.h:274
VOID FASTCALL DC_vFinishBlit ( PDC  pdc1,
PDC  pdc2 
)

Definition at line 606 of file dclife.c.

Referenced by GreExtTextOutW(), GreGradientFill(), GreStretchBltMask(), IntGdiBitBltRgn(), IntGdiExtEscape(), IntGdiFillRgn(), IntGdiPolyline(), IntPatBlt(), IntRectangle(), IntRoundRect(), NtGdiAlphaBlend(), NtGdiAngleArc(), NtGdiArcInternal(), NtGdiEllipse(), NtGdiExtFloodFill(), NtGdiFillPath(), NtGdiGetPixel(), NtGdiLineTo(), NtGdiMaskBlt(), NtGdiPolyPolyDraw(), NtGdiSetDIBitsToDeviceInternal(), NtGdiStretchDIBitsInternal(), NtGdiStrokeAndFillPath(), NtGdiStrokePath(), NtGdiTransparentBlt(), and UserDrawIconEx().

607 {
608  if (pdc1->dctype == DCTYPE_DIRECT)
609  {
610  MouseSafetyOnDrawEnd(pdc1->ppdev);
611  EngReleaseSemaphore(pdc1->ppdev->hsemDevLock);
612  }
613 #if DBG
614  pdc1->fs &= ~DC_PREPARED;
615 #endif
616 
617  if (pdc2)
618  {
619  if (pdc2->dctype == DCTYPE_DIRECT)
620  {
621  MouseSafetyOnDrawEnd(pdc2->ppdev);
622  EngReleaseSemaphore(pdc2->ppdev->hsemDevLock);
623  }
624 #if DBG
625  pdc2->fs &= ~DC_PREPARED;
626 #endif
627  }
628 }
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawEnd(_Inout_ PPDEVOBJ ppdev)
Definition: mouse.c:99
VOID NTAPI DC_vFreeDcAttr ( PDC  pdc)

Definition at line 59 of file dcattr.c.

Referenced by DC_vCleanup(), and DC_vSetOwner().

60 {
61  PPROCESSINFO ppi;
62 
63  if (pdc->pdcattr == &pdc->dcattr)
64  {
65  // Internal DC object!
66  return;
67  }
68 
69  /* Reset the object attribute in the handle table */
70  GDIOBJ_vSetObjectAttr(&pdc->BaseObject, NULL);
71 
73  ASSERT(ppi);
74  GdiPoolFree(ppi->pPoolDcAttr, pdc->pdcattr);
75 
76  /* Reset to kmode dcattr */
77  pdc->pdcattr = &pdc->dcattr;
78 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
VOID NTAPI GdiPoolFree(PGDI_POOL pPool, PVOID pvAlloc)
Definition: gdipool.c:233
struct _GDI_POOL * pPoolDcAttr
Definition: win32.h:282
smooth NULL
Definition: ftsmooth.c:513
VOID NTAPI GDIOBJ_vSetObjectAttr(POBJ pobj, PVOID pvObjAttr)
Definition: gdiobj.c:1091
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
VOID NTAPI DC_vInitDc ( PDC  pdc,
DCTYPE  dctype,
PPDEVOBJ  ppdev 
)

Definition at line 124 of file dclife.c.

Referenced by GreCreateCompatibleDC(), GreOpenDCW(), and NtGdiSaveDC().

128 {
129  /* Setup some basic fields */
130  pdc->dctype = dctype;
131  pdc->ppdev = ppdev;
132  pdc->dhpdev = ppdev->dhpdev;
133  pdc->hsem = ppdev->hsemDevLock;
134  pdc->flGraphicsCaps = ppdev->devinfo.flGraphicsCaps;
135  pdc->flGraphicsCaps2 = ppdev->devinfo.flGraphicsCaps2;
136  pdc->fs = DC_DIRTY_RAO;
137 
138  /* Setup dc attribute */
139  pdc->pdcattr = &pdc->dcattr;
140  pdc->dcattr.pvLDC = NULL;
141  pdc->dcattr.ulDirty_ = DIRTY_DEFAULT;
142  if (ppdev == gppdevPrimary)
143  pdc->dcattr.ulDirty_ |= DC_PRIMARY_DISPLAY;
144 
145  /* Setup the DC size */
146  if (dctype == DCTYPE_MEMORY)
147  {
148  /* Memory DCs have a 1 x 1 bitmap by default */
149  pdc->dclevel.sizl.cx = 1;
150  pdc->dclevel.sizl.cy = 1;
151  }
152  else
153  {
154  /* Other DC's are as big as the related PDEV */
155  pdc->dclevel.sizl.cx = ppdev->gdiinfo.ulHorzRes;
156  pdc->dclevel.sizl.cy = ppdev->gdiinfo.ulVertRes;
157  }
158 
159  /* Setup Window rect based on DC size */
160  pdc->erclWindow.left = 0;
161  pdc->erclWindow.top = 0;
162  pdc->erclWindow.right = pdc->dclevel.sizl.cx;
163  pdc->erclWindow.bottom = pdc->dclevel.sizl.cy;
164 
165  if (dctype == DCTYPE_DIRECT)
166  {
167  /* Direct DCs get the surface from the PDEV */
168  pdc->dclevel.pSurface = PDEVOBJ_pSurface(ppdev);
169 
170  pdc->erclBounds.left = 0x7fffffff;
171  pdc->erclBounds.top = 0x7fffffff;
172  pdc->erclBounds.right = 0x80000000;
173  pdc->erclBounds.bottom = 0x80000000;
174  pdc->erclBoundsApp.left = 0xffffffff;
175  pdc->erclBoundsApp.top = 0xfffffffc;
176  pdc->erclBoundsApp.right = 0x00007ffc; // FIXME
177  pdc->erclBoundsApp.bottom = 0x00000333; // FIXME
178  pdc->erclClip = pdc->erclBounds;
179  pdc->co = gxcoTrivial;
180  }
181  else
182  {
183  /* Non-direct DCs don't have a surface by default */
184  pdc->dclevel.pSurface = NULL;
185 
186  pdc->erclBounds.left = 0;
187  pdc->erclBounds.top = 0;
188  pdc->erclBounds.right = 0;
189  pdc->erclBounds.bottom = 0;
190  pdc->erclBoundsApp = pdc->erclBounds;
191  pdc->erclClip = pdc->erclWindow;
192  pdc->co = gxcoTrivial;
193  }
194 
195  //pdc->dcattr.VisRectRegion:
196 
197  /* Setup coordinate transformation data */
198  pdc->dclevel.mxWorldToDevice = gmxWorldToDeviceDefault;
199  pdc->dclevel.mxDeviceToWorld = gmxDeviceToWorldDefault;
200  pdc->dclevel.mxWorldToPage = gmxWorldToPageDefault;
201  pdc->dclevel.efM11PtoD = gef16;
202  pdc->dclevel.efM22PtoD = gef16;
203  pdc->dclevel.efDxPtoD = gef0;
204  pdc->dclevel.efDyPtoD = gef0;
205  pdc->dclevel.efM11_TWIPS = gef0;
206  pdc->dclevel.efM22_TWIPS = gef0;
207  pdc->dclevel.efPr11 = gef0;
208  pdc->dclevel.efPr22 = gef0;
209  pdc->dcattr.mxWorldToDevice = pdc->dclevel.mxWorldToDevice;
210  pdc->dcattr.mxDeviceToWorld = pdc->dclevel.mxDeviceToWorld;
211  pdc->dcattr.mxWorldToPage = pdc->dclevel.mxWorldToPage;
212  pdc->dcattr.efM11PtoD = pdc->dclevel.efM11PtoD;
213  pdc->dcattr.efM22PtoD = pdc->dclevel.efM22PtoD;
214  pdc->dcattr.efDxPtoD = pdc->dclevel.efDxPtoD;
215  pdc->dcattr.efDyPtoD = pdc->dclevel.efDyPtoD;
216  pdc->dcattr.iMapMode = MM_TEXT;
217  pdc->dcattr.dwLayout = 0;
218  pdc->dcattr.flXform = PAGE_TO_DEVICE_SCALE_IDENTITY |
221 
222  /* Setup more coordinates */
223  pdc->ptlDCOrig.x = 0;
224  pdc->ptlDCOrig.y = 0;
225  pdc->dcattr.lWindowOrgx = 0;
226  pdc->dcattr.ptlWindowOrg.x = 0;
227  pdc->dcattr.ptlWindowOrg.y = 0;
228  pdc->dcattr.szlWindowExt.cx = 1;
229  pdc->dcattr.szlWindowExt.cy = 1;
230  pdc->dcattr.ptlViewportOrg.x = 0;
231  pdc->dcattr.ptlViewportOrg.y = 0;
232  pdc->dcattr.szlViewportExt.cx = 1;
233  pdc->dcattr.szlViewportExt.cy = 1;
234  pdc->dcattr.szlVirtualDevicePixel.cx = ppdev->gdiinfo.ulHorzRes;
235  pdc->dcattr.szlVirtualDevicePixel.cy = ppdev->gdiinfo.ulVertRes;
236  pdc->dcattr.szlVirtualDeviceMm.cx = ppdev->gdiinfo.ulHorzSize;
237  pdc->dcattr.szlVirtualDeviceMm.cy = ppdev->gdiinfo.ulVertSize;
238  pdc->dcattr.szlVirtualDeviceSize.cx = 0;
239  pdc->dcattr.szlVirtualDeviceSize.cy = 0;
240 
241  /* Setup regions */
242  pdc->prgnAPI = NULL;
243  pdc->prgnRao = NULL;
244  pdc->dclevel.prgnClip = NULL;
245  pdc->dclevel.prgnMeta = NULL;
246  /* Allocate a Vis region */
247  pdc->prgnVis = IntSysCreateRectpRgn(0, 0, pdc->dclevel.sizl.cx, pdc->dclevel.sizl.cy);
248  ASSERT(pdc->prgnVis);
249 
250  /* Initialize Clip object */
251  IntEngInitClipObj(&pdc->co);
252 
253  /* Setup palette */
254  pdc->dclevel.hpal = StockObjects[DEFAULT_PALETTE];
255  pdc->dclevel.ppal = PALETTE_ShareLockPalette(pdc->dclevel.hpal);
256 
257  /* Setup path */
258  pdc->dclevel.hPath = NULL;
259  pdc->dclevel.flPath = 0;
260 // pdc->dclevel.lapath:
261 
262  /* Setup colors */
263  pdc->dcattr.crBackgroundClr = RGB(0xff, 0xff, 0xff);
264  pdc->dcattr.ulBackgroundClr = RGB(0xff, 0xff, 0xff);
265  pdc->dcattr.crForegroundClr = RGB(0, 0, 0);
266  pdc->dcattr.ulForegroundClr = RGB(0, 0, 0);
267  pdc->dcattr.crBrushClr = RGB(0xff, 0xff, 0xff);
268  pdc->dcattr.ulBrushClr = RGB(0xff, 0xff, 0xff);
269  pdc->dcattr.crPenClr = RGB(0, 0, 0);
270  pdc->dcattr.ulPenClr = RGB(0, 0, 0);
271 
272  /* Select the default fill and line brush */
273  pdc->dcattr.hbrush = StockObjects[WHITE_BRUSH];
274  pdc->dcattr.hpen = StockObjects[BLACK_PEN];
275  pdc->dclevel.pbrFill = BRUSH_ShareLockBrush(pdc->pdcattr->hbrush);
276  pdc->dclevel.pbrLine = PEN_ShareLockPen(pdc->pdcattr->hpen);
277  pdc->dclevel.ptlBrushOrigin.x = 0;
278  pdc->dclevel.ptlBrushOrigin.y = 0;
279  pdc->dcattr.ptlBrushOrigin = pdc->dclevel.ptlBrushOrigin;
280 
281  /* Initialize EBRUSHOBJs */
282  EBRUSHOBJ_vInitFromDC(&pdc->eboFill, pdc->dclevel.pbrFill, pdc);
283  EBRUSHOBJ_vInitFromDC(&pdc->eboLine, pdc->dclevel.pbrLine, pdc);
284  EBRUSHOBJ_vInitFromDC(&pdc->eboText, pbrDefaultBrush, pdc);
285  EBRUSHOBJ_vInitFromDC(&pdc->eboBackground, pbrDefaultBrush, pdc);
286 
287  /* Setup fill data */
288  pdc->dcattr.jROP2 = R2_COPYPEN;
289  pdc->dcattr.jBkMode = 2;
290  pdc->dcattr.lBkMode = 2;
291  pdc->dcattr.jFillMode = ALTERNATE;
292  pdc->dcattr.lFillMode = 1;
293  pdc->dcattr.jStretchBltMode = 1;
294  pdc->dcattr.lStretchBltMode = 1;
295  pdc->ptlFillOrigin.x = 0;
296  pdc->ptlFillOrigin.y = 0;
297 
298  /* Setup drawing position */
299  pdc->dcattr.ptlCurrent.x = 0;
300  pdc->dcattr.ptlCurrent.y = 0;
301  pdc->dcattr.ptfxCurrent.x = 0;
302  pdc->dcattr.ptfxCurrent.y = 0;
303 
304  /* Setup ICM data */
305  pdc->dclevel.lIcmMode = 0;
306  pdc->dcattr.lIcmMode = 0;
307  pdc->dcattr.hcmXform = NULL;
308  pdc->dcattr.flIcmFlags = 0;
309  pdc->dcattr.IcmBrushColor = CLR_INVALID;
310  pdc->dcattr.IcmPenColor = CLR_INVALID;
311  pdc->dcattr.pvLIcm = NULL;
312  pdc->dcattr.hColorSpace = NULL; // FIXME: 0189001f
313  pdc->dclevel.pColorSpace = NULL; // FIXME
314  pdc->pClrxFormLnk = NULL;
315 // pdc->dclevel.ca =
316 
317  /* Setup font data */
318  pdc->hlfntCur = NULL; // FIXME: 2f0a0cf8
319  pdc->pPFFList = NULL;
320  pdc->flSimulationFlags = 0;
321  pdc->lEscapement = 0;
322  pdc->prfnt = NULL;
323  pdc->dcattr.flFontMapper = 0;
324  pdc->dcattr.flTextAlign = 0;
325  pdc->dcattr.lTextAlign = 0;
326  pdc->dcattr.lTextExtra = 0;
327  pdc->dcattr.lRelAbs = 1;
328  pdc->dcattr.lBreakExtra = 0;
329  pdc->dcattr.cBreak = 0;
330  pdc->dcattr.hlfntNew = StockObjects[SYSTEM_FONT];
331  pdc->dclevel.plfnt = LFONT_ShareLockFont(pdc->dcattr.hlfntNew);
332 
333  /* Other stuff */
334  pdc->hdcNext = NULL;
335  pdc->hdcPrev = NULL;
336  pdc->ipfdDevMax = 0;
337  pdc->ulCopyCount = -1;
338  pdc->ptlDoBanding.x = 0;
339  pdc->ptlDoBanding.y = 0;
340  pdc->dclevel.lSaveDepth = 1;
341  pdc->dclevel.hdcSave = NULL;
342  pdc->dcattr.iGraphicsMode = GM_COMPATIBLE;
343  pdc->dcattr.iCS_CP = 0;
344  pdc->pSurfInfo = NULL;
345 }
DHPDEV dhpdev
Definition: pdevobj.h:121
PBRUSH pbrDefaultBrush
Definition: dclife.c:18
VOID FASTCALL IntEngInitClipObj(XCLIPOBJ *Clip)
Definition: clip.c:158
XCLIPOBJ gxcoTrivial
Definition: bitblt.c:15
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:113
PSURFACE NTAPI PDEVOBJ_pSurface(PPDEVOBJ ppdev)
Definition: pdevobj.c:233
GDIINFO gdiinfo
Definition: pdevobj.h:124
PPDEVOBJ gppdevPrimary
Definition: pdevobj.c:13
#define PAGE_TO_DEVICE_IDENTITY
Definition: ntgdihdl.h:195
#define CLR_INVALID
Definition: wingdi.h:881
#define gmxDeviceToWorldDefault
Definition: dclife.c:46
#define WHITE_BRUSH
Definition: wingdi.h:900
#define R2_COPYPEN
Definition: wingdi.h:337
#define DC_PRIMARY_DISPLAY
Definition: ntgdihdl.h:161
ULONG ulVertSize
Definition: winddi.h:881
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2386
HGDIOBJ StockObjects[]
Definition: stockobj.c:99
#define ALTERNATE
Definition: constants.h:278
ULONG ulHorzRes
Definition: winddi.h:882
smooth NULL
Definition: ftsmooth.c:513
#define SYSTEM_FONT
Definition: wingdi.h:909
HSEMAPHORE hsemDevLock
Definition: pdevobj.h:91
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
#define DEFAULT_PALETTE
Definition: wingdi.h:911
DEVINFO devinfo
Definition: pdevobj.h:123
#define RGB(r, g, b)
Definition: wingdi.h:2917
ULONG ulHorzSize
Definition: winddi.h:880
static const FLOATOBJ gef0
Definition: floatobj.h:115
#define GM_COMPATIBLE
Definition: wingdi.h:862
#define WORLD_TO_PAGE_IDENTITY
Definition: ntgdihdl.h:186
static const FLOATOBJ gef16
Definition: floatobj.h:117
#define PAGE_TO_DEVICE_SCALE_IDENTITY
Definition: ntgdihdl.h:196
VOID NTAPI EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:112
#define BLACK_PEN
Definition: wingdi.h:901
FLONG flGraphicsCaps
Definition: winddi.h:390
#define DIRTY_DEFAULT
Definition: dclife.c:15
#define LFONT_ShareLockFont(hfont)
Definition: text.h:79
#define gmxWorldToDeviceDefault
Definition: dclife.c:45
#define MM_TEXT
Definition: wingdi.h:871
const MATRIX gmxWorldToPageDefault
Definition: dclife.c:36
ULONG ulVertRes
Definition: winddi.h:883
PBRUSH FASTCALL PEN_ShareLockPen(HPEN hobj)
Definition: pen.c:61
FLONG flGraphicsCaps2
Definition: winddi.h:399
VOID FASTCALL DC_vPrepareDCsForBlit ( PDC  pdcDest,
const RECT rcDest,
PDC  pdcSrc,
const RECT rcSrc 
)

Definition at line 497 of file dclife.c.

Referenced by GreExtTextOutW(), GreGradientFill(), GreStretchBltMask(), IntGdiBitBltRgn(), IntGdiExtEscape(), IntGdiFillRgn(), IntGdiPolyline(), IntPatBlt(), IntRectangle(), IntRoundRect(), NtGdiAlphaBlend(), NtGdiAngleArc(), NtGdiArcInternal(), NtGdiEllipse(), NtGdiExtFloodFill(), NtGdiFillPath(), NtGdiGetPixel(), NtGdiLineTo(), NtGdiMaskBlt(), NtGdiPolyPolyDraw(), NtGdiSetDIBitsToDeviceInternal(), NtGdiStretchDIBitsInternal(), NtGdiStrokeAndFillPath(), NtGdiStrokePath(), NtGdiTransparentBlt(), and UserDrawIconEx().

502 {
503  PDC pdcFirst, pdcSecond;
504  const RECT *prcFirst, *prcSecond;
505 
506  /* Update brushes */
507  if (pdcDest->pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
508  DC_vUpdateFillBrush(pdcDest);
509  if (pdcDest->pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
510  DC_vUpdateLineBrush(pdcDest);
511  if(pdcDest->pdcattr->ulDirty_ & DIRTY_TEXT)
512  DC_vUpdateTextBrush(pdcDest);
513 
514  /* Lock them in good order */
515  if (pdcSrc)
516  {
517  if((ULONG_PTR)pdcDest->ppdev->hsemDevLock >=
518  (ULONG_PTR)pdcSrc->ppdev->hsemDevLock)
519  {
520  pdcFirst = pdcDest;
521  prcFirst = rcDest;
522  pdcSecond = pdcSrc;
523  prcSecond = rcSrc;
524  }
525  else
526  {
527  pdcFirst = pdcSrc;
528  prcFirst = rcSrc;
529  pdcSecond = pdcDest;
530  prcSecond = rcDest;
531  }
532  }
533  else
534  {
535  pdcFirst = pdcDest;
536  prcFirst = rcDest;
537  pdcSecond = NULL;
538  prcSecond = NULL;
539  }
540 
541  if (pdcDest->fs & DC_FLAG_DIRTY_RAO)
542  CLIPPING_UpdateGCRegion(pdcDest);
543 
544  /* Lock and update first DC */
545  if (pdcFirst->dctype == DCTYPE_DIRECT)
546  {
547  EngAcquireSemaphore(pdcFirst->ppdev->hsemDevLock);
548 
549  /* Update surface if needed */
550  if (pdcFirst->ppdev->pSurface != pdcFirst->dclevel.pSurface)
551  {
552  DC_vUpdateDC(pdcFirst);
553  }
554  }
555 
556  if (pdcFirst->dctype == DCTYPE_DIRECT)
557  {
558  if (!prcFirst)
559  prcFirst = &pdcFirst->erclClip;
560 
561  MouseSafetyOnDrawStart(pdcFirst->ppdev,
562  prcFirst->left,
563  prcFirst->top,
564  prcFirst->right,
565  prcFirst->bottom) ;
566  }
567 
568 #if DBG
569  pdcFirst->fs |= DC_PREPARED;
570 #endif
571 
572  if (!pdcSecond)
573  return;
574 
575  /* Lock and update second DC */
576  if (pdcSecond->dctype == DCTYPE_DIRECT)
577  {
578  EngAcquireSemaphore(pdcSecond->ppdev->hsemDevLock);
579 
580  /* Update surface if needed */
581  if (pdcSecond->ppdev->pSurface != pdcSecond->dclevel.pSurface)
582  {
583  DC_vUpdateDC(pdcSecond);
584  }
585  }
586 
587  if (pdcSecond->dctype == DCTYPE_DIRECT)
588  {
589  if (!prcSecond)
590  prcSecond = &pdcSecond->erclClip;
591  MouseSafetyOnDrawStart(pdcSecond->ppdev,
592  prcSecond->left,
593  prcSecond->top,
594  prcSecond->right,
595  prcSecond->bottom) ;
596  }
597 
598 #if DBG
599  pdcSecond->fs |= DC_PREPARED;
600 #endif
601 }
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
static void DC_vUpdateDC(PDC pdc)
Definition: dclife.c:467
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:158
LONG top
Definition: windef.h:320
LONG left
Definition: windef.h:319
LONG right
Definition: windef.h:321
uint32_t ULONG_PTR
Definition: typedefs.h:64
_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)
smooth NULL
Definition: ftsmooth.c:513
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
Definition: polytest.cpp:40
#define DC_FLAG_DIRTY_RAO
Definition: ntgdihdl.h:132
VOID FASTCALL CLIPPING_UpdateGCRegion(PDC pDC)
Definition: cliprgn.c:544
#define DIRTY_TEXT
Definition: ntgdihdl.h:147
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
LONG bottom
Definition: windef.h:322
#define DIRTY_LINE
Definition: ntgdihdl.h:146
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
VOID NTAPI DC_vRestoreDC ( IN PDC  pdc,
INT  iSaveLevel 
)

Definition at line 137 of file dcstate.c.

Referenced by DC_vCleanup(), DC_vSetOwner(), and NtGdiRestoreDC().

140 {
141  HDC hdcSave;
142  PDC pdcSave;
143 
144  NT_ASSERT(iSaveLevel > 0);
145  DPRINT("DC_vRestoreDC(%p, %ld)\n", pdc->BaseObject.hHmgr, iSaveLevel);
146 
147  /* Loop the save levels */
148  while (pdc->dclevel.lSaveDepth > iSaveLevel)
149  {
150  hdcSave = pdc->dclevel.hdcSave;
151  DPRINT("RestoreDC = %p\n", hdcSave);
152 
153  /* Set us as the owner */
154  if (!GreSetObjectOwner(hdcSave, GDI_OBJ_HMGR_POWNED))
155  {
156  /* Could not get ownership. That's bad! */
157  DPRINT1("Could not get ownership of saved DC (%p) for hdc %p!\n",
158  hdcSave, pdc->BaseObject.hHmgr);
159  NT_ASSERT(FALSE);
160  return;// FALSE;
161  }
162 
163  /* Lock the saved dc */
164  pdcSave = DC_LockDc(hdcSave);
165  if (!pdcSave)
166  {
167  /* WTF? Internal error! */
168  DPRINT1("Could not lock the saved DC (%p) for dc %p!\n",
169  hdcSave, pdc->BaseObject.hHmgr);
170  NT_ASSERT(FALSE);
171  return;// FALSE;
172  }
173 
174  /* Remove the saved dc from the queue */
175  pdc->dclevel.hdcSave = pdcSave->dclevel.hdcSave;
176 
177  /* Decrement save level */
178  pdc->dclevel.lSaveDepth--;
179 
180  /* Is this the state we want? */
181  if (pdc->dclevel.lSaveDepth == iSaveLevel)
182  {
183  /* Copy the state back */
184  DC_vCopyState(pdcSave, pdc, FALSE);
185 
186  /* Only memory DC's change their surface */
187  if (pdc->dctype == DCTYPE_MEMORY)
188  DC_vSelectSurface(pdc, pdcSave->dclevel.pSurface);
189 
190  if (pdcSave->dclevel.hPath)
191  {
192  PATH_RestorePath( pdc, pdcSave );
193  }
194  }
195 
196  /* Prevent save dc from being restored */
197  pdcSave->dclevel.lSaveDepth = 1;
198 
199  /* Unlock it */
200  DC_UnlockDc(pdcSave);
201  /* Delete the saved dc */
202  GreDeleteObject(hdcSave);
203  }
204 
205  DPRINT("Leave DC_vRestoreDC()\n");
206 }
#define HDC
Definition: msvc.h:22
BOOL NTAPI GreSetObjectOwner(HGDIOBJ hobj, ULONG ulOwner)
Definition: gdiobj.c:1250
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1153
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
FORCEINLINE VOID DC_vSelectSurface(PDC pdc, PSURFACE psurfNew)
Definition: dc.h:247
BOOL PATH_RestorePath(DC *dst, DC *src)
Definition: path.c:209
#define FALSE
Definition: types.h:117
void DPRINT(...)
Definition: polytest.cpp:61
Definition: polytest.cpp:40
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DPRINT1
Definition: precomp.h:8
VOID FASTCALL DC_vCopyState(PDC pdcSrc, PDC pdcDst, BOOL To)
Definition: dcstate.c:16
#define NT_ASSERT
Definition: rtlfuncs.h:3312
FORCEINLINE VOID DC_vSelectFillBrush ( PDC  pdc,
PBRUSH  pbrFill 
)

Definition at line 262 of file dc.h.

Referenced by DC_vCleanup(), and DC_vCopyState().

263 {
264  PBRUSH pbrFillOld = pdc->dclevel.pbrFill;
265  if (pbrFillOld)
266  BRUSH_ShareUnlockBrush(pbrFillOld);
267  if (pbrFill)
269  pdc->dclevel.pbrFill = pbrFill;
270 }
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:114
Definition: types.h:100
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:729
FORCEINLINE VOID DC_vSelectLineBrush ( PDC  pdc,
PBRUSH  pbrLine 
)

Definition at line 274 of file dc.h.

Referenced by DC_vCleanup(), and DC_vCopyState().

275 {
276  PBRUSH pbrLineOld = pdc->dclevel.pbrLine;
277  if (pbrLineOld)
278  BRUSH_ShareUnlockBrush(pbrLineOld);
279  if (pbrLine)
281  pdc->dclevel.pbrLine = pbrLine;
282 }
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:114
Definition: types.h:100
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:729
FORCEINLINE VOID DC_vSelectPalette ( PDC  pdc,
PPALETTE  ppal 
)

Definition at line 286 of file dc.h.

Referenced by DC_vCleanup(), DC_vCopyState(), and GdiSelectPalette().

287 {
288  PPALETTE ppalOld = pdc->dclevel.ppal;
289  if (ppalOld)
291  if (ppal)
293  pdc->dclevel.ppal = ppal;
294 }
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:729
FORCEINLINE VOID DC_vSelectSurface ( PDC  pdc,
PSURFACE  psurfNew 
)

Definition at line 247 of file dc.h.

Referenced by DC_vCleanup(), DC_vRestoreDC(), and NtGdiSaveDC().

248 {
249  PSURFACE psurfOld = pdc->dclevel.pSurface;
250  if (psurfOld)
251  {
252  psurfOld->hdc = NULL;
253  SURFACE_ShareUnlockSurface(psurfOld);
254  }
255  if (psurfNew)
257  pdc->dclevel.pSurface = psurfNew;
258 }
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:95
smooth NULL
Definition: ftsmooth.c:513
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:729
HDC hdc
Definition: surface.h:26
VOID NTAPI DC_vSetBrushOrigin ( PDC  pdc,
LONG  x,
LONG  y 
)

Definition at line 142 of file dcobjs.c.

Referenced by GdiFlushUserBatch(), and GreSetBrushOrg().

143 {
144  /* Set the brush origin */
145  pdc->dclevel.ptlBrushOrigin.x = x;
146  pdc->dclevel.ptlBrushOrigin.y = y;
147 
148  /* Set the fill origin */
149  pdc->ptlFillOrigin.x = x + pdc->ptlDCOrig.x;
150  pdc->ptlFillOrigin.y = y + pdc->ptlDCOrig.y;
151 }
INT INT y
Definition: msvc.h:62
INT x
Definition: msvc.h:62
VOID FASTCALL DC_vUpdateBackgroundBrush ( PDC  pdc)

Definition at line 126 of file dcobjs.c.

Referenced by GreExtTextOutW(), and IntGdiCleanDC().

127 {
128  PDC_ATTR pdcattr = pdc->pdcattr;
129 
130  if(pdcattr->ulDirty_ & DIRTY_BACKGROUND)
131  EBRUSHOBJ_vUpdateFromDC(&pdc->eboBackground, pbrDefaultBrush, pdc);
132 
133  /* Update the eboBackground's solid color */
134  EBRUSHOBJ_vSetSolidRGBColor(&pdc->eboBackground, pdcattr->crBackgroundClr);
135 
136  /* Clear flag */
137  pdcattr->ulDirty_ &= ~DIRTY_BACKGROUND;
138 }
VOID FASTCALL EBRUSHOBJ_vSetSolidRGBColor(EBRUSHOBJ *pebo, COLORREF crColor)
Definition: engbrush.c:122
_Notnull_ PBRUSH pbrDefaultBrush
Definition: dclife.c:18
VOID NTAPI EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:194
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:148
ULONG ulDirty_
Definition: ntgdihdl.h:291
COLORREF crBackgroundClr
Definition: ntgdihdl.h:294
VOID FASTCALL DC_vUpdateFillBrush ( PDC  pdc)

Definition at line 16 of file dcobjs.c.

Referenced by DC_vPrepareDCsForBlit(), GreStretchBltMask(), IntGdiCleanDC(), IntGdiFillRgn(), IntGdiPolygon(), IntGdiSetTextColor(), IntRectangle(), IntRoundRect(), NtGdiAngleArc(), NtGdiArcInternal(), NtGdiEllipse(), NtGdiFillPath(), NtGdiGetDCObject(), NtGdiMaskBlt(), NtGdiPatBlt(), NtGdiPolyDraw(), NtGdiPolyPolyDraw(), NtGdiSelectBrush(), and NtGdiStrokeAndFillPath().

17 {
18  PDC_ATTR pdcattr = pdc->pdcattr;
19  PBRUSH pbrFill;
20 
21  /* Check if the brush handle has changed */
22  if (pdcattr->hbrush != pdc->dclevel.pbrFill->BaseObject.hHmgr)
23  {
24  /* Try to lock the new brush */
25  pbrFill = BRUSH_ShareLockBrush(pdcattr->hbrush);
26  if (pbrFill)
27  {
28  /* Unlock old brush, set new brush */
29  BRUSH_ShareUnlockBrush(pdc->dclevel.pbrFill);
30  pdc->dclevel.pbrFill = pbrFill;
31 
32  /* Mark eboFill as dirty */
33  pdcattr->ulDirty_ |= DIRTY_FILL;
34  }
35  else
36  {
37  /* Invalid brush handle, restore old one */
38  pdcattr->hbrush = pdc->dclevel.pbrFill->BaseObject.hHmgr;
39  }
40  }
41 
42  /* Check if the EBRUSHOBJ needs update */
43  if (pdcattr->ulDirty_ & DIRTY_FILL)
44  {
45  /* Update eboFill */
46  EBRUSHOBJ_vUpdateFromDC(&pdc->eboFill, pdc->dclevel.pbrFill, pdc);
47  }
48 
49  /* Check for DC brush */
50  if (pdcattr->hbrush == StockObjects[DC_BRUSH])
51  {
52  /* Update the eboFill's solid color */
53  EBRUSHOBJ_vSetSolidRGBColor(&pdc->eboFill, pdcattr->crBrushClr);
54  }
55 
56  /* Clear flags */
57  pdcattr->ulDirty_ &= ~(DIRTY_FILL | DC_BRUSH_DIRTY);
58 }
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:114
VOID FASTCALL EBRUSHOBJ_vSetSolidRGBColor(EBRUSHOBJ *pebo, COLORREF crColor)
Definition: engbrush.c:122
HANDLE hbrush
Definition: ntgdihdl.h:292
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:113
VOID NTAPI EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:194
HGDIOBJ StockObjects[]
Definition: stockobj.c:99
ULONG ulDirty_
Definition: ntgdihdl.h:291
Definition: types.h:100
COLORREF crBrushClr
Definition: ntgdihdl.h:298
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:157
VOID FASTCALL DC_vUpdateLineBrush ( PDC  pdc)

Definition at line 62 of file dcobjs.c.

Referenced by DC_vPrepareDCsForBlit(), IntGdiCleanDC(), IntGdiPolygon(), IntGdiSetTextColor(), IntRectangle(), IntRoundRect(), NtGdiAngleArc(), NtGdiArcInternal(), NtGdiEllipse(), NtGdiFillPath(), NtGdiGetDCObject(), NtGdiPolyDraw(), NtGdiPolyPolyDraw(), NtGdiSelectPen(), NtGdiStrokeAndFillPath(), and NtGdiStrokePath().

63 {
64  PDC_ATTR pdcattr = pdc->pdcattr;
65  PBRUSH pbrLine;
66 
67  /* Check if the pen handle has changed */
68  if (pdcattr->hpen != pdc->dclevel.pbrLine->BaseObject.hHmgr)
69  {
70  /* Try to lock the new pen */
71  pbrLine = PEN_ShareLockPen(pdcattr->hpen);
72  if (pbrLine)
73  {
74  /* Unlock old brush, set new brush */
75  BRUSH_ShareUnlockBrush(pdc->dclevel.pbrLine);
76  pdc->dclevel.pbrLine = pbrLine;
77 
78  /* Mark eboLine as dirty */
79  pdcattr->ulDirty_ |= DIRTY_LINE;
80  }
81  else
82  {
83  /* Invalid pen handle, restore old one */
84  pdcattr->hpen = pdc->dclevel.pbrLine->BaseObject.hHmgr;
85  }
86  }
87 
88  /* Check if the EBRUSHOBJ needs update */
89  if (pdcattr->ulDirty_ & DIRTY_LINE)
90  {
91  /* Update eboLine */
92  EBRUSHOBJ_vUpdateFromDC(&pdc->eboLine, pdc->dclevel.pbrLine, pdc);
93  }
94 
95  /* Check for DC pen */
96  if (pdcattr->hpen == StockObjects[DC_PEN])
97  {
98  /* Update the eboLine's solid color */
99  EBRUSHOBJ_vSetSolidRGBColor(&pdc->eboLine, pdcattr->crPenClr);
100  }
101 
102  /* Clear flags */
103  pdcattr->ulDirty_ &= ~(DIRTY_LINE | DC_PEN_DIRTY);
104 }
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:114
VOID FASTCALL EBRUSHOBJ_vSetSolidRGBColor(EBRUSHOBJ *pebo, COLORREF crColor)
Definition: engbrush.c:122
HANDLE hpen
Definition: ntgdihdl.h:293
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:158
COLORREF crPenClr
Definition: ntgdihdl.h:300
VOID NTAPI EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:194
HGDIOBJ StockObjects[]
Definition: stockobj.c:99
ULONG ulDirty_
Definition: ntgdihdl.h:291
Definition: types.h:100
#define DIRTY_LINE
Definition: ntgdihdl.h:146
PBRUSH FASTCALL PEN_ShareLockPen(HPEN hobj)
Definition: pen.c:61
VOID FASTCALL DC_vUpdateTextBrush ( PDC  pdc)

Definition at line 108 of file dcobjs.c.

Referenced by DC_vPrepareDCsForBlit(), GreExtTextOutW(), IntGdiCleanDC(), and IntGdiSetTextColor().

109 {
110  PDC_ATTR pdcattr = pdc->pdcattr;
111 
112  /* Timo : The text brush should never be changed.
113  * Jérôme : Yeah, but its palette must be updated anyway! */
114  if(pdcattr->ulDirty_ & DIRTY_TEXT)
115  EBRUSHOBJ_vUpdateFromDC(&pdc->eboText, pbrDefaultBrush, pdc);
116 
117  /* Update the eboText's solid color */
118  EBRUSHOBJ_vSetSolidRGBColor(&pdc->eboText, pdcattr->crForegroundClr);
119 
120  /* Clear flag */
121  pdcattr->ulDirty_ &= ~DIRTY_TEXT;
122 }
VOID FASTCALL EBRUSHOBJ_vSetSolidRGBColor(EBRUSHOBJ *pebo, COLORREF crColor)
Definition: engbrush.c:122
_Notnull_ PBRUSH pbrDefaultBrush
Definition: dclife.c:18
VOID NTAPI EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:194
ULONG ulDirty_
Definition: ntgdihdl.h:291
#define DIRTY_TEXT
Definition: ntgdihdl.h:147
COLORREF crForegroundClr
Definition: ntgdihdl.h:296
VOID FASTCALL DC_vUpdateViewportExt ( PDC  pdc)
VOID FASTCALL DCU_SetDcUndeletable ( HDC  )

Definition at line 317 of file dcutil.c.

Referenced by DceAllocDCE().

318 {
319  PDC dc = DC_LockDc(hDC);
320  if (!dc)
321  {
323  return;
324  }
325 
326  dc->fs |= DC_FLAG_PERMANENT;
327  DC_UnlockDc(dc);
328  return;
329 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HDC dc
Definition: cylfrac.c:34
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
#define DC_FLAG_PERMANENT
Definition: ntgdihdl.h:131
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
HPALETTE NTAPI GdiSelectPalette ( _In_ HDC  hDC,
_In_ HPALETTE  hpal,
_In_ BOOL  ForceBackground 
)

Referenced by NtUserSelectPalette().

HDC APIENTRY GreCreateCompatibleDC ( HDC  hdc,
BOOL  bAltDc 
)

Definition at line 806 of file dclife.c.

Referenced by NtGdiCreateCompatibleDC(), and NtGdiCreateMetafileDC().

807 {
808  GDILOOBJTYPE eDcObjType;
809  HDC hdcNew;
810  PPDEVOBJ ppdev;
811  PDC pdc, pdcNew;
812 
813  DPRINT("NtGdiCreateCompatibleDC(0x%p)\n", hdc);
814 
815  /* Did the caller provide a DC? */
816  if (hdc)
817  {
818  /* Yes, try to lock it */
819  pdc = DC_LockDc(hdc);
820  if (!pdc)
821  {
822  DPRINT1("Could not lock source DC %p\n", hdc);
823  return NULL;
824  }
825 
826  /* Get the pdev from the DC */
827  ppdev = pdc->ppdev;
829 
830  /* Unlock the source DC */
831  DC_UnlockDc(pdc);
832  }
833  else
834  {
835  /* No DC given, get default device */
836  ppdev = EngpGetPDEV(NULL);
837  }
838 
839  if (!ppdev)
840  {
841  DPRINT1("Didn't find a suitable PDEV\n");
842  return NULL;
843  }
844 
845  /* Allocate a new DC */
846  eDcObjType = bAltDc ? GDILoObjType_LO_ALTDC_TYPE : GDILoObjType_LO_DC_TYPE;
847  pdcNew = DC_AllocDcWithHandle(eDcObjType);
848  if (!pdcNew)
849  {
850  DPRINT1("Could not allocate a new DC\n");
851  PDEVOBJ_vRelease(ppdev);
852  return NULL;
853  }
854  hdcNew = pdcNew->BaseObject.hHmgr;
855 
856  /* Lock ppdev and initialize the new DC */
857  DC_vInitDc(pdcNew, bAltDc ? DCTYPE_INFO : DCTYPE_MEMORY, ppdev);
858  /* FIXME: HACK! */
859  DC_InitHack(pdcNew);
860 
861  /* Allocate a dc attribute */
862  DC_bAllocDcAttr(pdcNew);
863 
864  DC_UnlockDc(pdcNew);
865 
866  DPRINT("Leave NtGdiCreateCompatibleDC hdcNew = %p\n", hdcNew);
867 
868  return hdcNew;
869 }
#define HDC
Definition: msvc.h:22
LONG cPdevRefs
Definition: pdevobj.h:86
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
PDC NTAPI DC_AllocDcWithHandle(GDILOOBJTYPE eDcObjType)
Definition: dclife.c:69
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:513
void DPRINT(...)
Definition: polytest.cpp:61
BOOL NTAPI DC_bAllocDcAttr(PDC pdc)
Definition: dcattr.c:31
Definition: polytest.cpp:40
Definition: dc.h:43
VOID NTAPI DC_vInitDc(PDC pdc, DCTYPE dctype, PPDEVOBJ ppdev)
Definition: dclife.c:124
#define InterlockedIncrement
Definition: armddk.h:53
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DPRINT1
Definition: precomp.h:8
void DC_InitHack(PDC pdc)
Definition: dclife.c:104
enum GDILoObjType GDILOOBJTYPE
PPDEVOBJ NTAPI EngpGetPDEV(_In_opt_ PUNICODE_STRING pustrDeviceName)
Definition: pdevobj.c:581
VOID NTAPI PDEVOBJ_vRelease(PPDEVOBJ ppdev)
Definition: pdevobj.c:93
COLORREF FASTCALL GreGetBkColor ( HDC  )

Definition at line 50 of file dcutil.c.

Referenced by MENU_DrawMenuItem().

51 {
52  PDC dc;
53  COLORREF crBk;
54  if (!(dc = DC_LockDc(hdc)))
55  {
57  return CLR_INVALID;
58  }
59  crBk = dc->pdcattr->ulBackgroundClr;
60  DC_UnlockDc(dc);
61  return crBk;
62 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:881
HDC dc
Definition: cylfrac.c:34
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
DWORD COLORREF
Definition: windef.h:313
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
int FASTCALL GreGetBkMode ( HDC  )

Definition at line 35 of file dcutil.c.

Referenced by MENU_DrawPopupGlyph(), UITOOLS95_DrawFrameCaption(), and UITOOLS95_DrawFrameScroll().

36 {
37  PDC dc;
38  LONG lBkMode;
39  if (!(dc = DC_LockDc(hdc)))
40  {
42  return CLR_INVALID;
43  }
44  lBkMode = dc->pdcattr->lBkMode;
45  DC_UnlockDc(dc);
46  return lBkMode;
47 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:881
HDC dc
Definition: cylfrac.c:34
long LONG
Definition: pedump.c:60
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
int FASTCALL GreGetGraphicsMode ( HDC  )

Definition at line 301 of file dcutil.c.

Referenced by DrawTextExWorker().

302 {
303  PDC dc;
304  int GraphicsMode;
305  if (!(dc = DC_LockDc(hdc)))
306  {
308  return CLR_INVALID;
309  }
310  GraphicsMode = dc->pdcattr->iGraphicsMode;
311  DC_UnlockDc(dc);
312  return GraphicsMode;
313 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:881
HDC dc
Definition: cylfrac.c:34
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
int FASTCALL GreGetMapMode ( HDC  )

Definition at line 65 of file dcutil.c.

Referenced by DrawFrameControl().

66 {
67  PDC dc;
68  INT iMapMode;
69  if (!(dc = DC_LockDc(hdc)))
70  {
72  return CLR_INVALID;
73  }
74  iMapMode = dc->pdcattr->iMapMode;
75  DC_UnlockDc(dc);
76  return iMapMode;
77 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:881
HDC dc
Definition: cylfrac.c:34
int32_t INT
Definition: typedefs.h:57
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
COLORREF FASTCALL GreGetTextColor ( HDC  )

Definition at line 80 of file dcutil.c.

Referenced by MENU_DrawMenuItem(), MENU_DrawPopupGlyph(), TEXT_DrawUnderscore(), UITOOLS95_DrawFrameCaption(), and UITOOLS95_DrawFrameScroll().

81 {
82  PDC dc;
83  ULONG ulForegroundClr;
84  if (!(dc = DC_LockDc(hdc)))
85  {
87  return CLR_INVALID;
88  }
89  ulForegroundClr = dc->pdcattr->ulForegroundClr;
90  DC_UnlockDc(dc);
91  return ulForegroundClr;
92 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:881
HDC dc
Definition: cylfrac.c:34
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int ULONG
Definition: retypes.h:1
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
BOOL FASTCALL GreSetBrushOrg ( HDC  ,
INT  ,
INT  ,
LPPOINT   
)

Definition at line 226 of file dcutil.c.

Referenced by _Success_(), and IntFillWindow().

231 {
232  PDC pdc = DC_LockDc(hdc);
233  if (pdc == NULL)
234  {
236  return FALSE;
237  }
238 
239  if (pptOut != NULL)
240  {
241  *pptOut = pdc->pdcattr->ptlBrushOrigin;
242  }
243 
244  pdc->pdcattr->ptlBrushOrigin.x = x;
245  pdc->pdcattr->ptlBrushOrigin.y = y;
246 
247  DC_vSetBrushOrigin(pdc, x, y);
248 
249  DC_UnlockDc(pdc);
250  return TRUE;
251 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define FALSE
Definition: types.h:117
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:513
Definition: polytest.cpp:40
_In_ UINT _Out_ PPOINTL pptOut
Definition: ntgdi.h:2197
VOID NTAPI DC_vSetBrushOrigin(PDC pdc, LONG x, LONG y)
Definition: dcobjs.c:142
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
INT INT y
Definition: msvc.h:62
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
INT x
Definition: msvc.h:62
BOOL NTAPI GreSetDCOwner ( HDC  hdc,
ULONG  ulOwner 
)

Definition at line 447 of file dclife.c.

Referenced by co_IntInitializeDesktopGraphics(), DceAllocDCE(), DceFreeDCE(), DceFreeWindowDCE(), DceReleaseDC(), DxEngSetDCOwner(), IntEndDesktopGraphics(), and UserGetDCEx().

448 {
449  PDC pdc;
450 
451  pdc = DC_LockDc(hdc);
452  if (!pdc)
453  {
454  DPRINT1("GreSetDCOwner: Could not lock DC\n");
455  return FALSE;
456  }
457 
458  /* Call the internal DC function */
459  DC_vSetOwner(pdc, ulOwner);
460 
461  DC_UnlockDc(pdc);
462  return TRUE;
463 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define FALSE
Definition: types.h:117
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
VOID NTAPI DC_vSetOwner(PDC pdc, ULONG ulOwner)
Definition: dclife.c:406
#define DPRINT1
Definition: precomp.h:8
int FASTCALL GreSetStretchBltMode ( HDC  hdc,
int  iStretchMode 
)

Definition at line 278 of file dcutil.c.

279 {
280  PDC pdc;
281  PDC_ATTR pdcattr;
282  INT oSMode = 0;
283 
284  pdc = DC_LockDc(hDC);
285  if (pdc)
286  {
287  pdcattr = pdc->pdcattr;
288  oSMode = pdcattr->lStretchBltMode;
289  pdcattr->lStretchBltMode = iStretchMode;
290 
291  // Wine returns an error here. We set the default.
292  if ((iStretchMode <= 0) || (iStretchMode > MAXSTRETCHBLTMODE)) iStretchMode = WHITEONBLACK;
293 
294  pdcattr->jStretchBltMode = iStretchMode;
295  DC_UnlockDc(pdc);
296  }
297  return oSMode;
298 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
BYTE jStretchBltMode
Definition: ntgdihdl.h:307
#define MAXSTRETCHBLTMODE
Definition: wingdi.h:954
int32_t INT
Definition: typedefs.h:57
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
LONG lStretchBltMode
Definition: ntgdihdl.h:312
#define WHITEONBLACK
Definition: wingdi.h:951
INIT_FUNCTION NTSTATUS NTAPI InitDcImpl ( VOID  )

Internal functions

Definition at line 53 of file dclife.c.

Referenced by DriverEntry().

54 {
56  if (!psurfDefaultBitmap)
57  return STATUS_UNSUCCESSFUL;
58 
60  if (!pbrDefaultBrush)
61  return STATUS_UNSUCCESSFUL;
62 
63  return STATUS_SUCCESS;
64 }
PBRUSH pbrDefaultBrush
Definition: dclife.c:18
#define STATUS_SUCCESS
Definition: contextmenu.cpp:55
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:113
PSURFACE psurfDefaultBitmap
Definition: dclife.c:17
#define SURFACE_ShareLockSurface(hBMObj)
Definition: surface.h:91
HGDIOBJ StockObjects[]
Definition: stockobj.c:99
#define DEFAULT_BITMAP
Definition: CreateBitmap.c:12
#define BLACK_BRUSH
Definition: wingdi.h:894
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
PPDEVOBJ FASTCALL IntEnumHDev ( VOID  )

Definition at line 50 of file device.c.

51 {
52 // I guess we will soon have more than one primary surface.
53 // This will do for now.
54  return gppdevPrimary;
55 }
PPDEVOBJ gppdevPrimary
Definition: pdevobj.c:13
BOOL FASTCALL IntGdiCleanDC ( HDC  hDC)

Definition at line 72 of file dcstate.c.

Referenced by DceReleaseDC(), and DxEngCleanDC().

73 {
74  PDC dc;
75  if (!hDC) return FALSE;
76  dc = DC_LockDc(hDC);
77  if (!dc) return FALSE;
78  // Clean the DC
79  if (defaultDCstate)
80  {
82  /* Update the brushes now, because they reference some objects (the DC palette)
83  * Which belong to the current process, and this DC might be used for another process
84  * after being cleaned up (for GetDC(0) for instance) */
89  }
90 
91  // Remove Path and reset flags.
92  if (dc->dclevel.hPath)
93  {
94  DPRINT("Clean DC Remove Path\n");
95  if (!PATH_Delete(dc->dclevel.hPath))
96  {
97  DPRINT1("Failed to remove Path\n");
98  }
99  dc->dclevel.hPath = 0;
100  dc->dclevel.flPath = 0;
101  }
102 
103  /* DC_vCopyState frees the Clip rgn and the Meta rgn. Take care of the other ones
104  * There is no need to clear prgnVis, as UserGetDC updates it immediately. */
105  if (dc->prgnRao)
106  REGION_Delete(dc->prgnRao);
107  if (dc->prgnAPI)
108  REGION_Delete(dc->prgnAPI);
109  dc->prgnRao = dc->prgnAPI = NULL;
110 
111  dc->fs |= DC_FLAG_DIRTY_RAO;
112 
113  DC_UnlockDc(dc);
114 
115  return TRUE;
116 }
#define TRUE
Definition: types.h:120
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc)
Definition: dcobjs.c:126
HDC dc
Definition: cylfrac.c:34
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:513
void DPRINT(...)
Definition: polytest.cpp:61
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
PDC defaultDCstate
Definition: device.c:14
#define DC_FLAG_DIRTY_RAO
Definition: ntgdihdl.h:132
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DPRINT1
Definition: precomp.h:8
VOID FASTCALL DC_vCopyState(PDC pdcSrc, PDC pdcDst, BOOL To)
Definition: dcstate.c:16
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2428
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
HDC FASTCALL IntGdiCreateDisplayDC ( HDEV  hDev,
ULONG  DcType,
BOOL  EmptyDC 
)

Definition at line 1055 of file dclife.c.

Referenced by DxEngCreateMemoryDC(), and UserGetDesktopDC().

1056 {
1057  HDC hDC;
1058  UNIMPLEMENTED;
1059  ASSERT(FALSE);
1060 
1061  if (DcType == DC_TYPE_MEMORY)
1062  hDC = NtGdiCreateCompatibleDC(NULL); // OH~ Yuck! I think I taste vomit in my mouth!
1063  else
1064  hDC = IntGdiCreateDC(NULL, NULL, NULL, NULL, (DcType == DC_TYPE_INFO));
1065 
1066  return hDC;
1067 }
HDC APIENTRY NtGdiCreateCompatibleDC(HDC hdc)
Definition: dclife.c:873
#define HDC
Definition: msvc.h:22
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:513
HDC hDC
Definition: wglext.h:521
#define DC_TYPE_MEMORY
Definition: ntgdihdl.h:124
#define DC_TYPE_INFO
Definition: ntgdihdl.h:125
HDC FASTCALL IntGdiCreateDC(PUNICODE_STRING Driver, PUNICODE_STRING pustrDevice, PVOID pUMdhpdev, CONST PDEVMODEW pdmInit, BOOL CreateAsIC)
Definition: dclife.c:1032
#define UNIMPLEMENTED
Definition: debug.h:114
BOOL FASTCALL IntGdiDeleteDC ( HDC  ,
BOOL   
)

Definition at line 881 of file dclife.c.

Referenced by DceFreeDCE(), DxEngDeleteDC(), IntUpdateLayeredWindowI(), MENU_DrawBitmapItem(), MENU_DrawMenuItem(), NtGdiDeleteObjectApp(), and SnapWindow().

882 {
883  PDC DCToDelete = DC_LockDc(hDC);
884 
885  if (DCToDelete == NULL)
886  {
888  return FALSE;
889  }
890 
891  if (!Force)
892  {
893  /* Windows permits NtGdiDeleteObjectApp to delete a permanent DC
894  * For some reason, it's still a valid handle, pointing to some kernel data.
895  * Not sure if this is a bug, a feature, some cache stuff... Who knows?
896  * See NtGdiDeleteObjectApp test for details */
897  if (DCToDelete->fs & DC_FLAG_PERMANENT)
898  {
899  DC_UnlockDc(DCToDelete);
900  if(UserReleaseDC(NULL, hDC, FALSE))
901  {
902  /* ReactOS feature: Call UserReleaseDC
903  * I don't think Windows does it.
904  * Still, complain, no one should ever call DeleteDC
905  * on a window DC */
906  DPRINT1("No, you naughty application!\n");
907  return TRUE;
908  }
909  else
910  {
911  /* This is not a window owned DC.
912  * Force its deletion */
913  return IntGdiDeleteDC(hDC, TRUE);
914  }
915  }
916  }
917 
918  DC_UnlockDc(DCToDelete);
919 
920  if (GreIsHandleValid(hDC))
921  {
922  if (!GreDeleteObject(hDC))
923  {
924  DPRINT1("DC_FreeDC failed\n");
925  return FALSE;
926  }
927  }
928  else
929  {
930  DPRINT1("Attempted to Delete 0x%p currently being destroyed!!!\n", hDC);
931  return FALSE;
932  }
933 
934  return TRUE;
935 }
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1153
#define TRUE
Definition: types.h:120
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1141
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:513
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
#define DC_FLAG_PERMANENT
Definition: ntgdihdl.h:131
_In_ BOOLEAN Force
Definition: mrx.h:186
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define DPRINT1
Definition: precomp.h:8
BOOL FASTCALL IntGdiDeleteDC(HDC hDC, BOOL Force)
Definition: dclife.c:881
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
VOID FASTCALL IntGdiReferencePdev ( PPDEVOBJ  pPDev)

Definition at line 17 of file device.c.

Referenced by DxEngReferenceHdev().

18 {
20 }
#define UNIMPLEMENTED
Definition: debug.h:114
INT FASTCALL IntGdiSetBkMode ( HDC  hDC,
INT  backgroundMode 
)

Definition at line 124 of file dcutil.c.

Referenced by IntPaintDesktop(), MENU_DrawMenuItem(), MENU_DrawPopupGlyph(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameScroll(), and UserDrawCaptionText().

125 {
126  COLORREF oldMode;
127  PDC dc;
128  PDC_ATTR pdcattr;
129 
130  if (!(dc = DC_LockDc(hDC)))
131  {
133  return CLR_INVALID;
134  }
135  pdcattr = dc->pdcattr;
136  oldMode = pdcattr->lBkMode;
137  pdcattr->jBkMode = Mode;
138  pdcattr->lBkMode = Mode;
139  DC_UnlockDc(dc);
140  return oldMode;
141 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
_In_ ULONG Mode
Definition: hubbusif.h:303
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:881
HDC dc
Definition: cylfrac.c:34
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
BYTE jBkMode
Definition: ntgdihdl.h:305
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
LONG lBkMode
Definition: ntgdihdl.h:310
DWORD COLORREF
Definition: windef.h:313
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
UINT FASTCALL IntGdiSetTextAlign ( HDC  hDC,
UINT  Mode 
)

Definition at line 145 of file dcutil.c.

Referenced by IntPaintDesktop().

147 {
148  UINT prevAlign;
149  DC *dc;
150  PDC_ATTR pdcattr;
151 
152  dc = DC_LockDc(hDC);
153  if (!dc)
154  {
156  return GDI_ERROR;
157  }
158  pdcattr = dc->pdcattr;
159  prevAlign = pdcattr->lTextAlign;
160  pdcattr->lTextAlign = Mode;
161  DC_UnlockDc(dc);
162  return prevAlign;
163 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
_In_ ULONG Mode
Definition: hubbusif.h:303
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HDC dc
Definition: cylfrac.c:34
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int UINT
Definition: ndis.h:50
#define GDI_ERROR
Definition: wingdi.h:1290
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
LONG lTextAlign
Definition: ntgdihdl.h:322
COLORREF FASTCALL IntGdiSetTextColor ( HDC  hDC,
COLORREF  color 
)

Definition at line 167 of file dcutil.c.

Referenced by DefWndControlColor(), IntPaintDesktop(), MENU_DrawMenuItem(), MENU_DrawPopupGlyph(), UITOOLS95_DFC_ButtonCheckRadio(), UITOOLS95_DrawFrameCaption(), UITOOLS95_DrawFrameMenu(), UITOOLS95_DrawFrameScroll(), and UserDrawCaptionText().

169 {
170  COLORREF crOldColor;
171  PDC pdc;
172  PDC_ATTR pdcattr;
173 
174  pdc = DC_LockDc(hDC);
175  if (!pdc)
176  {
178  return CLR_INVALID;
179  }
180  pdcattr = pdc->pdcattr;
181 
182  crOldColor = (COLORREF) pdcattr->ulForegroundClr;
183  pdcattr->ulForegroundClr = (ULONG)color;
184 
185  if (pdcattr->crForegroundClr != color)
186  {
188  pdcattr->crForegroundClr = color;
189  }
190 
191  DC_vUpdateTextBrush(pdc);
192  DC_vUpdateLineBrush(pdc);
193  DC_vUpdateFillBrush(pdc);
194 
195  DC_UnlockDc(pdc);
196 
197  return crOldColor;
198 }
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:881
GLuint color
Definition: glext.h:6243
ULONG ulDirty_
Definition: ntgdihdl.h:291
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
#define DIRTY_TEXT
Definition: ntgdihdl.h:147
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define COLORREF
Definition: msvc.h:35
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ULONG ulForegroundClr
Definition: ntgdihdl.h:297
COLORREF crForegroundClr
Definition: ntgdihdl.h:296
unsigned int ULONG
Definition: retypes.h:1
#define DIRTY_LINE
Definition: ntgdihdl.h:146
DWORD COLORREF
Definition: windef.h:313
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
VOID FASTCALL IntGdiUnreferencePdev ( PPDEVOBJ  pPDev,
DWORD  CleanUpType 
)

Definition at line 23 of file device.c.

Referenced by DxEngUnreferenceHdev().

24 {
26 }
#define UNIMPLEMENTED
Definition: debug.h:114
COLORREF FASTCALL IntSetDCBrushColor ( HDC  ,
COLORREF   
)

Definition at line 201 of file dcutil.c.

Referenced by IntDrawDiagEdge().

202 {
203  COLORREF OldColor = CLR_INVALID;
204  PDC dc;
205  if (!(dc = DC_LockDc(hdc)))
206  {
208  return CLR_INVALID;
209  }
210  else
211  {
212  OldColor = (COLORREF) dc->pdcattr->ulBrushClr;
213  dc->pdcattr->ulBrushClr = (ULONG) crColor;
214 
215  if ( dc->pdcattr->crBrushClr != crColor )
216  {
217  dc->pdcattr->ulDirty_ |= DIRTY_FILL;
218  dc->pdcattr->crBrushClr = crColor;
219  }
220  }
221  DC_UnlockDc(dc);
222  return OldColor;
223 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:881
HDC dc
Definition: cylfrac.c:34
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
#define DIRTY_FILL
Definition: ntgdihdl.h:145
#define COLORREF
Definition: msvc.h:35
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int ULONG
Definition: retypes.h:1
DWORD COLORREF
Definition: windef.h:313
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
COLORREF FASTCALL IntSetDCPenColor ( HDC  ,
COLORREF   
)

Definition at line 254 of file dcutil.c.

Referenced by IntDrawDiagEdge(), IntDrawMenuBarTemp(), IntDrawRectEdge(), MENU_DrawMenuItem(), NC_DoNCPaint(), and UserDrawCaptionBar().

255 {
256  COLORREF OldColor;
257  PDC dc;
258  if (!(dc = DC_LockDc(hdc)))
259  {
261  return CLR_INVALID;
262  }
263 
264  OldColor = (COLORREF)dc->pdcattr->ulPenClr;
265  dc->pdcattr->ulPenClr = (ULONG)crColor;
266 
267  if (dc->pdcattr->crPenClr != crColor)
268  {
269  dc->pdcattr->ulDirty_ |= DIRTY_LINE;
270  dc->pdcattr->crPenClr = crColor;
271  }
272  DC_UnlockDc(dc);
273  return OldColor;
274 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define CLR_INVALID
Definition: wingdi.h:881
HDC dc
Definition: cylfrac.c:34
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
#define COLORREF
Definition: msvc.h:35
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int ULONG
Definition: retypes.h:1
#define DIRTY_LINE
Definition: ntgdihdl.h:146
DWORD COLORREF
Definition: windef.h:313
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
BOOL FASTCALL IntSetDefaultRegion ( PDC  )

Definition at line 345 of file dcutil.c.

Referenced by MakeInfoDC().

346 {
348  PREGION prgn;
349  RECTL rclWnd, rclClip;
350 
351  IntGdiReleaseRaoRgn(pdc);
352 
353  rclWnd.left = 0;
354  rclWnd.top = 0;
355  rclWnd.right = pdc->dclevel.sizl.cx;
356  rclWnd.bottom = pdc->dclevel.sizl.cy;
357  rclClip = rclWnd;
358 
359  //EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
360  if (pdc->ppdev->flFlags & PDEV_META_DEVICE)
361  {
362  pSurface = pdc->dclevel.pSurface;
363  if (pSurface && pSurface->flags & PDEV_SURFACE)
364  {
365  rclClip.left += pdc->ppdev->ptlOrigion.x;
366  rclClip.top += pdc->ppdev->ptlOrigion.y;
367  rclClip.right += pdc->ppdev->ptlOrigion.x;
368  rclClip.bottom += pdc->ppdev->ptlOrigion.y;
369  }
370  }
371  //EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
372 
373  prgn = pdc->prgnVis;
374 
375  if (prgn && prgn != prgnDefault)
376  {
377  REGION_SetRectRgn( prgn,
378  rclClip.left,
379  rclClip.top,
380  rclClip.right ,
381  rclClip.bottom );
382  }
383  else
384  {
385  prgn = IntSysCreateRectpRgn( rclClip.left,
386  rclClip.top,
387  rclClip.right ,
388  rclClip.bottom );
389  pdc->prgnVis = prgn;
390  }
391 
392  if (prgn)
393  {
394  pdc->ptlDCOrig.x = 0;
395  pdc->ptlDCOrig.y = 0;
396  pdc->erclWindow = rclWnd;
397  pdc->erclClip = rclClip;
398  /* Might be an InitDC or DCE... */
399  pdc->ptlFillOrigin.x = pdc->dcattr.ptlBrushOrigin.x;
400  pdc->ptlFillOrigin.y = pdc->dcattr.ptlBrushOrigin.y;
401  return TRUE;
402  }
403 
404  pdc->prgnVis = prgnDefault;
405  return FALSE;
406 }
#define TRUE
Definition: types.h:120
long bottom
Definition: polytest.cpp:53
VOID FASTCALL IntGdiReleaseRaoRgn(PDC pDC)
Definition: cliprgn.c:16
long right
Definition: polytest.cpp:53
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2386
#define FALSE
Definition: types.h:117
long top
Definition: polytest.cpp:53
Definition: region.h:7
long left
Definition: polytest.cpp:53
PREGION prgnDefault
Definition: region.c:122
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
FLONG flags
Definition: surface.h:10
VOID FASTCALL REGION_SetRectRgn(PREGION rgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2644
VOID FASTCALL IntUpdateBoundsRect ( PDC  ,
PRECTL   
)

Definition at line 685 of file dcutil.c.

Referenced by AddPenLinesBounds(), GreExtTextOutW(), GreGradientFill(), GreStretchBltMask(), IntGdiBitBltRgn(), IntGdiFillRgn(), IntPatBlt(), IntRectangle(), NtGdiAlphaBlend(), NtGdiExtFloodFill(), NtGdiMaskBlt(), NtGdiSetDIBitsToDeviceInternal(), NtGdiSetPixel(), NtGdiStretchDIBitsInternal(), and NtGdiTransparentBlt().

686 {
687  if (pdc->fs & DC_ACCUM_APP)
688  {
689  RECTL_bUnionRect(&pdc->erclBoundsApp, &pdc->erclBoundsApp, pRect);
690  }
691  if (pdc->fs & DC_ACCUM_WMGR)
692  {
693  RECTL_bUnionRect(&pdc->erclBounds, &pdc->erclBounds, pRect);
694  }
695 }
BOOL FASTCALL RECTL_bUnionRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:18
VOID FASTCALL IntvGetDeviceCaps ( PPDEVOBJ  ,
PDEVCAPS   
)
ULONG TranslateCOLORREF ( PDC  pdc,
COLORREF  crColor 
)

Definition at line 860 of file dcutil.c.

Referenced by NtGdiGetNearestColor(), and NtGdiSetPixel().

861 {
862  PSURFACE psurfDC;
863  PPALETTE ppalDC;
864  ULONG index, ulColor, iBitmapFormat;
865  EXLATEOBJ exlo;
866 
867  /* Get the DC surface */
868  psurfDC = pdc->dclevel.pSurface;
869 
870  /* If no surface is selected, use the default bitmap */
871  if (!psurfDC)
872  psurfDC = psurfDefaultBitmap;
873 
874  /* Check what color type this is */
875  switch (crColor >> 24)
876  {
877  case 0x00: /* RGB color */
878  break;
879 
880  case 0x01: /* PALETTEINDEX */
881  index = crColor & 0xFFFFFF;
882  ppalDC = pdc->dclevel.ppal;
883  if (index >= ppalDC->NumColors) index = 0;
884 
885  /* Get the RGB value */
886  crColor = PALETTE_ulGetRGBColorFromIndex(ppalDC, index);
887  break;
888 
889  case 0x02: /* PALETTERGB */
890 
891  if (pdc->dclevel.hpal != StockObjects[DEFAULT_PALETTE])
892  {
893  /* First find the nearest index in the dc palette */
894  ppalDC = pdc->dclevel.ppal;
895  index = PALETTE_ulGetNearestIndex(ppalDC, crColor & 0xFFFFFF);
896 
897  /* Get the RGB value */
898  crColor = PALETTE_ulGetRGBColorFromIndex(ppalDC, index);
899  }
900  else
901  {
902  /* Use the pure color */
903  crColor = crColor & 0x00FFFFFF;
904  }
905  break;
906 
907  case 0x10: /* DIBINDEX */
908  /* Mask the value to match the target bpp */
909  iBitmapFormat = psurfDC->SurfObj.iBitmapFormat;
910  if (iBitmapFormat == BMF_1BPP) index = crColor & 0x1;
911  else if (iBitmapFormat == BMF_4BPP) index = crColor & 0xf;
912  else if (iBitmapFormat == BMF_8BPP) index = crColor & 0xFF;
913  else if (iBitmapFormat == BMF_16BPP) index = crColor & 0xFFFF;
914  else index = crColor & 0xFFFFFF;
915  return index;
916 
917  default:
918  DPRINT("Unsupported color type %u passed\n", crColor >> 24);
919  crColor &= 0xFFFFFF;
920  }
921 
922  /* Initialize an XLATEOBJ from RGB to the target surface */
923  EXLATEOBJ_vInitialize(&exlo, &gpalRGB, psurfDC->ppal, 0xFFFFFF, 0, 0);
924 
925  /* Translate the color to the target format */
926  ulColor = XLATEOBJ_iXlate(&exlo.xlo, crColor);
927 
928  /* Cleanup the XLATEOBJ */
929  EXLATEOBJ_vCleanup(&exlo);
930 
931  return ulColor;
932 }
_Notnull_ PSURFACE psurfDefaultBitmap
Definition: dclife.c:17
struct _PALETTE *const ppal
Definition: surface.h:11
ULONG iBitmapFormat
Definition: winddi.h:1215
Definition: xlate.c:9
XLATEOBJ xlo
Definition: xlateobj.h:21
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
HGDIOBJ StockObjects[]
Definition: stockobj.c:99
SURFOBJ SurfObj
Definition: surface.h:8
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649
#define BMF_16BPP
Definition: winddi.h:358
#define DEFAULT_PALETTE
Definition: wingdi.h:911
FORCEINLINE ULONG PALETTE_ulGetRGBColorFromIndex(PPALETTE ppal, ULONG ulIndex)
Definition: palette.h:142
Definition: xlate.c:8
ULONG NTAPI PALETTE_ulGetNearestIndex(PALETTE *ppal, ULONG ulColor)
Definition: palette.c:309
#define index(s, c)
Definition: various.h:29
ULONG NumColors
Definition: palette.h:41
Definition: xlate.c:10
unsigned int ULONG
Definition: retypes.h:1
PALETTE gpalRGB
Definition: palette.c:17
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664

Variable Documentation

PDC defaultDCstate

Definition at line 14 of file device.c.

Referenced by DC_InitHack(), and IntGdiCleanDC().

_Notnull_ PBRUSH pbrDefaultBrush

Definition at line 18 of file dclife.c.

Referenced by DC_vUpdateBackgroundBrush(), and DC_vUpdateTextBrush().

_Notnull_ PSURFACE psurfDefaultBitmap

Definition at line 17 of file dclife.c.

Referenced by EBRUSHOBJ_vInit(), IntCreateCompatibleBitmap(), and TranslateCOLORREF().