ReactOS 0.4.16-dev-88-ga65b6ae
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 _DCFLAGS DCFLAGS
 
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)
 
 CODE_SEG ("INIT") 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)
 
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

◆ ASSERT_DC_PREPARED

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

Definition at line 300 of file dc.h.

◆ DC_FL_PAL_BACK

#define DC_FL_PAL_BACK   1

Definition at line 15 of file dc.h.

Typedef Documentation

◆ DC

typedef struct _DC DC

◆ DCFLAGS

◆ DCLEVEL

◆ DCTYPE

typedef enum _DCTYPE DCTYPE

◆ PDCLEVEL

Enumeration Type Documentation

◆ _DCFLAGS

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} DCFLAGS;
enum _DCFLAGS DCFLAGS
@ DC_ACCUM_APP
Definition: dc.h:25
@ DC_IN_CLONEPDEV
Definition: dc.h:31
@ DC_PERMANANT
Definition: dc.h:22
@ DC_EPSPRINTINGESCAPE
Definition: dc.h:28
@ DC_FULLSCREEN
Definition: dc.h:30
@ DC_DIRTY_RAO
Definition: dc.h:23
@ DC_DISPLAY
Definition: dc.h:19
@ DC_SYNCHRONIZEACCESS
Definition: dc.h:27
@ DC_DIRECT
Definition: dc.h:20
@ DC_CANCELED
Definition: dc.h:21
@ DC_RESET
Definition: dc.h:26
@ DC_REDIRECTION
Definition: dc.h:32
@ DC_SHAREACCESS
Definition: dc.h:33
@ DC_TEMPINFODC
Definition: dc.h:29
@ DC_ACCUM_WMGR
Definition: dc.h:24

◆ _DCTYPE

Enumerator
DCTYPE_DIRECT 
DCTYPE_MEMORY 
DCTYPE_INFO 

Definition at line 39 of file dc.h.

40{
41 DCTYPE_DIRECT = 0, /* Normal device context */
42 DCTYPE_MEMORY = 1, /* Memory device context */
43 DCTYPE_INFO = 2, /* Information context */
44} DCTYPE;
@ DCTYPE_DIRECT
Definition: dc.h:41
@ DCTYPE_MEMORY
Definition: dc.h:42
@ DCTYPE_INFO
Definition: dc.h:43
enum _DCTYPE DCTYPE

◆ _FONT_STATE

Enumerator
DC_DIRTYFONT_XFORM 
DC_DIRTYFONT_LFONT 
DC_UFI_MAPPING 

Definition at line 7 of file dc.h.

8{
12};
@ DC_DIRTYFONT_XFORM
Definition: dc.h:9
@ DC_UFI_MAPPING
Definition: dc.h:11
@ DC_DIRTYFONT_LFONT
Definition: dc.h:10

Function Documentation

◆ CODE_SEG()

CODE_SEG ( "INIT"  )

Definition at line 1810 of file Interface.c.

1817{
1818 UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\FileSystem\\Filters\\"DRIVER_NAME);
1819 PDEVICE_OBJECT RawDeviceObject;
1821 PFILE_OBJECT RawFileObject;
1823 UNICODE_STRING SymLink;
1824
1826
1829
1830 /* Save the registry key for this driver */
1834 RegistryPath->MaximumLength,
1838
1839 /* Do some initialization */
1841
1842 /* Create the main filter manager device object */
1844 0,
1845 &DeviceName,
1848 FALSE,
1849 &DeviceObject);
1850 if (!NT_SUCCESS(Status))
1851 {
1852 DPRINT1("fltmgr IoCreateDevice failed. Status = %X\n", Status);
1853 goto Cleanup;
1854 }
1855
1856 /* Store a global reference so we can access from callbacks */
1858
1859 /* Generate the symbolic link name */
1860 RtlInitUnicodeString(&SymLink, L"\\??\\"DRIVER_NAME);
1862 if (!NT_SUCCESS(Status)) goto Cleanup;
1863
1864 /* Create the callbacks for the dispatch table, FastIo and FS callbacks */
1866 if (!NT_SUCCESS(Status)) goto Cleanup;
1867
1868 /* Initialize the comms objects */
1870 if (!NT_SUCCESS(Status)) goto Cleanup;
1871
1872 /* Register for notifications when a new file system is loaded. This also enumerates any existing file systems */
1874 FLT_ASSERT(Status != STATUS_DEVICE_ALREADY_ATTACHED); // Windows checks for this, I'm not sure how it can happen. Needs investigation??
1875 if (!NT_SUCCESS(Status)) goto Cleanup;
1876
1879
1880 /* IoRegisterFsRegistrationChange isn't notified about the raw file systems, so we attach to them manually */
1881 RtlInitUnicodeString(&ObjectName, L"\\Device\\RawDisk");
1884 &RawFileObject,
1885 &RawDeviceObject);
1886 if (NT_SUCCESS(Status))
1887 {
1888 FltpFsNotification(RawDeviceObject, TRUE);
1889 ObDereferenceObject(RawFileObject);
1890 }
1891
1892 RtlInitUnicodeString(&ObjectName, L"\\Device\\RawCdRom");
1895 &RawFileObject,
1896 &RawDeviceObject);
1897 if (NT_SUCCESS(Status))
1898 {
1899 FltpFsNotification(RawDeviceObject, TRUE);
1900 ObDereferenceObject(RawFileObject);
1901 }
1902
1903 /* We're done, clear the initializing flag */
1906
1907Cleanup:
1908
1909 if (!NT_SUCCESS(Status))
1910 {
1912 {
1913 DriverObject->FastIoDispatch = NULL;
1915 }
1916
1917 IoDeleteSymbolicLink(&SymLink);
1918
1919 if (DeviceObject)
1921
1924 }
1925
1926 return Status;
1927}
LIST_ENTRY FilterList
Definition: Filter.c:24
DRIVER_FS_NOTIFICATION FltpFsNotification
Definition: Interface.c:1699
ERESOURCE FilterListLock
Definition: Filter.c:25
static NTSTATUS SetupDispatchAndCallbacksTables(_In_ PDRIVER_OBJECT DriverObject)
Definition: Interface.c:1739
DRIVER_DATA DriverData
Definition: Interface.c:35
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static const WCHAR Cleanup[]
Definition: register.c:80
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ClearFlag(_F, _SF)
Definition: ext2fs.h:191
#define DRIVER_NAME
Definition: ext2fs.h:136
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49
#define FM_TAG_REGISTRY_DATA
Definition: fltmgr.h:18
#define FM_TAG_DISPATCH_TABLE
Definition: fltmgr.h:17
NTSTATUS FltpSetupCommunicationObjects(_In_ PDRIVER_OBJECT DriverObject)
Definition: Messaging.c:377
Status
Definition: gdiplustypes.h:25
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1435
NTSTATUS NTAPI IoRegisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine)
Definition: volume.c:1089
#define STATUS_DEVICE_ALREADY_ATTACHED
Definition: ntstatus.h:292
#define L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:53
#define STATUS_SUCCESS
Definition: shellext.h:65
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
UNICODE_STRING ServiceKey
Definition: fltmgr.h:33
PFAST_IO_DISPATCH FastIoDispatch
Definition: fltmgr.h:37
FAST_MUTEX FilterAttachLock
Definition: fltmgr.h:39
PDEVICE_OBJECT DeviceObject
Definition: fltmgr.h:32
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint16_t * PWCHAR
Definition: typedefs.h:56
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:64
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
* PFILE_OBJECT
Definition: iotypes.h:1998
#define ObDereferenceObject
Definition: obfuncs.h:203

