ReactOS  0.4.14-dev-98-gb0d4763
coord.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MIN_COORD   (INT_MIN / 16)
 
#define MAX_COORD   (INT_MAX / 16)
 
#define IntLPtoDP(pdc, ppt, count)
 
#define CoordLPtoDP(pdc, ppt)   DC_vXformWorldToDevice(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
 
#define IntDPtoLP(pdc, ppt, count)
 
#define CoordDPtoLP(pdc, ppt)   DC_vXformDeviceToWorld(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
 
#define XForm2MatrixS(m, x)   XFormToMatrix(m, (XFORML*)x)
 
#define MatrixS2XForm(x, m)   MatrixToXForm((XFORML*)x, m)
 

Functions

FORCEINLINE void XFormToMatrix (MATRIX *pmx, const XFORML *pxform)
 
FORCEINLINE void MatrixToXForm (XFORML *pxform, const MATRIX *pmx)
 
FORCEINLINE void InvertXform (XFORML *pxformDest, const XFORML *pxformSource)
 
VOID FASTCALL DC_vFixIsotropicMapping (PDC pdc)
 
VOID FASTCALL DC_vUpdateWorldToDevice (PDC pdc)
 
VOID FASTCALL DC_vUpdateDeviceToWorld (PDC pdc)
 
FORCEINLINE PSIZEL DC_pszlViewportExt (PDC pdc)
 
FORCEINLINE PMATRIX DC_pmxWorldToPage (PDC pdc)
 
FORCEINLINE PMATRIX DC_pmxWorldToDevice (PDC pdc)
 
FORCEINLINE PMATRIX DC_pmxDeviceToWorld (PDC pdc)
 
FORCEINLINE VOID DC_vXformDeviceToWorld (IN PDC pdc, IN ULONG cNumPoints, OUT PPOINTL pptlDest, IN PPOINTL pptlSource)
 
FORCEINLINE VOID DC_vXformWorldToDevice (IN PDC pdc, IN ULONG cNumPoints, OUT PPOINTL pptlDest, IN PPOINTL pptlSource)
 
BOOL NTAPI GreModifyWorldTransform (PDC pdc, const XFORML *pXForm, DWORD dwMode)
 
VOID FASTCALL IntMirrorWindowOrg (PDC)
 
int APIENTRY IntGdiSetMapMode (PDC, int)
 
BOOL FASTCALL GreLPtoDP (HDC, LPPOINT, INT)
 
BOOL FASTCALL GreDPtoLP (HDC, LPPOINT, INT)
 
BOOL APIENTRY GreGetDCPoint (HDC, UINT, PPOINTL)
 
BOOL WINAPI GreGetWindowExtEx (_In_ HDC hdc, _Out_ LPSIZE lpSize)
 
BOOL WINAPI GreGetViewportExtEx (_In_ HDC hdc, _Out_ LPSIZE lpSize)
 
BOOL FASTCALL GreSetViewportOrgEx (HDC, int, int, LPPOINT)
 
BOOL WINAPI GreGetDCOrgEx (_In_ HDC, _Out_ PPOINTL, _Out_ PRECTL)
 
BOOL WINAPI GreSetDCOrg (_In_ HDC, _In_ LONG, _In_ LONG, _In_opt_ PRECTL)
 

Macro Definition Documentation

◆ CoordDPtoLP

#define CoordDPtoLP (   pdc,
  ppt 
)    DC_vXformDeviceToWorld(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));

Definition at line 17 of file coord.h.

◆ CoordLPtoDP

#define CoordLPtoDP (   pdc,
  ppt 
)    DC_vXformWorldToDevice(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));

Definition at line 11 of file coord.h.

◆ IntDPtoLP

#define IntDPtoLP (   pdc,
  ppt,
  count 
)
Value:
do { \
DC_vUpdateDeviceToWorld(pdc); \
DC_vXformDeviceToWorld(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt)); \
} while (0)
GLuint GLuint GLsizei count
Definition: gl.h:1545

Definition at line 13 of file coord.h.

◆ IntLPtoDP

#define IntLPtoDP (   pdc,
  ppt,
  count 
)
Value:
do { \
DC_vUpdateWorldToDevice(pdc); \
DC_vXformWorldToDevice(pdc, count, (PPOINTL)(ppt), (PPOINTL)(ppt)); \
} while (0)
GLuint GLuint GLsizei count
Definition: gl.h:1545

