ReactOS  0.4.13-dev-66-gc714b7f
dcutil.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for dcutil.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL FASTCALL GreDPtoLP (HDC hdc, LPPOINT lpPoints, INT nCount)
 
BOOL FASTCALL GreLPtoDP (HDC hdc, LPPOINT lpPoints, INT nCount)
 
int FASTCALL GreGetBkMode (HDC hdc)
 
COLORREF FASTCALL GreGetBkColor (HDC hdc)
 
int FASTCALL GreGetMapMode (HDC hdc)
 
COLORREF FASTCALL GreGetTextColor (HDC hdc)
 
COLORREF FASTCALL IntGdiSetBkColor (HDC hDC, COLORREF color)
 
INT FASTCALL IntGdiSetBkMode (HDC hDC, INT Mode)
 
UINT FASTCALL IntGdiSetTextAlign (HDC hDC, UINT Mode)
 
COLORREF FASTCALL IntGdiSetTextColor (HDC hDC, COLORREF color)
 
COLORREF FASTCALL IntSetDCBrushColor (HDC hdc, COLORREF crColor)
 
BOOL FASTCALL GreSetBrushOrg (HDC hdc, INT x, INT y, LPPOINT pptOut)
 
COLORREF FASTCALL IntSetDCPenColor (HDC hdc, COLORREF crColor)
 
int FASTCALL GreSetStretchBltMode (HDC hDC, int iStretchMode)
 
int FASTCALL GreGetGraphicsMode (HDC hdc)
 
VOID FASTCALL DCU_SetDcUndeletable (HDC hDC)
 
BOOL FASTCALL IntSetDefaultRegion (PDC pdc)
 
BOOL APIENTRY NtGdiCancelDC (HDC hDC)
 
WORD APIENTRY IntGdiSetHookFlags (HDC hDC, WORD Flags)
 
BOOL APIENTRY NtGdiGetDCDword (HDC hDC, UINT u, DWORD *Result)
 
 _Success_ (return !=FALSE)
 
VOID FASTCALL IntUpdateBoundsRect (PDC pdc, PRECTL pRect)
 
DWORD APIENTRY NtGdiGetBoundsRect (IN HDC hdc, OUT LPRECT prc, IN DWORD flags)
 
DWORD APIENTRY NtGdiSetBoundsRect (IN HDC hdc, IN LPRECT prc, IN DWORD flags)
 
ULONG TranslateCOLORREF (PDC pdc, COLORREF crColor)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 3 of file dcutil.c.

Function Documentation

◆ _Success_()

_Success_ ( return = FALSE)

Definition at line 557 of file dcutil.c.