◆ DC_AllocDcWithHandle()

PDC NTAPI DC_AllocDcWithHandle ( GDILOOBJTYPE  eDcObjType)

Definition at line 69 of file dclife.c.

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}
#define UlongToHandle(ul)
Definition: basetsd.h:97
@ GDILoObjType_LO_DC_TYPE
Definition: gdi_private.h:34
@ GDILoObjType_LO_ALTDC_TYPE
Definition: gdi_private.h:43
@ BASEFLAG_LOOKASIDE
Definition: gdiobj.h:58
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
@ GDIObjType_DC_TYPE
Definition: ntgdityp.h:121
struct DC * PDC
Definition: polytest.cpp:41
VOID NTAPI GDIOBJ_vFreeObject(POBJ pobj)
Definition: gdiobj.c:596
HGDIOBJ NTAPI GDIOBJ_hInsertObject(POBJ pobj, ULONG ulOwner)
Definition: gdiobj.c:912
POBJ NTAPI GDIOBJ_AllocateObject(UCHAR objt, ULONG cjSize, FLONG fl)
Definition: gdiobj.c:562
#define NT_ASSERT
Definition: rtlfuncs.h:3324

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

◆ DC_bAllocDcAttr()

BOOL NTAPI DC_bAllocDcAttr ( PDC  pdc)

Definition at line 31 of file dcattr.c.

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}
PVOID NTAPI GdiPoolAllocate(PGDI_POOL pPool)
Definition: gdipool.c:122
#define ASSERT(a)
Definition: mode.c:44
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
#define DPRINT
Definition: sndvol32.h:73
struct _GDI_POOL * pPoolDcAttr
Definition: win32.h:291
VOID NTAPI GDIOBJ_vSetObjectAttr(POBJ pobj, PVOID pvObjAttr)
Definition: gdiobj.c:1096

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

◆ DC_hSelectFont()

HFONT NTAPI DC_hSelectFont ( _In_ PDC  pdc,
_In_ HFONT  hlfntNew 
)

Definition at line 550 of file dcobjs.c.

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}
NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj)
Definition: freetype.c:5906
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define DIRTY_CHARSET
Definition: ntgdihdl.h:127
Definition: text.h:60
#define LFONT_ShareLockFont(hfont)
Definition: text.h:77
#define LFONT_ShareUnlockFont(plfnt)
Definition: text.h:78

Referenced by GdiFlushUserBatch(), and NtGdiSelectFont().

◆ DC_InvertXform()

BOOL FASTCALL DC_InvertXform ( const XFORM xformSrc,
XFORM xformDest 
)

◆ DC_LockDc()

FORCEINLINE PDC DC_LockDc ( HDC  hdc)

Definition at line 220 of file dc.h.

221{
222 PDC pdc;
223
225 if (pdc)
226 {
227 ASSERT((GDI_HANDLE_GET_TYPE(pdc->BaseObject.hHmgr) == GDILoObjType_LO_DC_TYPE) ||
228 (GDI_HANDLE_GET_TYPE(pdc->BaseObject.hHmgr) == GDILoObjType_LO_ALTDC_TYPE));
229 ASSERT(pdc->dclevel.plfnt != NULL);
230 ASSERT(GDI_HANDLE_GET_TYPE(((POBJ)pdc->dclevel.plfnt)->hHmgr) == GDILoObjType_LO_FONT_TYPE);
231 }
232
233 return pdc;
234}
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
@ GDILoObjType_LO_FONT_TYPE
Definition: gdi_private.h:37
HDC hdc
Definition: main.c:9
PGDIOBJ NTAPI GDIOBJ_LockObject(HGDIOBJ hobj, UCHAR objt)
Definition: gdiobj.c:826

Referenced by _Success_(), DC_vRestoreDC(), DceResetActiveDCEs(), DCU_SetDcUndeletable(), DxEngGetDCState(), DxEngLockDC(), DxEngSetDCState(), ftGdiGetTextMetricsW(), GdiPolyDraw(), 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(), 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(), 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().

◆ DC_UnlockDc()

FORCEINLINE VOID DC_UnlockDc ( PDC  pdc)

Definition at line 238 of file dc.h.

239{
240 ASSERT(pdc->dclevel.plfnt != NULL);
241 ASSERT(GDI_HANDLE_GET_TYPE(((POBJ)pdc->dclevel.plfnt)->hHmgr) == GDILoObjType_LO_FONT_TYPE);
242
243 GDIOBJ_vUnlockObject(&pdc->BaseObject);
244}
VOID NTAPI GDIOBJ_vUnlockObject(POBJ pobj)
Definition: gdiobj.c:880