Definition at line 7 of file coord.h.

◆ MatrixS2XForm

#define MatrixS2XForm (   x,
  m 
)    MatrixToXForm((XFORML*)x, m)

Definition at line 21 of file coord.h.

◆ MAX_COORD

#define MAX_COORD   (INT_MAX / 16)

Definition at line 5 of file coord.h.

◆ MIN_COORD

#define MIN_COORD   (INT_MIN / 16)

Definition at line 4 of file coord.h.

◆ XForm2MatrixS

#define XForm2MatrixS (   m,
  x 
)    XFormToMatrix(m, (XFORML*)x)

Definition at line 20 of file coord.h.

Function Documentation

◆ DC_pmxDeviceToWorld()

FORCEINLINE PMATRIX DC_pmxDeviceToWorld ( PDC  pdc)

Definition at line 112 of file coord.h.

113 {
114  /* Check if the device-to-world xform is invalid */
115  if (pdc->pdcattr->flXform & DEVICE_TO_WORLD_INVALID)
116  {
117  /* Update the world-to-device xform */
119  }
120 
121  return &pdc->pdcattr->mxDeviceToWorld;
122 }
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
VOID FASTCALL DC_vUpdateDeviceToWorld(PDC pdc)
Definition: coord.c:204

Referenced by DC_vXformDeviceToWorld(), and NtGdiGetTransform().

◆ DC_pmxWorldToDevice()

FORCEINLINE PMATRIX DC_pmxWorldToDevice ( PDC  pdc)

Definition at line 98 of file coord.h.

99 {
100  /* Check if world or page xform was changed */
101  if (pdc->pdcattr->flXform & (PAGE_XLATE_CHANGED|PAGE_EXTENTS_CHANGED|WORLD_XFORM_CHANGED))
102  {
103  /* Update the world-to-device xform */
105  }
106 
107  return &pdc->pdcattr->mxWorldToDevice;
108 }
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
VOID FASTCALL DC_vUpdateWorldToDevice(PDC pdc)
Definition: coord.c:182
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:202
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203

Referenced by DC_vUpdateDeviceToWorld(), DC_vXformWorldToDevice(), ftGdiGetGlyphOutline(), ftGdiGetTextMetricsW(), IntExtTextOutW(), NtGdiGetCharABCWidthsW(), NtGdiGetCharWidthW(), NtGdiGetTransform(), REGION_LPTODP(), and TextIntGetTextExtentPoint().

◆ DC_pmxWorldToPage()

FORCEINLINE PMATRIX DC_pmxWorldToPage ( PDC  pdc)

Definition at line 91 of file coord.h.

92 {
93  return &pdc->pdcattr->mxWorldToPage;
94 }

Referenced by NtGdiGetTransform().

◆ DC_pszlViewportExt()

FORCEINLINE PSIZEL DC_pszlViewportExt ( PDC  pdc)

Definition at line 74 of file coord.h.

75 {
76  PDC_ATTR pdcattr = pdc->pdcattr;
77 
78  /* Check if we need isotropic fixup */
79  if ((pdcattr->flXform & PAGE_EXTENTS_CHANGED) &&
80  (pdcattr->iMapMode == MM_ISOTROPIC))
81  {
82  /* Fixup viewport extension */
84  }
85 
86  return &pdcattr->szlViewportExt;
87 }
#define MM_ISOTROPIC
Definition: wingdi.h:869
INT iMapMode
Definition: ntgdihdl.h:342
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:202
FLONG flXform
Definition: ntgdihdl.h:349
SIZEL szlViewportExt
Definition: ntgdihdl.h:348
VOID FASTCALL DC_vFixIsotropicMapping(PDC pdc)
Definition: coord.c:93

Referenced by DC_vGetPageToDevice(), GreGetDCPoint(), NtGdiScaleViewportExtEx(), and PATH_StrokePath().

◆ DC_vFixIsotropicMapping()

VOID FASTCALL DC_vFixIsotropicMapping ( PDC  pdc)

Definition at line 93 of file coord.c.