565 {
566  BOOL Ret = TRUE;
567  PDC pdc;
568  PDC_ATTR pdcattr;
569 
570  DWORD SafeResult = 0;
572 
573  if (!pdwResult)
574  {
576  return FALSE;
577  }
578 
579  pdc = DC_LockDc(hdc);
580  if (!pdc)
581  {
583  return FALSE;
584  }
585  pdcattr = pdc->pdcattr;
586 
587  switch (u)
588  {
589  case GdiGetSetCopyCount:
590  SafeResult = pdc->ulCopyCount;
591  pdc->ulCopyCount = dwIn;
592  break;
593 
594  case GdiGetSetTextAlign:
595  SafeResult = pdcattr->lTextAlign;
596  pdcattr->lTextAlign = dwIn;
597  // pdcattr->flTextAlign = dwIn; // Flags!
598  break;
599 
600  case GdiGetSetRelAbs:
601  SafeResult = pdcattr->lRelAbs;
602  pdcattr->lRelAbs = dwIn;
603  break;
604 
606  SafeResult = pdcattr->lTextExtra;
607  pdcattr->lTextExtra = dwIn;
608  break;
609 
610  case GdiGetSetSelectFont:
611  break;
612 
614  if (dwIn & ~1)
615  {
617  Ret = FALSE;
618  break;
619  }
620  SafeResult = pdcattr->flFontMapper;
621  pdcattr->flFontMapper = dwIn;
622  break;
623 
624  case GdiGetSetMapMode:
625  SafeResult = IntGdiSetMapMode(pdc, dwIn);
626  break;
627 
630  {
632  Ret = FALSE;
633  break;
634  }
635  if (pdcattr->dwLayout & LAYOUT_RTL) // Right to Left
636  {
637  SafeResult = AD_CLOCKWISE - ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0);
638  if (dwIn == AD_CLOCKWISE)
639  {
640  pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
641  break;
642  }
643  pdc->dclevel.flPath |= DCPATH_CLOCKWISE;
644  }
645  else // Left to Right
646  {
647  SafeResult = ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0) +
649  if (dwIn == AD_COUNTERCLOCKWISE)
650  {
651  pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
652  break;
653  }
654  pdc->dclevel.flPath |= DCPATH_CLOCKWISE;
655  }
656  break;
657 
658  default:
660  Ret = FALSE;
661  break;
662  }
663 
664  if (Ret)
665  {
666  _SEH2_TRY
667  {
668  ProbeForWrite(pdwResult, sizeof(DWORD), 1);
669  *pdwResult = SafeResult;
670  }
672  {
674  }
675  _SEH2_END;
676 
677  if (!NT_SUCCESS(Status))
678  {
680  Ret = FALSE;
681  }
682  }
683 
684  DC_UnlockDc(pdc);
685  return Ret;
686 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
int APIENTRY IntGdiSetMapMode(PDC dc, int MapMode)
Definition: coord.c:816
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define LAYOUT_RTL
Definition: wingdi.h:1353
FLONG flFontMapper
Definition: ntgdihdl.h:313
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
LONG lTextExtra
Definition: ntgdihdl.h:323
LONG lRelAbs
Definition: ntgdihdl.h:324
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define AD_COUNTERCLOCKWISE
Definition: wingdi.h:666
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define AD_CLOCKWISE
Definition: wingdi.h:667
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
_In_ UINT _In_ DWORD _Out_ DWORD * pdwResult
Definition: ntgdi.h:248
_In_ UINT _In_ DWORD dwIn
Definition: ntgdi.h:248
DWORD dwLayout
Definition: ntgdihdl.h:336
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2725
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
LONG lTextAlign
Definition: ntgdihdl.h:322

◆ 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_FLAG_PERMANENT;
332  DC_UnlockDc(dc);
333  return;
334 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HDC dc
Definition: cylfrac.c:34
Definition: polytest.cpp:40
#define DC_FLAG_PERMANENT
Definition: ntgdihdl.h:131
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by DceAllocDCE().

◆ GreDPtoLP()

BOOL FASTCALL GreDPtoLP ( HDC  hdc,
LPPOINT  lpPoints,
INT  nCount 
)

Definition at line 7 of file dcutil.c.

8 {
9  PDC dc;
10  if (!(dc = DC_LockDc(hdc)))
11  {
13  return FALSE;
14  }
15  IntDPtoLP(dc, lpPoints, nCount);
16  DC_UnlockDc(dc);
17  return TRUE;
18 }
#define IntDPtoLP(pdc, ppt, count)
Definition: coord.h:12
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HDC dc
Definition: cylfrac.c:34
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by co_UserGetUpdateRect(), and IntDefWindowProc().

◆ 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;
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:882
HDC dc
Definition: cylfrac.c:34
Definition: polytest.cpp:40
DWORD COLORREF
Definition: windef.h:285
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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;
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:882
HDC dc
Definition: cylfrac.c:34
long LONG
Definition: pedump.c:60
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by MENU_DrawPopupGlyph(), 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;
316  DC_UnlockDc(dc);
317  return GraphicsMode;
318 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:882
HDC dc
Definition: cylfrac.c:34
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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;
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:882
HDC dc
Definition: cylfrac.c:34
int32_t INT
Definition: typedefs.h:56
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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;
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:882
HDC dc
Definition: cylfrac.c:34
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
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

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