Referenced by _Success_(), DC_vRestoreDC(), DceResetActiveDCEs(), DCU_SetDcUndeletable(), DxEngGetDCState(), DxEngSetDCState(), DxEngUnlockDC(), ftGdiGetTextMetricsW(), GdiPolyDraw(), 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(), 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(), 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().

◆ DC_vCleanup()

VOID NTAPI DC_vCleanup ( PVOID  ObjectBody)

Definition at line 357 of file dclife.c.

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 */
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}
FORCEINLINE VOID DC_vSelectSurface(PDC pdc, PSURFACE psurfNew)
Definition: dc.h:248
FORCEINLINE VOID DC_vSelectPalette(PDC pdc, PPALETTE ppal)
Definition: dc.h:287
VOID NTAPI DC_vFreeDcAttr(PDC pdc)
Definition: dcattr.c:59
VOID NTAPI DC_vRestoreDC(IN PDC pdc, INT iSaveLevel)
Definition: dcstate.c:138
FORCEINLINE VOID DC_vSelectLineBrush(PDC pdc, PBRUSH pbrLine)
Definition: dc.h:275
FORCEINLINE VOID DC_vSelectFillBrush(PDC pdc, PBRUSH pbrFill)
Definition: dc.h:263
VOID NTAPI EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
Definition: engbrush.c:153
VOID NTAPI PDEVOBJ_vRelease(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:105
VOID FASTCALL IntEngFreeClipResources(XCLIPOBJ *Clip)
Definition: clip.c:164
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
VOID FASTCALL REGION_Delete(PREGION pRgn)
Definition: region.c:2449

◆ DC_vCopyState()

VOID FASTCALL DC_vCopyState ( PDC  pdcSrc,
PDC  pdcDst,
BOOL  To 
)
Todo:
should aways be != NULL

Definition at line 16 of file dcstate.c.

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 /* The only way to reset the Meta Region to its original state is to return to a previously saved version of the DC with SaveDC. */
61 if (pdcSrc->dclevel.prgnMeta)
62 {
63 pdcDst->dclevel.prgnMeta = IntSysCreateRectpRgn(0, 0, 0, 0);
64 IntGdiCombineRgn(pdcDst->dclevel.prgnMeta, pdcSrc->dclevel.prgnMeta, NULL, RGN_COPY);
65 }
66 pdcDst->fs |= DC_DIRTY_RAO;
67 }
68}
INT FASTCALL IntGdiExtSelectClipRgn(PDC dc, PREGION prgn, int fnMode)
#define DC_ICM_NOT_CALIBRATED
Definition: ntgdihdl.h:140
#define DIRTY_FILL
Definition: ntgdihdl.h:123
#define DC_ICM_NOT_SET
Definition: ntgdihdl.h:143
#define DIRTY_TEXT
Definition: ntgdihdl.h:125
#define DIRTY_LINE
Definition: ntgdihdl.h:124
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:126
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:734
PREGION FASTCALL IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2407
INT FASTCALL IntGdiCombineRgn(PREGION prgnDest, PREGION prgnSrc1, PREGION prgnSrc2, INT iCombineMode)
Definition: region.c:2487
#define RGN_COPY
Definition: wingdi.h:357

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

◆ DC_vFinishBlit()

VOID FASTCALL DC_vFinishBlit ( PDC  pdc1,
PDC  pdc2 
)

Definition at line 614 of file dclife.c.

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}
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
_Requires_lock_held_ ppdev BOOL NTAPI MouseSafetyOnDrawEnd(_Inout_ PPDEVOBJ ppdev)
Definition: mouse.c:102

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

◆ DC_vFreeDcAttr()

VOID NTAPI DC_vFreeDcAttr ( PDC  pdc)

Definition at line 59 of file dcattr.c.

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}
VOID NTAPI GdiPoolFree(PGDI_POOL pPool, PVOID pvAlloc)
Definition: gdipool.c:233

Referenced by DC_vCleanup(), and DC_vSetOwner().

◆ DC_vInitDc()

VOID NTAPI DC_vInitDc ( PDC  pdc,
DCTYPE  dctype,
PPDEVOBJ  ppdev 
)

Definition at line 129 of file dclife.c.

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 == gpmdev->ppdevGlobal)
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}
#define ALTERNATE
Definition: constants.h:278
VOID FASTCALL UpdateVisRgn(PDC pdc)
Definition: cliprgn.c:41
#define DIRTY_DEFAULT
Definition: dclife.c:15
PBRUSH pbrDefaultBrush
Definition: dclife.c:18
const MATRIX gmxWorldToPageDefault
Definition: dclife.c:36
#define gmxDeviceToWorldDefault
Definition: dclife.c:46
#define gmxWorldToDeviceDefault
Definition: dclife.c:45
#define RGB(r, g, b)
Definition: precomp.h:71
VOID NTAPI EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:112
static const FLOATOBJ gef16
Definition: floatobj.h:116
static const FLOATOBJ gef0
Definition: floatobj.h:113
#define BRUSH_ShareLockBrush(hBrush)
Definition: brush.h:117
PMDEVOBJ gpmdev
Definition: mdevobj.c:14
#define PAGE_TO_DEVICE_SCALE_IDENTITY
Definition: ntgdihdl.h:185
#define DC_PRIMARY_DISPLAY
Definition: ntgdihdl.h:139
#define PAGE_TO_DEVICE_IDENTITY
Definition: ntgdihdl.h:184
#define WORLD_TO_PAGE_IDENTITY
Definition: ntgdihdl.h:175
PSURFACE NTAPI PDEVOBJ_pSurface(PPDEVOBJ ppdev)
Definition: pdevobj.c:311
FLONG flGraphicsCaps
Definition: winddi.h:390
FLONG flGraphicsCaps2
Definition: winddi.h:399
ULONG ulVertSize
Definition: winddi.h:881
ULONG ulVertRes
Definition: winddi.h:883
ULONG ulHorzSize
Definition: winddi.h:880
ULONG ulHorzRes
Definition: winddi.h:882
PPDEVOBJ ppdevGlobal
Definition: mdevobj.h:16
GDIINFO gdiinfo
Definition: pdevobj.h:123
DHPDEV dhpdev
Definition: pdevobj.h:120
DEVINFO devinfo
Definition: pdevobj.h:122
HSEMAPHORE hsemDevLock
Definition: pdevobj.h:89
XCLIPOBJ gxcoTrivial
Definition: bitblt.c:20
VOID FASTCALL IntEngInitClipObj(XCLIPOBJ *Clip)
Definition: clip.c:158
HGDIOBJ StockObjects[]
Definition: stockobj.c:100
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
PBRUSH FASTCALL PEN_ShareLockPen(HPEN hobj)
Definition: pen.c:61
#define GM_COMPATIBLE
Definition: wingdi.h:864
#define DEFAULT_PALETTE
Definition: wingdi.h:913
#define CLR_INVALID
Definition: wingdi.h:883
#define WHITE_BRUSH
Definition: wingdi.h:902
#define BLACK_PEN
Definition: wingdi.h:903
#define MM_TEXT
Definition: wingdi.h:873
#define SYSTEM_FONT
Definition: wingdi.h:911
#define R2_COPYPEN
Definition: wingdi.h:339

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