94 {
95  PDC_ATTR pdcattr;
96  LONG64 fx, fy;
97  LONG s;
98  SIZEL szlWindowExt, szlViewportExt;
99  ASSERT(pdc->pdcattr->iMapMode == MM_ISOTROPIC);
100 
101  /* Get a pointer to the DC_ATTR */
102  pdcattr = pdc->pdcattr;
103 
104  /* Read the extents, we rely on non-null values */
105  szlWindowExt = pdcattr->szlWindowExt;
106  szlViewportExt = pdcattr->szlViewportExt;
107 
108  /* Check if all values are valid */
109  if ((szlWindowExt.cx == 0) || (szlWindowExt.cy == 0) ||
110  (szlViewportExt.cx == 0) || (szlViewportExt.cy == 0))
111  {
112  /* Someone put rubbish into the fields, just ignore it. */
113  return;
114  }
115 
116  fx = abs((LONG64)szlWindowExt.cx * szlViewportExt.cy);
117  fy = abs((LONG64)szlWindowExt.cy * szlViewportExt.cx);
118 
119  if (fx < fy)
120  {
121  s = (szlWindowExt.cy ^ szlViewportExt.cx) > 0 ? 1 : -1;
122  pdcattr->szlViewportExt.cx = (LONG)(fx * s / szlWindowExt.cy);
123  }
124  else if (fx > fy)
125  {
126  s = (szlWindowExt.cx ^ szlViewportExt.cy) > 0 ? 1 : -1;
127  pdcattr->szlViewportExt.cy = (LONG)(fy * s / szlWindowExt.cx);
128  }
129 
130  /* Reset the flag */
131  pdc->pdcattr->flXform &= ~PAGE_EXTENTS_CHANGED;
132 }
#define MM_ISOTROPIC
Definition: wingdi.h:869
#define abs(i)
Definition: fconv.c:206
long LONG
Definition: pedump.c:60
LONG cx
Definition: windef.h:319
int64_t LONG64
Definition: typedefs.h:66
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:202
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
SIZEL szlWindowExt
Definition: ntgdihdl.h:346
GLfixed fx
Definition: tritemp.h:482
GLdouble s
Definition: gl.h:2039
SIZEL szlViewportExt
Definition: ntgdihdl.h:348
GLfixed fy
Definition: tritemp.h:490
LONG cy
Definition: windef.h:320

Referenced by DC_pszlViewportExt(), and NtGdiScaleViewportExtEx().

◆ DC_vUpdateDeviceToWorld()

VOID FASTCALL DC_vUpdateDeviceToWorld ( PDC  pdc)

Definition at line 204 of file coord.c.

205 {
206  XFORMOBJ xoWorldToDevice, xoDeviceToWorld;
207  PMATRIX pmxWorldToDevice;
208 
209  /* Get the world-to-device translation */
210  pmxWorldToDevice = DC_pmxWorldToDevice(pdc);
211  XFORMOBJ_vInit(&xoWorldToDevice, pmxWorldToDevice);
212 
213  /* Create inverse of world-to-device transformation */
214  XFORMOBJ_vInit(&xoDeviceToWorld, &pdc->pdcattr->mxDeviceToWorld);
215  if (XFORMOBJ_iInverse(&xoDeviceToWorld, &xoWorldToDevice) == DDI_ERROR)
216  {
217  MX_Set0(&pdc->pdcattr->mxDeviceToWorld);
218  return;
219  }
220 
221  /* Reset the flag */
222  pdc->pdcattr->flXform &= ~DEVICE_TO_WORLD_INVALID;
223 }
#define XFORMOBJ_iInverse
Definition: xformobj.h:17
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define DDI_ERROR
Definition: winddi.h:154
VOID FASTCALL MX_Set0(OUT PMATRIX pmx)
Definition: xformobj.c:275
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98

Referenced by DC_pmxDeviceToWorld().

◆ DC_vUpdateWorldToDevice()

VOID FASTCALL DC_vUpdateWorldToDevice ( PDC  pdc)

Definition at line 182 of file coord.c.