◆ GreLPtoDP()

BOOL FASTCALL GreLPtoDP ( HDC  hdc,
LPPOINT  lpPoints,
INT  nCount 
)

Definition at line 21 of file dcutil.c.

22 {
23  PDC dc;
24  if (!(dc = DC_LockDc(hdc)))
25  {
27  return FALSE;
28  }
29  IntLPtoDP(dc, lpPoints, nCount);
30  DC_UnlockDc(dc);
31  return TRUE;
32 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HDC dc
Definition: cylfrac.c:34
Definition: polytest.cpp:40
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ 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 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
smooth NULL
Definition: ftsmooth.c:416
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
_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
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by _Success_(), and IntFillWindow().

◆ 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 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
BYTE jStretchBltMode
Definition: ntgdihdl.h:307
#define MAXSTRETCHBLTMODE
Definition: wingdi.h:955
int32_t INT
Definition: typedefs.h:56
Definition: polytest.cpp:40
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
LONG lStretchBltMode
Definition: ntgdihdl.h:312
#define WHITEONBLACK
Definition: wingdi.h:952

◆ IntGdiSetBkColor()

COLORREF FASTCALL IntGdiSetBkColor ( HDC  hDC,
COLORREF  color 
)

Definition at line 95 of file dcutil.c.

96 {
97  COLORREF oldColor;
98  PDC dc;
99  PDC_ATTR pdcattr;
100  HBRUSH hBrush;
101 
102  if (!(dc = DC_LockDc(hDC)))
103  {
105  return CLR_INVALID;
106  }
107  pdcattr = dc->pdcattr;
108 
109  oldColor = pdcattr->ulBackgroundClr;
110  pdcattr->ulBackgroundClr = color;
111 
112  if (pdcattr->crBackgroundClr != color)
113  {
114  pdcattr->ulDirty_ |= (DIRTY_BACKGROUND|DIRTY_LINE|DIRTY_FILL); // Clear Flag if set.
115  pdcattr->crBackgroundClr = color;
116  }
117  hBrush = pdcattr->hbrush;
118  DC_UnlockDc(dc);
119  NtGdiSelectBrush(hDC, hBrush);
120  return oldColor;
121 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
HANDLE hbrush
Definition: ntgdihdl.h:292
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:882
HDC dc
Definition: cylfrac.c:34
#define DIRTY_BACKGROUND
Definition: ntgdihdl.h:148
__kernel_entry W32KAPI HBRUSH APIENTRY NtGdiSelectBrush(_In_ HDC hdc, _In_ HBRUSH hbrush)
ULONG ulBackgroundClr
Definition: ntgdihdl.h:295
GLuint color
Definition: glext.h:6243
ULONG ulDirty_
Definition: ntgdihdl.h:291
COLORREF crBackgroundClr
Definition: ntgdihdl.h:294
Definition: polytest.cpp:40
DWORD COLORREF
Definition: windef.h:285
#define DIRTY_FILL
Definition: ntgdihdl.h:145
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DIRTY_LINE
Definition: ntgdihdl.h:146
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ IntGdiSetBkMode()

INT FASTCALL IntGdiSetBkMode ( HDC  hDC,
INT  Mode 
)

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;
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:882
HDC dc
Definition: cylfrac.c:34
Definition: polytest.cpp:40
DWORD COLORREF
Definition: windef.h:285
BYTE jBkMode
Definition: ntgdihdl.h:305
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
LONG lBkMode
Definition: ntgdihdl.h:310
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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

◆ IntGdiSetHookFlags()

WORD APIENTRY IntGdiSetHookFlags ( HDC  hDC,
WORD  Flags 
)

Definition at line 423 of file dcutil.c.

424 {
425  WORD wRet;
426  DC *dc = DC_LockDc(hDC);
427 
428  if (NULL == dc)
429  {
431  return 0;
432  }
433 
434  wRet = dc->fs & DC_FLAG_DIRTY_RAO; // FIXME: Wrong flag!
435 
436  /* Info in "Undocumented Windows" is slightly confusing. */
437  DPRINT("DC %p, Flags %04x\n", hDC, Flags);
438 
440  {
441  /* hVisRgn has to be updated */
442  dc->fs |= DC_FLAG_DIRTY_RAO;
443  }
444  else if (Flags & DCHF_VALIDATEVISRGN || 0 == Flags)
445  {
446  //dc->fs &= ~DC_FLAG_DIRTY_RAO;
447  }
448 
449  DC_UnlockDc(dc);
450 
451  return wRet;
452 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HDC dc
Definition: cylfrac.c:34
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: polytest.cpp:40
#define DC_FLAG_DIRTY_RAO
Definition: ntgdihdl.h:132
unsigned short WORD
Definition: ntddk_ex.h:93
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DCHF_INVALIDATEVISRGN
Definition: gdi_driver.h:266
#define DCHF_VALIDATEVISRGN
Definition: gdi_driver.h:267
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by DceDeleteClipRgn(), DceResetActiveDCEs(), and UserGetDCEx().

◆ 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;
166  DC_UnlockDc(dc);
167  return prevAlign;
168 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define LAYOUT_RTL
Definition: wingdi.h:1353
_In_ ULONG Mode
Definition: hubbusif.h:303
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HDC dc
Definition: cylfrac.c:34
#define TA_RIGHT
Definition: wingdi.h:932
Definition: polytest.cpp:40
#define TA_MASK
Definition: wingdi.h:936
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int UINT
Definition: ndis.h:50
FLONG flTextAlign
Definition: ntgdihdl.h:321
DWORD dwLayout
Definition: ntgdihdl.h:336
#define TA_CENTER
Definition: wingdi.h:930
#define GDI_ERROR
Definition: wingdi.h:1291
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
LONG lTextAlign
Definition: ntgdihdl.h:322

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 
196  DC_vUpdateTextBrush(pdc);
197  DC_vUpdateLineBrush(pdc);
198  DC_vUpdateFillBrush(pdc);
199 
200  DC_UnlockDc(pdc);
201 
202  return crOldColor;
203 }
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:882
GLuint color
Definition: glext.h:6243
ULONG ulDirty_
Definition: ntgdihdl.h:291
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
Definition: polytest.cpp:40
DWORD COLORREF
Definition: windef.h:285
#define DIRTY_TEXT
Definition: ntgdihdl.h:147
#define DIRTY_FILL
Definition: ntgdihdl.h:145
static HDC hDC
Definition: 3dtext.c:33
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
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16

Referenced by DefWndControlColor(), 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  }
226  DC_UnlockDc(dc);
227  return OldColor;
228 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define CLR_INVALID
Definition: wingdi.h:882
HDC dc
Definition: cylfrac.c:34
Definition: polytest.cpp:40
DWORD COLORREF
Definition: windef.h:285
#define DIRTY_FILL
Definition: ntgdihdl.h:145
HDC hdc
Definition: main.c:9
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

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  }
277  DC_UnlockDc(dc);
278  return OldColor;
279 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define CLR_INVALID
Definition: wingdi.h:882
HDC dc
Definition: cylfrac.c:34
Definition: polytest.cpp:40
DWORD COLORREF
Definition: windef.h:285
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int ULONG
Definition: retypes.h:1
#define DIRTY_LINE
Definition: ntgdihdl.h:146
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

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 
356  IntGdiReleaseRaoRgn(pdc);
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.x = pdc->dcattr.ptlBrushOrigin.x;
405  pdc->ptlFillOrigin.y = pdc->dcattr.ptlBrushOrigin.y;
406  return TRUE;
407  }
408 
409  pdc->prgnVis = prgnDefault;
410  return FALSE;
411 }
#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:2429
long top
Definition: polytest.cpp:53
Definition: region.h:7
long left
Definition: polytest.cpp:53
PREGION prgnDefault
Definition: region.c:130
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481
VOID FASTCALL REGION_SetRectRgn(PREGION rgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect)
Definition: region.c:2688