◆ DC_vPrepareDCsForBlit()

VOID FASTCALL DC_vPrepareDCsForBlit ( PDC  pdcDest,
const RECT rcDest,
PDC  pdcSrc,
const RECT rcSrc 
)

Definition at line 505 of file dclife.c.

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_DIRTY_RAO)
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}
VOID FASTCALL CLIPPING_UpdateGCRegion(PDC pDC)
Definition: cliprgn.c:741
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
static void DC_vUpdateDC(PDC pdc)
Definition: dclife.c:475
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:136
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:135
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
uint32_t ULONG_PTR
Definition: typedefs.h:65
_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)

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

◆ DC_vRestoreDC()

VOID NTAPI DC_vRestoreDC ( IN PDC  pdc,
INT  iSaveLevel 
)

Definition at line 138 of file dcstate.c.

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

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

◆ DC_vSelectFillBrush()

FORCEINLINE VOID DC_vSelectFillBrush ( PDC  pdc,
PBRUSH  pbrFill 
)

Definition at line 263 of file dc.h.

264{
265 PBRUSH pbrFillOld = pdc->dclevel.pbrFill;
266 if (pbrFillOld)
267 BRUSH_ShareUnlockBrush(pbrFillOld);
268 if (pbrFill)
270 pdc->dclevel.pbrFill = pbrFill;
271}
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:118
Definition: types.h:101

Referenced by DC_vCleanup(), and DC_vCopyState().

◆ DC_vSelectLineBrush()

FORCEINLINE VOID DC_vSelectLineBrush ( PDC  pdc,
PBRUSH  pbrLine 
)

Definition at line 275 of file dc.h.

276{
277 PBRUSH pbrLineOld = pdc->dclevel.pbrLine;
278 if (pbrLineOld)
279 BRUSH_ShareUnlockBrush(pbrLineOld);
280 if (pbrLine)
282 pdc->dclevel.pbrLine = pbrLine;
283}

Referenced by DC_vCleanup(), and DC_vCopyState().

◆ DC_vSelectPalette()

FORCEINLINE VOID DC_vSelectPalette ( PDC  pdc,
PPALETTE  ppal 
)

Definition at line 287 of file dc.h.

288{
289 PPALETTE ppalOld = pdc->dclevel.ppal;
290 if (ppalOld)
292 if (ppal)
294 pdc->dclevel.ppal = ppal;
295}
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59

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

◆ DC_vSelectSurface()

FORCEINLINE VOID DC_vSelectSurface ( PDC  pdc,
PSURFACE  psurfNew 
)

Definition at line 248 of file dc.h.

249{
250 PSURFACE psurfOld = pdc->dclevel.pSurface;
251 if (psurfOld)
252 {
253 psurfOld->hdc = NULL;
255 }
256 if (psurfNew)
258 pdc->dclevel.pSurface = psurfNew;
259}
HDC hdc
Definition: surface.h:26

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

◆ DC_vSetBrushOrigin()

VOID NTAPI DC_vSetBrushOrigin ( PDC  pdc,
LONG  x,
LONG  y 
)

Definition at line 142 of file dcobjs.c.

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}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by GdiFlushUserBatch(), and GreSetBrushOrg().

◆ DC_vUpdateBackgroundBrush()

VOID FASTCALL DC_vUpdateBackgroundBrush ( PDC  pdc)

Definition at line 126 of file dcobjs.c.

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}
_Notnull_ PBRUSH pbrDefaultBrush
Definition: dclife.c:18
VOID NTAPI EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
Definition: engbrush.c:194
VOID FASTCALL EBRUSHOBJ_vSetSolidRGBColor(EBRUSHOBJ *pebo, COLORREF crColor)
Definition: engbrush.c:122
COLORREF crBackgroundClr
Definition: ntgdihdl.h:297
ULONG ulDirty_
Definition: ntgdihdl.h:294

Referenced by GdiFlushUserBatch(), IntExtTextOutW(), and IntGdiCleanDC().

◆ DC_vUpdateFillBrush()

VOID FASTCALL DC_vUpdateFillBrush ( PDC  pdc)

Definition at line 16 of file dcobjs.c.

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}
HANDLE hbrush
Definition: ntgdihdl.h:295
COLORREF crBrushClr
Definition: ntgdihdl.h:301

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

◆ DC_vUpdateLineBrush()

VOID FASTCALL DC_vUpdateLineBrush ( PDC  pdc)

Definition at line 62 of file dcobjs.c.

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}
HANDLE hpen
Definition: ntgdihdl.h:296
COLORREF crPenClr
Definition: ntgdihdl.h:303

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

◆ DC_vUpdateTextBrush()