183 {
184  XFORMOBJ xoPageToDevice, xoWorldToPage, xoWorldToDevice;
185  MATRIX mxPageToDevice;
186 
187  // FIXME: make sure world-to-page is valid!
188 
189  /* Construct a transformation to do the page-to-device conversion */
190  DC_vGetPageToDevice(pdc, &mxPageToDevice);
191  XFORMOBJ_vInit(&xoPageToDevice, &mxPageToDevice);
192 
193  /* Recalculate the world-to-device xform */
194  XFORMOBJ_vInit(&xoWorldToPage, &pdc->pdcattr->mxWorldToPage);
195  XFORMOBJ_vInit(&xoWorldToDevice, &pdc->pdcattr->mxWorldToDevice);
196  XFORMOBJ_iCombine(&xoWorldToDevice, &xoWorldToPage, &xoPageToDevice);
197 
198  /* Reset the flags */
199  pdc->pdcattr->flXform &= ~WORLD_XFORM_CHANGED;
200 }
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
Definition: matrix.h:43
VOID FASTCALL DC_vGetPageToDevice(PDC pdc, MATRIX *pmx)
Definition: coord.c:136
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
#define XFORMOBJ_iCombine
Definition: xformobj.h:15

Referenced by DC_pmxWorldToDevice().

◆ DC_vXformDeviceToWorld()

FORCEINLINE VOID DC_vXformDeviceToWorld ( IN PDC  pdc,
IN ULONG  cNumPoints,
OUT PPOINTL  pptlDest,
IN PPOINTL  pptlSource 
)

Definition at line 126 of file coord.h.

131 {
132  XFORMOBJ xo;
133  PMATRIX pmx;
134 
135  pmx = DC_pmxDeviceToWorld(pdc);
136  if (!MX_IsInvertible(pmx))
137  return;
138 
139  XFORMOBJ_vInit(&xo, pmx);
140  XFORMOBJ_bApplyXform(&xo, XF_LTOL, cNumPoints, pptlDest, pptlSource);
141 }
#define XFORMOBJ_bApplyXform
Definition: xformobj.h:11
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define XF_LTOL
Definition: winddi.h:3109
BOOL FASTCALL MX_IsInvertible(IN PMATRIX pmx)
Definition: xformobj.c:267
FORCEINLINE PMATRIX DC_pmxDeviceToWorld(PDC pdc)
Definition: coord.h:112

Referenced by NtGdiTransformPoints().

◆ DC_vXformWorldToDevice()

FORCEINLINE VOID DC_vXformWorldToDevice ( IN PDC  pdc,
IN ULONG  cNumPoints,
OUT PPOINTL  pptlDest,
IN PPOINTL  pptlSource 
)

Definition at line 145 of file coord.h.

150 {
151  XFORMOBJ xo;
152  PMATRIX pmx;
153 
154  pmx = DC_pmxWorldToDevice(pdc);
155  XFORMOBJ_vInit(&xo, pmx);
156  XFORMOBJ_bApplyXform(&xo, XF_LTOL, cNumPoints, pptlDest, pptlSource);
157 }
#define XFORMOBJ_bApplyXform
Definition: xformobj.h:11
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define XF_LTOL
Definition: winddi.h:3109
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98

Referenced by NtGdiTransformPoints().

◆ GreDPtoLP()

BOOL FASTCALL GreDPtoLP ( HDC  ,
LPPOINT  ,
INT   
)

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:13
#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().

◆ GreGetDCOrgEx()

BOOL WINAPI GreGetDCOrgEx ( _In_  HDC,
_Out_  PPOINTL,
_Out_  PRECTL 
)

Definition at line 1383 of file coord.c.