Referenced by MakeInfoDC().

◆ IntUpdateBoundsRect()

VOID FASTCALL IntUpdateBoundsRect ( PDC  pdc,
PRECTL  pRect 
)

Definition at line 690 of file dcutil.c.

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

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

◆ NtGdiCancelDC()

BOOL APIENTRY NtGdiCancelDC ( HDC  hDC)

Definition at line 415 of file dcutil.c.

416 {
418  return FALSE;
419 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ NtGdiGetBoundsRect()

DWORD APIENTRY NtGdiGetBoundsRect ( IN HDC  hdc,
OUT LPRECT  prc,
IN DWORD  flags 
)

Definition at line 704 of file dcutil.c.

708 {
709  DWORD ret;
710  PDC pdc;
711  RECT rc;
712 
713  /* Lock the DC */
714  if (!(pdc = DC_LockDc(hdc))) return 0;
715 
716  if (!(flags & DCB_WINDOWMGR))
717  {
718  rc = pdc->erclBoundsApp;
719 
720  if (RECTL_bIsEmptyRect(&rc))
721  {
722  rc.left = rc.top = rc.right = rc.bottom = 0;
723  ret = DCB_RESET;
724  }
725  else
726  {
727  RECTL rcRgn;
728  if (pdc->fs & DC_FLAG_DIRTY_RAO) CLIPPING_UpdateGCRegion(pdc);
729  if(!REGION_GetRgnBox(pdc->prgnRao, &rcRgn))
730  {
731  REGION_GetRgnBox(pdc->prgnVis, &rcRgn);
732  }
733  rc.left = max( rc.left, 0 );
734  rc.top = max( rc.top, 0 );
735  rc.right = min( rc.right, rcRgn.right - rcRgn.left );
736  rc.bottom = min( rc.bottom, rcRgn.bottom - rcRgn.top );
737  DPRINT("Rao dc %p r %d b %d\n",pdc,rcRgn.right - rcRgn.left, rcRgn.bottom - rcRgn.top);
738  DPRINT("rc l %d t %d\n",rc.left,rc.top);
739  DPRINT(" r %d b %d\n",rc.right,rc.bottom);
740  ret = DCB_SET;
741  }
742  IntDPtoLP( pdc, &rc, 2 );
743  DPRINT("rc1 l %d t %d\n",rc.left,rc.top);
744  DPRINT(" r %d b %d\n",rc.right,rc.bottom);
745  }
746  else
747  {
748  rc = pdc->erclBounds;
749  ret = DCB_SET;
750  }
751 
752  /* Copy the rect to the caller */
753  _SEH2_TRY
754  {
755  ProbeForWrite(prc, sizeof(RECT), 1);
756  *prc = rc;
757  }
759  {
760  ret = 0;
761  }
762  _SEH2_END;
763 
764  if (flags & DCB_RESET)
765  {
766  if (!(flags & DCB_WINDOWMGR))
767  {
768  pdc->erclBoundsApp.left = pdc->erclBoundsApp.top = INT_MAX;
769  pdc->erclBoundsApp.right = pdc->erclBoundsApp.bottom = INT_MIN;
770  }
771  else
772  {
773  pdc->erclBounds.left = pdc->erclBounds.top = INT_MAX;
774  pdc->erclBounds.right = pdc->erclBounds.bottom = INT_MIN;
775  }
776  }
777 
778  DC_UnlockDc(pdc);
779  return ret;
780 }
#define IntDPtoLP(pdc, ppt, count)
Definition: coord.h:12
#define max(a, b)
Definition: svc.c:63
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define INT_MAX
Definition: limits.h:40
LONG top
Definition: windef.h:292
long bottom
Definition: polytest.cpp:53
#define DCB_WINDOWMGR
Definition: ntgdityp.h:241
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
void DPRINT(...)
Definition: polytest.cpp:61
long left
Definition: polytest.cpp:53
Definition: polytest.cpp:40
#define DC_FLAG_DIRTY_RAO
Definition: ntgdihdl.h:132
VOID FASTCALL CLIPPING_UpdateGCRegion(PDC pDC)
Definition: cliprgn.c:544
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
int ret
HDC hdc
Definition: main.c:9
#define DCB_SET
Definition: wingdi.h:687
#define INT_MIN
Definition: limits.h:39
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DCB_RESET
Definition: wingdi.h:686
#define min(a, b)
Definition: monoChain.cc:55
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
LONG bottom
Definition: windef.h:294
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
INT FASTCALL REGION_GetRgnBox(PREGION Rgn, PRECTL pRect)
Definition: region.c:2565
_Out_ LPRECT prc
Definition: ntgdi.h:1658

Referenced by GetBoundsRect(), and GetBoundsRectAlt().

◆ NtGdiGetDCDword()

BOOL APIENTRY NtGdiGetDCDword ( HDC  hDC,
UINT  u,
DWORD Result 
)

Definition at line 457 of file dcutil.c.

461 {
462  BOOL Ret = TRUE;
463  PDC pdc;
464  PDC_ATTR pdcattr;
465 
466  DWORD SafeResult = 0;
468 
469  if (!Result)
470  {
472  return FALSE;
473  }
474 
475  pdc = DC_LockDc(hDC);
476  if (!pdc)
477  {
479  return FALSE;
480  }
481  pdcattr = pdc->pdcattr;
482 
483  switch (u)
484  {
485  case GdiGetJournal:
486  break;
487 
488  case GdiGetRelAbs:
489  SafeResult = pdcattr->lRelAbs;
490  break;
491 
492  case GdiGetBreakExtra:
493  SafeResult = pdcattr->lBreakExtra;
494  break;
495 
496  case GdiGerCharBreak:
497  SafeResult = pdcattr->cBreak;
498  break;
499 
500  case GdiGetArcDirection:
501  if (pdcattr->dwLayout & LAYOUT_RTL)
502  SafeResult = AD_CLOCKWISE - ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0);
503  else
504  SafeResult = ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0) + AD_COUNTERCLOCKWISE;
505  break;
506 
507  case GdiGetEMFRestorDc:
508  SafeResult = pdc->dclevel.lSaveDepth;
509  break;
510 
512  SafeResult = IntGetFontLanguageInfo(pdc);
513  break;
514 
515  case GdiGetIsMemDc:
516  SafeResult = pdc->dctype;
517  break;
518 
519  case GdiGetMapMode:
520  SafeResult = pdcattr->iMapMode;
521  break;
522 
523  case GdiGetTextCharExtra:
524  SafeResult = pdcattr->lTextExtra;
525  break;
526 
527  default:
529  Ret = FALSE;
530  break;
531  }
532 
533  if (Ret)
534  {
535  _SEH2_TRY
536  {
537  ProbeForWrite(Result, sizeof(DWORD), 1);
538  *Result = SafeResult;
539  }
541  {
543  }
544  _SEH2_END;
545 
546  if (!NT_SUCCESS(Status))
547  {
549  Ret = FALSE;
550  }
551  }
552 
553  DC_UnlockDc(pdc);
554  return Ret;
555 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define LAYOUT_RTL
Definition: wingdi.h:1353
LONG lBreakExtra
Definition: ntgdihdl.h:325
DWORD FASTCALL IntGetFontLanguageInfo(PDC Dc)
Definition: font.c:371
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
INT iMapMode
Definition: ntgdihdl.h:335
LONG lTextExtra
Definition: ntgdihdl.h:323
LONG lRelAbs
Definition: ntgdihdl.h:324
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define AD_COUNTERCLOCKWISE
Definition: wingdi.h:666
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define AD_CLOCKWISE
Definition: wingdi.h:667
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG cBreak
Definition: ntgdihdl.h:326
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
DWORD dwLayout
Definition: ntgdihdl.h:336
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2725
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ NtGdiSetBoundsRect()