VOID FASTCALL DC_vUpdateTextBrush ( PDC  pdc)

Definition at line 108 of file dcobjs.c.

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}
COLORREF crForegroundClr
Definition: ntgdihdl.h:299

Referenced by DC_vPrepareDCsForBlit(), GdiFlushUserBatch(), IntExtTextOutW(), IntGdiCleanDC(), and IntGdiSetTextColor().

◆ DC_vUpdateViewportExt()

VOID FASTCALL DC_vUpdateViewportExt ( PDC  pdc)

◆ DCU_SetDcUndeletable()

VOID FASTCALL DCU_SetDcUndeletable ( HDC  hDC)

Definition at line 322 of file dcutil.c.

323{
324 PDC dc = DC_LockDc(hDC);
325 if (!dc)
326 {
328 return;
329 }
330
331 dc->fs |= DC_PERMANANT;
333 return;
334}
static HDC hDC
Definition: 3dtext.c:33
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
static const WCHAR dc[]
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22

Referenced by DceAllocDCE().

◆ GdiSelectPalette()

HPALETTE NTAPI GdiSelectPalette ( _In_ HDC  hDC,
_In_ HPALETTE  hpal,
_In_ BOOL  ForceBackground 
)

◆ GreCreateCompatibleDC()

HDC APIENTRY GreCreateCompatibleDC ( HDC  hdc,
BOOL  bAltDc 
)

Definition at line 817 of file dclife.c.

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;
839 PDEVOBJ_vReference(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 */
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}
BOOL NTAPI DC_bAllocDcAttr(PDC pdc)
Definition: dcattr.c:31
PDC NTAPI DC_AllocDcWithHandle(GDILOOBJTYPE eDcObjType)
Definition: dclife.c:69
VOID NTAPI DC_vInitDc(PDC pdc, DCTYPE dctype, PPDEVOBJ ppdev)
Definition: dclife.c:129
void DC_InitHack(PDC pdc)
Definition: dclife.c:104
enum GDILoObjType GDILOOBJTYPE
PPDEVOBJ NTAPI EngpGetPDEV(_In_opt_ PUNICODE_STRING pustrDeviceName)
Definition: pdevobj.c:815
FORCEINLINE VOID PDEVOBJ_vReference(_In_ PPDEVOBJ ppdev)
Definition: pdevobj.h:160

Referenced by NtGdiCreateCompatibleDC(), and NtGdiCreateMetafileDC().

◆ GreGetBkColor()

COLORREF FASTCALL GreGetBkColor ( HDC  hdc)

Definition at line 50 of file dcutil.c.

51{
52 PDC dc;
53 COLORREF crBk;
54 if (!(dc = DC_LockDc(hdc)))
55 {
57 return CLR_INVALID;
58 }
59 crBk = dc->pdcattr->ulBackgroundClr;
61 return crBk;
62}
DWORD COLORREF
Definition: windef.h:300

Referenced by MENU_DrawMenuItem().

◆ GreGetBkMode()

int FASTCALL GreGetBkMode ( HDC  hdc)

Definition at line 35 of file dcutil.c.

36{
37 PDC dc;
38 LONG lBkMode;
39 if (!(dc = DC_LockDc(hdc)))
40 {
42 return CLR_INVALID;
43 }
44 lBkMode = dc->pdcattr->lBkMode;
46 return lBkMode;
47}
long LONG
Definition: pedump.c:60

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

◆ GreGetGraphicsMode()

int FASTCALL GreGetGraphicsMode ( HDC  hdc)

Definition at line 306 of file dcutil.c.

307{
308 PDC dc;
309 int GraphicsMode;
310 if (!(dc = DC_LockDc(hdc)))
311 {
313 return CLR_INVALID;
314 }
315 GraphicsMode = dc->pdcattr->iGraphicsMode;
317 return GraphicsMode;
318}

Referenced by DrawTextExWorker().

◆ GreGetMapMode()

int FASTCALL GreGetMapMode ( HDC  hdc)

Definition at line 65 of file dcutil.c.

66{
67 PDC dc;
68 INT iMapMode;
69 if (!(dc = DC_LockDc(hdc)))
70 {
72 return CLR_INVALID;
73 }
74 iMapMode = dc->pdcattr->iMapMode;
76 return iMapMode;
77}
int32_t INT
Definition: typedefs.h:58

Referenced by DrawFrameControl().

◆ GreGetTextColor()

COLORREF FASTCALL GreGetTextColor ( HDC  hdc)

Definition at line 80 of file dcutil.c.

81{
82 PDC dc;
83 ULONG ulForegroundClr;
84 if (!(dc = DC_LockDc(hdc)))
85 {
87 return CLR_INVALID;
88 }
89 ulForegroundClr = dc->pdcattr->ulForegroundClr;
91 return ulForegroundClr;
92}
uint32_t ULONG
Definition: typedefs.h:59

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

◆ GreSetBrushOrg()

BOOL FASTCALL GreSetBrushOrg ( HDC  hdc,
INT  x,
INT  y,
LPPOINT  pptOut 
)

Definition at line 231 of file dcutil.c.

236{
237 PDC pdc = DC_LockDc(hdc);
238 if (pdc == NULL)
239 {
241 return FALSE;
242 }
243
244 if (pptOut != NULL)
245 {
246 *pptOut = pdc->pdcattr->ptlBrushOrigin;
247 }
248
249 pdc->pdcattr->ptlBrushOrigin.x = x;
250 pdc->pdcattr->ptlBrushOrigin.y = y;
251
252 DC_vSetBrushOrigin(pdc, x, y);
253
254 DC_UnlockDc(pdc);
255 return TRUE;
256}
VOID NTAPI DC_vSetBrushOrigin(PDC pdc, LONG x, LONG y)
Definition: dcobjs.c:142
_In_ UINT _Out_ PPOINTL pptOut
Definition: ntgdi.h:2198

Referenced by _Success_(), and IntFillWindow().

◆ GreSetDCOwner()

BOOL NTAPI GreSetDCOwner ( HDC  hdc,
ULONG  ulOwner 
)