1387 {
1388  PDC dc;
1389 
1390  dc = DC_LockDc(hdc);
1391  if (!dc) return FALSE;
1392 
1393  /* Retrieve DC Window Rectangle without a check */
1394  *Rect = dc->erclWindow;
1395 
1396  DC_UnlockDc(dc);
1397 
1398  /* Use default call for DC Origin and parameter checking */
1399  return GreGetDCPoint( hdc, GdiGetDCOrg, Point);
1400 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
HDC dc
Definition: cylfrac.c:34
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1288
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237

◆ GreGetDCPoint()

BOOL APIENTRY GreGetDCPoint ( HDC  ,
UINT  ,
PPOINTL   
)

Definition at line 1288 of file coord.c.

1292 {
1293  BOOL Ret = TRUE;
1294  DC *pdc;
1295  SIZE Size;
1296  PSIZEL pszlViewportExt;
1297 
1298  if (!Point)
1299  {
1301  return FALSE;
1302  }
1303 
1304  pdc = DC_LockDc(hDC);
1305  if (!pdc)
1306  {
1308  return FALSE;
1309  }
1310 
1311  switch (iPoint)
1312  {
1313  case GdiGetViewPortExt:
1314  pszlViewportExt = DC_pszlViewportExt(pdc);
1315  Point->x = pszlViewportExt->cx;
1316  Point->y = pszlViewportExt->cy;
1317  break;
1318 
1319  case GdiGetWindowExt:
1320  Point->x = pdc->pdcattr->szlWindowExt.cx;
1321  Point->y = pdc->pdcattr->szlWindowExt.cy;
1322  break;
1323 
1324  case GdiGetViewPortOrg:
1325  *Point = pdc->pdcattr->ptlViewportOrg;
1326  break;
1327 
1328  case GdiGetWindowOrg:
1329  *Point = pdc->pdcattr->ptlWindowOrg;
1330  break;
1331 
1332  case GdiGetDCOrg:
1333  *Point = pdc->ptlDCOrig;
1334  break;
1335 
1338  Point->x = Size.cx;
1339  Point->y = Size.cy;
1340  break;
1341 
1342  default:
1344  Ret = FALSE;
1345  break;
1346  }
1347 
1348  DC_UnlockDc(pdc);
1349  return Ret;
1350 }
#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 ERROR_INVALID_HANDLE
Definition: compat.h:88
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG cx
Definition: windef.h:319
Definition: polytest.cpp:40
static VOID FASTCALL DC_vGetAspectRatioFilter(PDC pDC, LPSIZE AspectRatio)
Definition: coord.c:1271
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
_In_ UINT iPoint
Definition: ntgdi.h:2197
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
FORCEINLINE PSIZEL DC_pszlViewportExt(PDC pdc)
Definition: coord.h:74
LONG cy
Definition: windef.h:320
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by co_UserExcludeUpdateRgn(), GreGetDCOrgEx(), GreGetViewportExtEx(), GreGetWindowExtEx(), and NtGdiGetDCPoint().

◆ GreGetViewportExtEx()

BOOL WINAPI GreGetViewportExtEx ( _In_ HDC  hdc,
_Out_ LPSIZE  lpSize 
)

Definition at line 1413 of file coord.c.

1416 {
1417  return GreGetDCPoint(hdc, GdiGetViewPortExt, (PPOINTL)lpSize);
1418 }
HDC hdc
Definition: main.c:9
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1288

Referenced by DrawTextExWorker().

◆ GreGetWindowExtEx()

BOOL WINAPI GreGetWindowExtEx ( _In_ HDC  hdc,
_Out_ LPSIZE  lpSize 
)

Definition at line 1404 of file coord.c.

1407 {
1408  return GreGetDCPoint(hdc, GdiGetWindowExt, (PPOINTL)lpSize);
1409 }
HDC hdc
Definition: main.c:9
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1288

Referenced by DrawTextExWorker().

◆ GreLPtoDP()

BOOL FASTCALL GreLPtoDP ( HDC  ,
LPPOINT  ,
INT   
)

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

◆ GreModifyWorldTransform()

BOOL NTAPI GreModifyWorldTransform ( PDC  pdc,
const XFORML pXForm,
DWORD  dwMode 
)

Definition at line 458 of file coord.c.

462 {
463  MATRIX mxSrc;
464  XFORMOBJ xoSrc, xoDC;
465 
466  switch (dwMode)
467  {
468  case MWT_IDENTITY:
469  pdc->pdcattr->mxWorldToPage = gmxIdentity;
470  break;
471 
472  case MWT_LEFTMULTIPLY:
473  XFORMOBJ_vInit(&xoDC, &pdc->pdcattr->mxWorldToPage);
474  XFORMOBJ_vInit(&xoSrc, &mxSrc);
475  if (XFORMOBJ_iSetXform(&xoSrc, pxform) == DDI_ERROR)
476  return FALSE;
477  XFORMOBJ_iCombine(&xoDC, &xoSrc, &xoDC);
478  break;
479 
480  case MWT_RIGHTMULTIPLY:
481  XFORMOBJ_vInit(&xoDC, &pdc->pdcattr->mxWorldToPage);
482  XFORMOBJ_vInit(&xoSrc, &mxSrc);
483  if (XFORMOBJ_iSetXform(&xoSrc, pxform) == DDI_ERROR)
484  return FALSE;
485  XFORMOBJ_iCombine(&xoDC, &xoDC, &xoSrc);
486  break;
487 
488  case MWT_SET:
489  XFORMOBJ_vInit(&xoDC, &pdc->pdcattr->mxWorldToPage);
490  if (XFORMOBJ_iSetXform(&xoDC, pxform) == DDI_ERROR)
491  return FALSE;
492  break;
493 
494  default:
495  return FALSE;
496  }
497 
498  /*Set invalidation flags */
499  pdc->pdcattr->flXform |= WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID;
500 
501  return TRUE;
502 }
#define TRUE
Definition: types.h:120
#define MWT_SET
Definition: ntgdityp.h:179
#define MWT_LEFTMULTIPLY
Definition: wingdi.h:944
#define XFORMOBJ_iSetXform
Definition: xformobj.h:14
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define DDI_ERROR
Definition: winddi.h:154
Definition: matrix.h:43
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
#define XFORMOBJ_iCombine
Definition: xformobj.h:15
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
#define MWT_IDENTITY
Definition: wingdi.h:943
const MATRIX gmxIdentity
Definition: coord.c:80
#define MWT_RIGHTMULTIPLY
Definition: wingdi.h:945

Referenced by NtGdiModifyWorldTransform(), PATH_FillPathEx(), and PATH_StrokePath().

◆ GreSetDCOrg()

BOOL WINAPI GreSetDCOrg ( _In_  HDC,
_In_  LONG,
_In_  LONG,
_In_opt_  PRECTL 
)

Definition at line 1354 of file coord.c.

1359 {
1360  PDC dc;
1361 
1362  dc = DC_LockDc(hdc);
1363  if (!dc) return FALSE;
1364 
1365  /* Set DC Origin */
1366  dc->ptlDCOrig.x = x;
1367  dc->ptlDCOrig.y = y;
1368 
1369  /* Recalculate Fill Origin */
1370  dc->ptlFillOrigin.x = dc->dclevel.ptlBrushOrigin.x + x;
1371  dc->ptlFillOrigin.y = dc->dclevel.ptlBrushOrigin.y + y;
1372 
1373  /* Set DC Window Rectangle */
1374  if (Rect)
1375  dc->erclWindow = *Rect;
1376 
1377  DC_UnlockDc(dc);
1378  return TRUE;
1379 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
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
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
struct Rect Rect

Referenced by DceSetDrawable().

◆ GreSetViewportOrgEx()

BOOL FASTCALL GreSetViewportOrgEx ( HDC  ,
int  ,
int  ,
LPPOINT   
)

Definition at line 912 of file coord.c.

917 {
918  PDC dc;
919  PDC_ATTR pdcattr;
920 
921  dc = DC_LockDc(hDC);
922  if (!dc)
923  {
925  return FALSE;
926  }
927  pdcattr = dc->pdcattr;
928 
929  if (Point)
930  {
931  Point->x = pdcattr->ptlViewportOrg.x;
932  Point->y = pdcattr->ptlViewportOrg.y;
933  }
934 
935  pdcattr->ptlViewportOrg.x = X;
936  pdcattr->ptlViewportOrg.y = Y;
938 
939  DC_UnlockDc(dc);
940  return TRUE;
941 }
POINTL ptlViewportOrg
Definition: ntgdihdl.h:347
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define Y(I)
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HDC dc
Definition: cylfrac.c:34
LONG y
Definition: windef.h:315
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
Definition: polytest.cpp:40
LONG x
Definition: windef.h:314
FLONG flXform
Definition: ntgdihdl.h:349
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)

Referenced by MENU_DrawBitmapItem().

◆ IntGdiSetMapMode()

int APIENTRY IntGdiSetMapMode ( PDC  ,
int   
)

Definition at line 825 of file coord.c.

828 {
829  INT iPrevMapMode;
830  FLONG flXform;
831  PDC_ATTR pdcattr = dc->pdcattr;
832 
833  if (MapMode == pdcattr->iMapMode)
834  return MapMode;
835 
836  flXform = pdcattr->flXform & ~(ISO_OR_ANISO_MAP_MODE|PTOD_EFM22_NEGATIVE|
839 
840  switch (MapMode)
841  {
842  case MM_TEXT:
843  pdcattr->szlWindowExt.cx = 1;
844  pdcattr->szlWindowExt.cy = 1;
845  pdcattr->szlViewportExt.cx = 1;
846  pdcattr->szlViewportExt.cy = 1;
848  break;
849 
850  case MM_ISOTROPIC:
851  flXform |= ISO_OR_ANISO_MAP_MODE;
852  /* Fall through */
853 
854  case MM_LOMETRIC:
855  pdcattr->szlWindowExt.cx = pdcattr->szlVirtualDeviceMm.cx * 10;
856  pdcattr->szlWindowExt.cy = pdcattr->szlVirtualDeviceMm.cy * 10;
857  pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
858  pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
859  break;
860 
861  case MM_HIMETRIC:
862  pdcattr->szlWindowExt.cx = pdcattr->szlVirtualDeviceMm.cx * 100;
863  pdcattr->szlWindowExt.cy = pdcattr->szlVirtualDeviceMm.cy * 100;
864  pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
865  pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
866  break;
867 
868  case MM_LOENGLISH:
869  pdcattr->szlWindowExt.cx = MulDiv(1000, pdcattr->szlVirtualDeviceMm.cx, 254);
870  pdcattr->szlWindowExt.cy = MulDiv(1000, pdcattr->szlVirtualDeviceMm.cy, 254);
871  pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
872  pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
873  break;
874 
875  case MM_HIENGLISH:
876  pdcattr->szlWindowExt.cx = MulDiv(10000, pdcattr->szlVirtualDeviceMm.cx, 254);
877  pdcattr->szlWindowExt.cy = MulDiv(10000, pdcattr->szlVirtualDeviceMm.cy, 254);
878  pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
879  pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
880  break;
881 
882  case MM_TWIPS:
883  pdcattr->szlWindowExt.cx = MulDiv(14400, pdcattr->szlVirtualDeviceMm.cx, 254);
884  pdcattr->szlWindowExt.cy = MulDiv(14400, pdcattr->szlVirtualDeviceMm.cy, 254);
885  pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
886  pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
887  break;
888 
889  case MM_ANISOTROPIC:
891  flXform |= ISO_OR_ANISO_MAP_MODE;
892  break;
893 
894  default:
895  return 0;
896  }
897 
898  /* Save the old map mode and set the new one */
899  iPrevMapMode = pdcattr->iMapMode;
900  pdcattr->iMapMode = MapMode;
901 
902  /* Update xform flags */
903  pdcattr->flXform = flXform | (PAGE_XLATE_CHANGED | PAGE_EXTENTS_CHANGED |
906 
907  return iPrevMapMode;
908 }
#define MM_ISOTROPIC
Definition: wingdi.h:869
#define PAGE_TO_DEVICE_IDENTITY
Definition: ntgdihdl.h:199
#define POSITIVE_Y_IS_UP
Definition: ntgdihdl.h:194
INT iMapMode
Definition: ntgdihdl.h:342
HDC dc
Definition: cylfrac.c:34
int32_t INT
Definition: typedefs.h:56
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
#define ISO_OR_ANISO_MAP_MODE
Definition: ntgdihdl.h:198
LONG cx
Definition: windef.h:319
unsigned long FLONG
Definition: ntbasedef.h:373
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:202
#define MM_LOMETRIC
Definition: wingdi.h:871
#define DEVICE_TO_PAGE_INVALID
Definition: ntgdihdl.h:191
#define MM_LOENGLISH
Definition: wingdi.h:870
#define MM_ANISOTROPIC
Definition: wingdi.h:866
FLONG flXform
Definition: ntgdihdl.h:349
#define MM_TWIPS
Definition: wingdi.h:873
SIZEL szlWindowExt
Definition: ntgdihdl.h:346
#define PTOD_EFM22_NEGATIVE
Definition: ntgdihdl.h:197
SIZEL szlVirtualDevicePixel
Definition: ntgdihdl.h:350
#define PAGE_TO_DEVICE_SCALE_IDENTITY
Definition: ntgdihdl.h:200
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
#define MM_HIMETRIC
Definition: wingdi.h:868
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
#define MM_TEXT
Definition: wingdi.h:872
SIZEL szlViewportExt
Definition: ntgdihdl.h:348
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:195
LONG cy
Definition: windef.h:320
#define MM_HIENGLISH
Definition: wingdi.h:867
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
SIZEL szlVirtualDeviceMm
Definition: ntgdihdl.h:351
#define PTOD_EFM11_NEGATIVE
Definition: ntgdihdl.h:196

Referenced by _Success_(), and PATH_FillPathEx().

◆ IntMirrorWindowOrg()

VOID FASTCALL IntMirrorWindowOrg ( PDC  )

Definition at line 1052 of file coord.c.

1053 {
1054  PDC_ATTR pdcattr;
1055  LONG X, cx;
1056 
1057  pdcattr = dc->pdcattr;
1058 
1059  if (!(pdcattr->dwLayout & LAYOUT_RTL))
1060  {
1061  pdcattr->ptlWindowOrg.x = pdcattr->lWindowOrgx; // Flip it back.
1062  return;
1063  }
1064 
1065  /* Copy the window extension, so no one can mess with it */
1066  cx = pdcattr->szlViewportExt.cx;
1067  if (cx == 0) return;
1068  //
1069  // WOrgx = wox - (Width - 1) * WExtx / VExtx
1070  //
1071  X = (dc->erclWindow.right - dc->erclWindow.left) - 1; // Get device width - 1
1072 
1073  X = (X * pdcattr->szlWindowExt.cx) / cx;
1074 
1075  pdcattr->ptlWindowOrg.x = pdcattr->lWindowOrgx - X; // Now set the inverted win origion.
1077 
1078  return;
1079 }
#define LAYOUT_RTL
Definition: wingdi.h:1370
HDC dc
Definition: cylfrac.c:34
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
long LONG
Definition: pedump.c:60
LONG cx
Definition: windef.h:319
LONG x
Definition: windef.h:314
LONG lWindowOrgx
Definition: ntgdihdl.h:344
FLONG flXform
Definition: ntgdihdl.h:349
SIZEL szlWindowExt
Definition: ntgdihdl.h:346
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
_Out_opt_ int * cx
Definition: commctrl.h:570
SIZEL szlViewportExt
Definition: ntgdihdl.h:348
DWORD dwLayout
Definition: ntgdihdl.h:343
#define X(b, s)
POINTL ptlWindowOrg
Definition: ntgdihdl.h:345

Referenced by NtGdiMirrorWindowOrg(), NtGdiScaleViewportExtEx(), and NtGdiScaleWindowExtEx().

◆ InvertXform()

FORCEINLINE void InvertXform ( XFORML pxformDest,
const XFORML pxformSource 
)

Definition at line 47 of file coord.h.

50 {
51  XFORMOBJ xo;
52  MATRIX mx;
53 
54  XFORMOBJ_vInit(&xo, &mx);
55  XFORMOBJ_iSetXform(&xo, pxformSource);
56  XFORMOBJ_iInverse(&xo, &xo);
57  XFORMOBJ_iGetXform(&xo, pxformDest);
58 }
#define XFORMOBJ_iInverse
Definition: xformobj.h:17
#define XFORMOBJ_iSetXform
Definition: xformobj.h:14
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define XFORMOBJ_iGetXform
Definition: xformobj.h:9
Definition: matrix.h:43

◆ MatrixToXForm()

FORCEINLINE void MatrixToXForm ( XFORML pxform,
const MATRIX pmx 
)

Definition at line 36 of file coord.h.

39 {
40  XFORMOBJ xo;
41  XFORMOBJ_vInit(&xo, (MATRIX*)pmx);
42  XFORMOBJ_iGetXform(&xo, pxform);
43 }
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define XFORMOBJ_iGetXform
Definition: xformobj.h:9
Definition: matrix.h:43

◆ XFormToMatrix()

FORCEINLINE void XFormToMatrix ( MATRIX pmx,
const XFORML pxform 
)

Definition at line 25 of file coord.h.

28 {
29  XFORMOBJ xo;
30  XFORMOBJ_vInit(&xo, pmx);
31  XFORMOBJ_iSetXform(&xo, pxform);
32 }
#define XFORMOBJ_iSetXform
Definition: xformobj.h:14
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21