DWORD APIENTRY NtGdiSetBoundsRect ( IN HDC  hdc,
IN LPRECT  prc,
IN DWORD  flags 
)

Definition at line 784 of file dcutil.c.

788 {
789  DWORD ret;
790  PDC pdc;
791  RECTL rcl;
792 
793  /* Verify arguments */
794  if ((flags & DCB_ENABLE) && (flags & DCB_DISABLE)) return 0;
795 
796  /* Lock the DC */
797  if (!(pdc = DC_LockDc(hdc))) return 0;
798 
799  /* Get the return value */
800  ret = DCB_RESET; /* we don't have device-specific bounds */
801  ret = (pdc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR) ? DCB_ENABLE : DCB_DISABLE) |
802  (RECTL_bIsEmptyRect(&pdc->erclBoundsApp) ? ret & DCB_SET : DCB_SET );
803  ret |= (flags & DCB_WINDOWMGR);
804 
805  if (flags & DCB_RESET)
806  {
807  if (!(flags & DCB_WINDOWMGR))
808  {
809  pdc->erclBoundsApp.left = pdc->erclBoundsApp.top = INT_MAX;
810  pdc->erclBoundsApp.right = pdc->erclBoundsApp.bottom = INT_MIN;
811  }
812  else
813  {
814  pdc->erclBounds.left = pdc->erclBounds.top = INT_MAX;
815  pdc->erclBounds.right = pdc->erclBounds.bottom = INT_MIN;
816  }
817  }
818 
819  if (flags & DCB_ACCUMULATE && prc != NULL)
820  {
821  /* Capture the rect */
822  _SEH2_TRY
823  {
824  ProbeForRead(prc, sizeof(RECT), 1);
825  rcl = *prc;
826  }
828  {
829  DC_UnlockDc(pdc);
830  _SEH2_YIELD(return 0;)
831  }
832  _SEH2_END;
833 
835 
836  if (!(flags & DCB_WINDOWMGR))
837  {
838  IntLPtoDP( pdc, (POINT *)&rcl, 2 );
839  RECTL_bUnionRect(&pdc->erclBoundsApp, &pdc->erclBoundsApp, &rcl);
840  }
841  else
842  RECTL_bUnionRect(&pdc->erclBounds, &pdc->erclBounds, &rcl);
843  }
844 
845  if (flags & DCB_ENABLE)
846  {
847  if (!(flags & DCB_WINDOWMGR))
848  pdc->fs |= DC_ACCUM_APP;
849  else
850  pdc->fs |= DC_ACCUM_WMGR;
851  }
852  if (flags & DCB_DISABLE)
853  {
854  if (!(flags & DCB_WINDOWMGR))
855  pdc->fs &= ~DC_ACCUM_APP;
856  else
857  pdc->fs &= ~DC_ACCUM_WMGR;
858  }
859  DC_UnlockDc(pdc);
860  return ret;
861 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define INT_MAX
Definition: limits.h:40
#define DCB_DISABLE
Definition: wingdi.h:684
#define DCB_WINDOWMGR
Definition: ntgdityp.h:241
#define DCB_ENABLE
Definition: wingdi.h:685
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
Definition: polytest.cpp:40
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
BOOL FASTCALL RECTL_bUnionRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
int ret
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
HDC hdc
Definition: main.c:9
#define DCB_SET
Definition: wingdi.h:687
#define INT_MIN
Definition: limits.h:39
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DCB_RESET
Definition: wingdi.h:686
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define DCB_ACCUMULATE
Definition: wingdi.h:688
_Out_ LPRECT prc
Definition: ntgdi.h:1658
VOID FASTCALL RECTL_vMakeWellOrdered(_Inout_ RECTL *prcl)
Definition: rect.c:81

◆ TranslateCOLORREF()

ULONG TranslateCOLORREF ( PDC  pdc,
COLORREF  crColor 
)

Definition at line 865 of file dcutil.c.

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

Referenced by NtGdiGetNearestColor(), and NtGdiSetPixel().