Definition at line 455 of file dclife.c.

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}
VOID NTAPI DC_vSetOwner(PDC pdc, ULONG ulOwner)
Definition: dclife.c:414

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

◆ GreSetStretchBltMode()

int FASTCALL GreSetStretchBltMode ( HDC  hdc,
int  iStretchMode 
)

Definition at line 283 of file dcutil.c.

284{
285 PDC pdc;
286 PDC_ATTR pdcattr;
287 INT oSMode = 0;
288
289 pdc = DC_LockDc(hDC);
290 if (pdc)
291 {
292 pdcattr = pdc->pdcattr;
293 oSMode = pdcattr->lStretchBltMode;
294 pdcattr->lStretchBltMode = iStretchMode;
295
296 // Wine returns an error here. We set the default.
297 if ((iStretchMode <= 0) || (iStretchMode > MAXSTRETCHBLTMODE)) iStretchMode = WHITEONBLACK;
298
299 pdcattr->jStretchBltMode = iStretchMode;
300 DC_UnlockDc(pdc);
301 }
302 return oSMode;
303}
LONG lStretchBltMode
Definition: ntgdihdl.h:315
BYTE jStretchBltMode
Definition: ntgdihdl.h:310
#define WHITEONBLACK
Definition: wingdi.h:953
#define MAXSTRETCHBLTMODE
Definition: wingdi.h:956

◆ IntEnumHDev()

PPDEVOBJ FASTCALL IntEnumHDev ( VOID  )

Definition at line 38 of file device.c.

39{
40// I guess we will soon have more than one primary surface.
41// This will do for now.
42 return gpmdev->ppdevGlobal;
43}

◆ IntGdiCleanDC()

BOOL FASTCALL IntGdiCleanDC ( HDC  hDC)

Definition at line 73 of file dcstate.c.

74{
75 PDC dc;
76 if (!hDC) return FALSE;
77 dc = DC_LockDc(hDC);
78 if (!dc) return FALSE;
79 // Clean the DC
81 {
83 /* Update the brushes now, because they reference some objects (the DC palette)
84 * Which belong to the current process, and this DC might be used for another process
85 * after being cleaned up (for GetDC(0) for instance) */
90 }
91
92 // Remove Path and reset flags.
93 if (dc->dclevel.hPath)
94 {
95 DPRINT("Clean DC Remove Path\n");
96 if (!PATH_Delete(dc->dclevel.hPath))
97 {
98 DPRINT1("Failed to remove Path\n");
99 }
100 dc->dclevel.hPath = 0;
101 dc->dclevel.flPath = 0;
102 }
103
104 /* DC_vCopyState frees the Clip rgn and the Meta rgn. Take care of the other ones
105 * There is no need to clear prgnVis, as UserGetDC updates it immediately. */
106 if (dc->prgnRao)
107 REGION_Delete(dc->prgnRao);
108 if (dc->prgnAPI)
109 REGION_Delete(dc->prgnAPI);
110 dc->prgnRao = dc->prgnAPI = NULL;
111
112 dc->fs |= DC_DIRTY_RAO;
113
115
116 return TRUE;
117}
VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc)
Definition: dcobjs.c:126
PDC defaultDCstate
Definition: device.c:14

Referenced by DceReleaseDC(), and DxEngCleanDC().

◆ IntGdiCreateDisplayDC()

HDC FASTCALL IntGdiCreateDisplayDC ( HDEV  hDev,
ULONG  DcType,
BOOL  EmptyDC 
)

Definition at line 1063 of file dclife.c.

1064{
1065 HDC hDC;
1067
1068 if (DcType == DCTYPE_MEMORY)
1069 hDC = NtGdiCreateCompatibleDC(NULL); // OH~ Yuck! I think I taste vomit in my mouth!
1070 else
1071 hDC = IntGdiCreateDC(NULL, NULL, NULL, NULL, (DcType == DCTYPE_INFO));
1072
1073 return hDC;
1074}
#define UNIMPLEMENTED
Definition: debug.h:118
HDC FASTCALL IntGdiCreateDC(PUNICODE_STRING Driver, PUNICODE_STRING pustrDevice, PVOID pUMdhpdev, CONST PDEVMODEW pdmInit, BOOL CreateAsIC)
Definition: dclife.c:1040
HDC APIENTRY NtGdiCreateCompatibleDC(HDC hdc)
Definition: dclife.c:884

Referenced by DxEngCreateMemoryDC(), and UserGetDesktopDC().

◆ IntGdiDeleteDC()

BOOL FASTCALL IntGdiDeleteDC ( HDC  hDC,
BOOL  Force 
)

Definition at line 892 of file dclife.c.

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_PERMANANT)
909 {
910 DC_UnlockDc(DCToDelete);
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
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}
_Inout_ PVCB _In_ BOOLEAN Force
Definition: cdprocs.h:1417
BOOL FASTCALL IntGdiDeleteDC(HDC hDC, BOOL Force)
Definition: dclife.c:892
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1146

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

◆ IntGdiSetBkColor()

◆ IntGdiSetBkMode()

INT FASTCALL IntGdiSetBkMode ( HDC  hDC,
INT  backgroundMode 
)

Definition at line 124 of file dcutil.c.

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;
140 return oldMode;
141}
_In_ ULONG Mode
Definition: hubbusif.h:303
LONG lBkMode
Definition: ntgdihdl.h:313
BYTE jBkMode
Definition: ntgdihdl.h:308

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

◆ IntGdiSetTextAlign()

UINT FASTCALL IntGdiSetTextAlign ( HDC  hDC,
UINT  Mode 
)

Definition at line 145 of file dcutil.c.

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 if (pdcattr->dwLayout & LAYOUT_RTL)
162 {
163 if ((Mode & TA_CENTER) != TA_CENTER) Mode ^= TA_RIGHT;
164 }
165 pdcattr->flTextAlign = Mode & TA_MASK;
167 return prevAlign;
168}
unsigned int UINT
Definition: ndis.h:50
DWORD dwLayout
Definition: ntgdihdl.h:339
LONG lTextAlign
Definition: ntgdihdl.h:325
FLONG flTextAlign
Definition: ntgdihdl.h:324
#define TA_RIGHT
Definition: wingdi.h:933
#define LAYOUT_RTL
Definition: wingdi.h:1371
#define TA_MASK
Definition: wingdi.h:937
#define GDI_ERROR
Definition: wingdi.h:1309
#define TA_CENTER
Definition: wingdi.h:931

Referenced by IntPaintDesktop().

◆ IntGdiSetTextColor()

COLORREF FASTCALL IntGdiSetTextColor ( HDC  hDC,
COLORREF  color 
)

Definition at line 172 of file dcutil.c.

174{
175 COLORREF crOldColor;
176 PDC pdc;
177 PDC_ATTR pdcattr;
178
179 pdc = DC_LockDc(hDC);
180 if (!pdc)
181 {
183 return CLR_INVALID;
184 }
185 pdcattr = pdc->pdcattr;
186
187 crOldColor = (COLORREF) pdcattr->ulForegroundClr;
188 pdcattr->ulForegroundClr = (ULONG)color;
189
190 if (pdcattr->crForegroundClr != color)
191 {
193 pdcattr->crForegroundClr = color;
194 }
195
199
200 DC_UnlockDc(pdc);
201
202 return crOldColor;
203}
GLuint color
Definition: glext.h:6243
ULONG ulForegroundClr
Definition: ntgdihdl.h:300

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

◆ IntSetDCBrushColor()

COLORREF FASTCALL IntSetDCBrushColor ( HDC  hdc,
COLORREF  crColor 
)

Definition at line 206 of file dcutil.c.

207{
208 COLORREF OldColor = CLR_INVALID;
209 PDC dc;
210 if (!(dc = DC_LockDc(hdc)))
211 {
213 return CLR_INVALID;
214 }
215 else
216 {
217 OldColor = (COLORREF) dc->pdcattr->ulBrushClr;
218 dc->pdcattr->ulBrushClr = (ULONG) crColor;
219
220 if ( dc->pdcattr->crBrushClr != crColor )
221 {
222 dc->pdcattr->ulDirty_ |= DIRTY_FILL;
223 dc->pdcattr->crBrushClr = crColor;
224 }
225 }
227 return OldColor;
228}

Referenced by IntDrawDiagEdge().

◆ IntSetDCPenColor()

COLORREF FASTCALL IntSetDCPenColor ( HDC  hdc,
COLORREF  crColor 
)

Definition at line 259 of file dcutil.c.

260{
261 COLORREF OldColor;
262 PDC dc;
263 if (!(dc = DC_LockDc(hdc)))
264 {
266 return CLR_INVALID;
267 }
268
269 OldColor = (COLORREF)dc->pdcattr->ulPenClr;
270 dc->pdcattr->ulPenClr = (ULONG)crColor;
271
272 if (dc->pdcattr->crPenClr != crColor)
273 {
274 dc->pdcattr->ulDirty_ |= DIRTY_LINE;
275 dc->pdcattr->crPenClr = crColor;
276 }
278 return OldColor;
279}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101

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

◆ IntSetDefaultRegion()

BOOL FASTCALL IntSetDefaultRegion ( PDC  pdc)

Definition at line 350 of file dcutil.c.

351{
353 PREGION prgn;
354 RECTL rclWnd, rclClip;
355
357
358 rclWnd.left = 0;
359 rclWnd.top = 0;
360 rclWnd.right = pdc->dclevel.sizl.cx;
361 rclWnd.bottom = pdc->dclevel.sizl.cy;
362 rclClip = rclWnd;
363
364 //EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
365 if (pdc->ppdev->flFlags & PDEV_META_DEVICE)
366 {
367 pSurface = pdc->dclevel.pSurface;
368 if (pSurface && pSurface->flags & PDEV_SURFACE)
369 {
370 rclClip.left += pdc->ppdev->ptlOrigion.x;
371 rclClip.top += pdc->ppdev->ptlOrigion.y;
372 rclClip.right += pdc->ppdev->ptlOrigion.x;
373 rclClip.bottom += pdc->ppdev->ptlOrigion.y;
374 }
375 }
376 //EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
377
378 prgn = pdc->prgnVis;
379
380 if (prgn && prgn != prgnDefault)
381 {
382 REGION_SetRectRgn( prgn,
383 rclClip.left,
384 rclClip.top,
385 rclClip.right ,
386 rclClip.bottom );
387 }
388 else
389 {
390 prgn = IntSysCreateRectpRgn( rclClip.left,
391 rclClip.top,
392 rclClip.right ,
393 rclClip.bottom );
394 pdc->prgnVis = prgn;
395 }
396
397 if (prgn)
398 {
399 pdc->ptlDCOrig.x = 0;
400 pdc->ptlDCOrig.y = 0;
401 pdc->erclWindow = rclWnd;
402 pdc->erclClip = rclClip;
403 /* Might be an InitDC or DCE... */
404 pdc->ptlFillOrigin = pdc->dcattr.ptlBrushOrigin;
405 return TRUE;
406 }
407 // No Vis use the Default System Region.
408 pdc->prgnVis = prgnDefault;
409 return FALSE;
410}
VOID FASTCALL IntGdiReleaseRaoRgn(PDC pDC)
Definition: cliprgn.c:18
@ PDEV_META_DEVICE
Definition: pdevobj.h:20
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
Definition: region.h:8
@ PDEV_SURFACE
Definition: surface.h:81
PREGION prgnDefault
Definition: region.c:129
VOID FASTCALL REGION_SetRectRgn(PREGION rgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2665
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481

Referenced by GdiSelectVisRgn(), and MakeInfoDC().

◆ IntUpdateBoundsRect()

VOID FASTCALL IntUpdateBoundsRect ( PDC  pdc,
PRECTL  pRect 
)

Definition at line 694 of file dcutil.c.

695{
696 if (pdc->fs & DC_ACCUM_APP)
697 {
698 RECTL_bUnionRect(&pdc->erclBoundsApp, &pdc->erclBoundsApp, pRect);
699 }
700 if (pdc->fs & DC_ACCUM_WMGR)
701 {
702 RECTL_bUnionRect(&pdc->erclBounds, &pdc->erclBounds, pRect);
703 }
704}
BOOL FASTCALL RECTL_bUnionRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:18

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

◆ IntvGetDeviceCaps()

VOID FASTCALL IntvGetDeviceCaps ( PPDEVOBJ  ,
PDEVCAPS   
)

◆ TranslateCOLORREF()

ULONG TranslateCOLORREF ( PDC  pdc,
COLORREF  crColor 
)

Definition at line 869 of file dcutil.c.

870{
871 PSURFACE psurfDC;
872 PPALETTE ppalDC;
873 ULONG index, ulColor, iBitmapFormat;
874 EXLATEOBJ exlo;
875
876 /* Get the DC surface */
877 psurfDC = pdc->dclevel.pSurface;
878
879 /* If no surface is selected, use the default bitmap */
880 if (!psurfDC)
881 psurfDC = psurfDefaultBitmap;
882
883 /* Check what color type this is */
884 switch (crColor >> 24)
885 {
886 case 0x00: /* RGB color */
887 break;
888
889 case 0x01: /* PALETTEINDEX */
890 index = crColor & 0xFFFFFF;
891 ppalDC = pdc->dclevel.ppal;
892 if (index >= ppalDC->NumColors) index = 0;
893
894 /* Get the RGB value */
895 crColor = PALETTE_ulGetRGBColorFromIndex(ppalDC, index);
896 break;
897
898 case 0x02: /* PALETTERGB */
899
900 if (pdc->dclevel.hpal != StockObjects[DEFAULT_PALETTE])
901 {
902 /* First find the nearest index in the dc palette */
903 ppalDC = pdc->dclevel.ppal;
904 index = PALETTE_ulGetNearestIndex(ppalDC, crColor & 0xFFFFFF);
905
906 /* Get the RGB value */
907 crColor = PALETTE_ulGetRGBColorFromIndex(ppalDC, index);
908 }
909 else
910 {
911 /* Use the pure color */
912 crColor = crColor & 0x00FFFFFF;
913 }
914 break;
915
916 case 0x10: /* DIBINDEX */
917 /* Mask the value to match the target bpp */
918 iBitmapFormat = psurfDC->SurfObj.iBitmapFormat;
919 if (iBitmapFormat == BMF_1BPP) index = crColor & 0x1;
920 else if (iBitmapFormat == BMF_4BPP) index = crColor & 0xf;
921 else if (iBitmapFormat == BMF_8BPP) index = crColor & 0xFF;
922 else if (iBitmapFormat == BMF_16BPP) index = crColor & 0xFFFF;
923 else index = crColor & 0xFFFFFF;
924 return index;
925
926 default:
927 DPRINT("Unsupported color type %u passed\n", crColor >> 24);
928 crColor &= 0xFFFFFF;
929 }
930
931 /* Initialize an XLATEOBJ from RGB to the target surface */
932 EXLATEOBJ_vInitialize(&exlo, &gpalRGB, psurfDC->ppal, 0xFFFFFF, 0, 0);
933
934 /* Translate the color to the target format */
935 ulColor = XLATEOBJ_iXlate(&exlo.xlo, crColor);
936
937 /* Cleanup the XLATEOBJ */
938 EXLATEOBJ_vCleanup(&exlo);
939
940 return ulColor;
941}
#define index(s, c)
Definition: various.h:29
_Notnull_ PSURFACE psurfDefaultBitmap
Definition: dclife.c:17
GLuint index
Definition: glext.h:6031
XLATEOBJ xlo
Definition: xlateobj.h:21
ULONG NumColors
Definition: palette.h:41
SURFOBJ SurfObj
Definition: surface.h:8
struct _PALETTE *const ppal
Definition: surface.h:11
ULONG iBitmapFormat
Definition: winddi.h:1215
PALETTE gpalRGB
Definition: palette.c:20
ULONG NTAPI PALETTE_ulGetNearestIndex(PALETTE *ppal, ULONG ulColor)
Definition: palette.c:312
FORCEINLINE ULONG PALETTE_ulGetRGBColorFromIndex(PPALETTE ppal, ULONG ulIndex)
Definition: palette.h:142
#define BMF_16BPP
Definition: winddi.h:358
#define BMF_8BPP
Definition: winddi.h:357
#define BMF_1BPP
Definition: winddi.h:355
ENGAPI ULONG APIENTRY XLATEOBJ_iXlate(_In_ XLATEOBJ *pxlo, _In_ ULONG iColor)
Definition: xlateobj.c:664
#define BMF_4BPP
Definition: winddi.h:356
VOID NTAPI EXLATEOBJ_vInitialize(_Out_ PEXLATEOBJ pexlo, _In_opt_ PALETTE *ppalSrc, _In_opt_ PALETTE *ppalDst, _In_ COLORREF crSrcBackColor, _In_ COLORREF crDstBackColor, _In_ COLORREF crDstForeColor)
Definition: xlateobj.c:358
VOID NTAPI EXLATEOBJ_vCleanup(_Inout_ PEXLATEOBJ pexlo)
Definition: xlateobj.c:649

Referenced by NtGdiGetNearestColor(), and NtGdiSetPixel().

Variable Documentation

◆ defaultDCstate

PDC defaultDCstate
extern

Definition at line 14 of file device.c.

Referenced by DC_InitHack(), and IntGdiCleanDC().

◆ pbrDefaultBrush

_Notnull_ PBRUSH pbrDefaultBrush
extern

Definition at line 18 of file dclife.c.

Referenced by DC_vInitDc(), DC_vUpdateBackgroundBrush(), DC_vUpdateTextBrush(), and InitDcImpl().

◆ psurfDefaultBitmap

_Notnull_ PSURFACE psurfDefaultBitmap
extern

Definition at line 17 of file dclife.c.

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