ReactOS  r76032
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, IN PPOINTL pptlDest, IN PPOINTL pptlSource)
 
FORCEINLINE VOID DC_vXformWorldToDevice (IN PDC pdc, IN ULONG cNumPoints, IN 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

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

Definition at line 15 of file coord.h.

#define CoordLPtoDP (   pdc,
  ppt 
)    DC_vXformWorldToDevice(pdc, 1, (PPOINTL)(ppt), (PPOINTL)(ppt));
#define IntDPtoLP (   pdc,
  ppt,
  count 
)
Value:
FORCEINLINE VOID DC_vXformDeviceToWorld(IN PDC pdc, IN ULONG cNumPoints, IN PPOINTL pptlDest, IN PPOINTL pptlSource)
Definition: coord.h:124
GLuint GLuint GLsizei count
Definition: gl.h:1545
VOID FASTCALL DC_vUpdateDeviceToWorld(PDC pdc)
Definition: coord.c:203

Definition at line 12 of file coord.h.

Referenced by _Success_(), GreDPtoLP(), IntGdiMoveToEx(), NtGdiGetBoundsRect(), and PATH_StrokePath().

#define MatrixS2XForm (   x,
  m 
)    MatrixToXForm((XFORML*)x, m)
#define MAX_COORD   (INT_MAX / 16)

Definition at line 5 of file coord.h.

Referenced by HandleStyles(), REGION_bMakeFrameRegion(), and REGION_bOffsetRgn().

#define MIN_COORD   (INT_MIN / 16)

Definition at line 4 of file coord.h.

Referenced by REGION_bMakeFrameRegion(), and REGION_bOffsetRgn().

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

Definition at line 18 of file coord.h.

Referenced by PATH_StrokePath().

Function Documentation

FORCEINLINE PMATRIX DC_pmxDeviceToWorld ( PDC  pdc)

Definition at line 110 of file coord.h.

Referenced by DC_vXformDeviceToWorld(), and NtGdiGetTransform().

111 {
112  /* Check if the device-to-world xform is invalid */
113  if (pdc->pdcattr->flXform & DEVICE_TO_WORLD_INVALID)
114  {
115  /* Update the world-to-device xform */
117  }
118 
119  return &pdc->pdcattr->mxDeviceToWorld;
120 }
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
VOID FASTCALL DC_vUpdateDeviceToWorld(PDC pdc)
Definition: coord.c:203
FORCEINLINE PMATRIX DC_pmxWorldToDevice ( PDC  pdc)

Definition at line 96 of file coord.h.

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

97 {
98  /* Check if world or page xform was changed */
99  if (pdc->pdcattr->flXform & (PAGE_XLATE_CHANGED|PAGE_EXTENTS_CHANGED|WORLD_XFORM_CHANGED))
100  {
101  /* Update the world-to-device xform */
103  }
104 
105  return &pdc->pdcattr->mxWorldToDevice;
106 }
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:197
VOID FASTCALL DC_vUpdateWorldToDevice(PDC pdc)
Definition: coord.c:181
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:198
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:199
FORCEINLINE PMATRIX DC_pmxWorldToPage ( PDC  pdc)

Definition at line 89 of file coord.h.

Referenced by NtGdiGetTransform().

90 {
91  return &pdc->pdcattr->mxWorldToPage;
92 }
FORCEINLINE PSIZEL DC_pszlViewportExt ( PDC  pdc)

Definition at line 72 of file coord.h.

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

73 {
74  PDC_ATTR pdcattr = pdc->pdcattr;
75 
76  /* Check if we need isotropic fixup */
77  if ((pdcattr->flXform & PAGE_EXTENTS_CHANGED) &&
78  (pdcattr->iMapMode == MM_ISOTROPIC))
79  {
80  /* Fixup viewport extension */
82  }
83 
84  return &pdcattr->szlViewportExt;
85 }
#define MM_ISOTROPIC
Definition: wingdi.h:868
INT iMapMode
Definition: ntgdihdl.h:335
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:198
FLONG flXform
Definition: ntgdihdl.h:342
SIZEL szlViewportExt
Definition: ntgdihdl.h:341
VOID FASTCALL DC_vFixIsotropicMapping(PDC pdc)
Definition: coord.c:92
VOID FASTCALL DC_vFixIsotropicMapping ( PDC  pdc)

Definition at line 92 of file coord.c.

Referenced by DC_pszlViewportExt(), and NtGdiScaleViewportExtEx().

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

Definition at line 203 of file coord.c.

Referenced by DC_pmxDeviceToWorld().

204 {
205  XFORMOBJ xoWorldToDevice, xoDeviceToWorld;
206  PMATRIX pmxWorldToDevice;
207 
208  /* Get the world-to-device translation */
209  pmxWorldToDevice = DC_pmxWorldToDevice(pdc);
210  XFORMOBJ_vInit(&xoWorldToDevice, pmxWorldToDevice);
211 
212  /* Create inverse of world-to-device transformation */
213  XFORMOBJ_vInit(&xoDeviceToWorld, &pdc->pdcattr->mxDeviceToWorld);
214  if (XFORMOBJ_iInverse(&xoDeviceToWorld, &xoWorldToDevice) == DDI_ERROR)
215  {
216  // FIXME: do we need to reset anything?
217  return;
218  }
219 
220  /* Reset the flag */
221  pdc->pdcattr->flXform &= ~DEVICE_TO_WORLD_INVALID;
222 }
#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
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:96
VOID FASTCALL DC_vUpdateWorldToDevice ( PDC  pdc)

Definition at line 181 of file coord.c.

Referenced by DC_pmxWorldToDevice().

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

Definition at line 124 of file coord.h.

Referenced by NtGdiTransformPoints().

129 {
130  XFORMOBJ xo;
131  PMATRIX pmx;
132 
133  pmx = DC_pmxDeviceToWorld(pdc);
134  XFORMOBJ_vInit(&xo, pmx);
135  XFORMOBJ_bApplyXform(&xo, XF_LTOL, cNumPoints, pptlDest, pptlSource);
136 }
#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_pmxDeviceToWorld(PDC pdc)
Definition: coord.h:110
FORCEINLINE VOID DC_vXformWorldToDevice ( IN PDC  pdc,
IN ULONG  cNumPoints,
IN PPOINTL  pptlDest,
IN PPOINTL  pptlSource 
)

Definition at line 140 of file coord.h.

Referenced by NtGdiTransformPoints().

145 {
146  XFORMOBJ xo;
147  PMATRIX pmx;
148 
149  pmx = DC_pmxWorldToDevice(pdc);
150  XFORMOBJ_vInit(&xo, pmx);
151  XFORMOBJ_bApplyXform(&xo, XF_LTOL, cNumPoints, pptlDest, pptlSource);
152 }
#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:96
BOOL FASTCALL GreDPtoLP ( HDC  ,
LPPOINT  ,
INT   
)

Definition at line 7 of file dcutil.c.

Referenced by co_UserGetUpdateRect(), and IntDefWindowProc().

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
#define FALSE
Definition: types.h:117
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
BOOL WINAPI GreGetDCOrgEx ( _In_  HDC,
_Out_  PPOINTL,
_Out_  PRECTL 
)

Definition at line 1369 of file coord.c.

1373 {
1374  PDC dc;
1375 
1376  dc = DC_LockDc(hdc);
1377  if (!dc) return FALSE;
1378 
1379  /* Retrieve DC Window Rectangle without a check */
1380  *Rect = dc->erclWindow;
1381 
1382  DC_UnlockDc(dc);
1383 
1384  /* Use default call for DC Origin and parameter checking */
1385  return GreGetDCPoint( hdc, GdiGetDCOrg, Point);
1386 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
HDC dc
Definition: cylfrac.c:34
#define FALSE
Definition: types.h:117
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1274
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
BOOL APIENTRY GreGetDCPoint ( HDC  ,
UINT  ,
PPOINTL   
)

Definition at line 1274 of file coord.c.

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

1278 {
1279  BOOL Ret = TRUE;
1280  DC *pdc;
1281  SIZE Size;
1282  PSIZEL pszlViewportExt;
1283 
1284  if (!Point)
1285  {
1287  return FALSE;
1288  }
1289 
1290  pdc = DC_LockDc(hDC);
1291  if (!pdc)
1292  {
1294  return FALSE;
1295  }
1296 
1297  switch (iPoint)
1298  {
1299  case GdiGetViewPortExt:
1300  pszlViewportExt = DC_pszlViewportExt(pdc);
1301  Point->x = pszlViewportExt->cx;
1302  Point->y = pszlViewportExt->cy;
1303  break;
1304 
1305  case GdiGetWindowExt:
1306  Point->x = pdc->pdcattr->szlWindowExt.cx;
1307  Point->y = pdc->pdcattr->szlWindowExt.cy;
1308  break;
1309 
1310  case GdiGetViewPortOrg:
1311  *Point = pdc->pdcattr->ptlViewportOrg;
1312  break;
1313 
1314  case GdiGetWindowOrg:
1315  *Point = pdc->pdcattr->ptlWindowOrg;
1316  break;
1317 
1318  case GdiGetDCOrg:
1319  *Point = pdc->ptlDCOrig;
1320  break;
1321 
1323  DC_vGetAspectRatioFilter(pdc, &Size);
1324  Point->x = Size.cx;
1325  Point->y = Size.cy;
1326  break;
1327 
1328  default:
1330  Ret = FALSE;
1331  break;
1332  }
1333 
1334  DC_UnlockDc(pdc);
1335  return Ret;
1336 }
#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
#define FALSE
Definition: types.h:117
LONG cx
Definition: windef.h:347
UINTN Size
Definition: acefiex.h:555
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
unsigned int BOOL
Definition: ntddk_ex.h:94
static VOID FASTCALL DC_vGetAspectRatioFilter(PDC pDC, LPSIZE AspectRatio)
Definition: coord.c:1257
_In_ UINT iPoint
Definition: ntgdi.h:2197
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
FORCEINLINE PSIZEL DC_pszlViewportExt(PDC pdc)
Definition: coord.h:72
LONG cy
Definition: windef.h:348
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
BOOL WINAPI GreGetViewportExtEx ( _In_ HDC  hdc,
_Out_ LPSIZE  lpSize 
)

Definition at line 1399 of file coord.c.

Referenced by DrawTextExWorker().

1402 {
1403  return GreGetDCPoint(hdc, GdiGetViewPortExt, (PPOINTL)lpSize);
1404 }
HDC hdc
Definition: msvc.h:53
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1274
BOOL WINAPI GreGetWindowExtEx ( _In_ HDC  hdc,
_Out_ LPSIZE  lpSize 
)

Definition at line 1390 of file coord.c.

Referenced by DrawTextExWorker().

1393 {
1394  return GreGetDCPoint(hdc, GdiGetWindowExt, (PPOINTL)lpSize);
1395 }
HDC hdc
Definition: msvc.h:53
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1274
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
#define FALSE
Definition: types.h:117
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
#define IntLPtoDP(pdc, ppt, count)
Definition: coord.h:7
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
BOOL NTAPI GreModifyWorldTransform ( PDC  pdc,
const XFORML pXForm,
DWORD  dwMode 
)

Definition at line 453 of file coord.c.

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

457 {
458  MATRIX mxSrc;
459  XFORMOBJ xoSrc, xoDC;
460 
461  switch (dwMode)
462  {
463  case MWT_IDENTITY:
464  pdc->pdcattr->mxWorldToPage = gmxIdentity;
465  break;
466 
467  case MWT_LEFTMULTIPLY:
468  XFORMOBJ_vInit(&xoDC, &pdc->pdcattr->mxWorldToPage);
469  XFORMOBJ_vInit(&xoSrc, &mxSrc);
470  if (XFORMOBJ_iSetXform(&xoSrc, pxform) == DDI_ERROR)
471  return FALSE;
472  XFORMOBJ_iCombine(&xoDC, &xoSrc, &xoDC);
473  break;
474 
475  case MWT_RIGHTMULTIPLY:
476  XFORMOBJ_vInit(&xoDC, &pdc->pdcattr->mxWorldToPage);
477  XFORMOBJ_vInit(&xoSrc, &mxSrc);
478  if (XFORMOBJ_iSetXform(&xoSrc, pxform) == DDI_ERROR)
479  return FALSE;
480  XFORMOBJ_iCombine(&xoDC, &xoDC, &xoSrc);
481  break;
482 
483  case MWT_MAX+1: // Must be MWT_SET????
484  XFORMOBJ_vInit(&xoDC, &pdc->pdcattr->mxWorldToPage);
485  if (XFORMOBJ_iSetXform(&xoDC, pxform) == DDI_ERROR)
486  return FALSE;
487  break;
488 
489  default:
490  return FALSE;
491  }
492 
493  /*Set invalidation flags */
494  pdc->pdcattr->flXform |= WORLD_XFORM_CHANGED|DEVICE_TO_WORLD_INVALID;
495 
496  return TRUE;
497 }
#define TRUE
Definition: types.h:120
#define MWT_LEFTMULTIPLY
Definition: wingdi.h:943
#define XFORMOBJ_iSetXform
Definition: xformobj.h:14
#define MWT_MAX
Definition: wingdi.h:946
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
#define FALSE
Definition: types.h:117
#define DDI_ERROR
Definition: winddi.h:154
Definition: matrix.h:43
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:199
#define XFORMOBJ_iCombine
Definition: xformobj.h:15
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
#define MWT_IDENTITY
Definition: wingdi.h:942
const MATRIX gmxIdentity
Definition: coord.c:79
DWORD HDC HDC DVTARGETDEVICE DWORD dwMode
Definition: msvc.h:106
#define MWT_RIGHTMULTIPLY
Definition: wingdi.h:944
BOOL WINAPI GreSetDCOrg ( _In_  HDC,
_In_  LONG,
_In_  LONG,
_In_opt_  PRECTL 
)

Definition at line 1340 of file coord.c.

Referenced by DceSetDrawable().

1345 {
1346  PDC dc;
1347 
1348  dc = DC_LockDc(hdc);
1349  if (!dc) return FALSE;
1350 
1351  /* Set DC Origin */
1352  dc->ptlDCOrig.x = x;
1353  dc->ptlDCOrig.y = y;
1354 
1355  /* Recalculate Fill Origin */
1356  dc->ptlFillOrigin.x = dc->dclevel.ptlBrushOrigin.x + x;
1357  dc->ptlFillOrigin.y = dc->dclevel.ptlBrushOrigin.y + y;
1358 
1359  /* Set DC Window Rectangle */
1360  if (Rect)
1361  dc->erclWindow = *Rect;
1362 
1363  DC_UnlockDc(dc);
1364  return TRUE;
1365 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
HDC dc
Definition: cylfrac.c:34
#define FALSE
Definition: types.h:117
HDC hdc
Definition: msvc.h:53
Definition: polytest.cpp:40
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
INT INT y
Definition: msvc.h:62
struct Rect Rect
INT x
Definition: msvc.h:62
BOOL FASTCALL GreSetViewportOrgEx ( HDC  ,
int  ,
int  ,
LPPOINT   
)

Definition at line 899 of file coord.c.

Referenced by MENU_DrawBitmapItem().

904 {
905  PDC dc;
906  PDC_ATTR pdcattr;
907 
908  dc = DC_LockDc(hDC);
909  if (!dc)
910  {
912  return FALSE;
913  }
914  pdcattr = dc->pdcattr;
915 
916  if (Point)
917  {
918  Point->x = pdcattr->ptlViewportOrg.x;
919  Point->y = pdcattr->ptlViewportOrg.y;
920  }
921 
922  pdcattr->ptlViewportOrg.x = X;
923  pdcattr->ptlViewportOrg.y = Y;
924  pdcattr->flXform |= PAGE_XLATE_CHANGED;
925 
926  DC_UnlockDc(dc);
927  return TRUE;
928 }
POINTL ptlViewportOrg
Definition: ntgdihdl.h:340
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define Y(i)
Definition: t_vb_render.c:49
HDC dc
Definition: cylfrac.c:34
LONG y
Definition: windef.h:343
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:197
#define FALSE
Definition: types.h:117
HDC hDC
Definition: wglext.h:521
Definition: polytest.cpp:40
LONG x
Definition: windef.h:342
FLONG flXform
Definition: ntgdihdl.h:342
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)
int APIENTRY IntGdiSetMapMode ( PDC  ,
int   
)

Definition at line 816 of file coord.c.

Referenced by _Success_(), and PATH_FillPath().

819 {
820  INT iPrevMapMode;
821  FLONG flXform;
822  PDC_ATTR pdcattr = dc->pdcattr;
823 
824  flXform = pdcattr->flXform & ~(ISO_OR_ANISO_MAP_MODE|PTOD_EFM22_NEGATIVE|
827 
828  switch (MapMode)
829  {
830  case MM_TEXT:
831  pdcattr->szlWindowExt.cx = 1;
832  pdcattr->szlWindowExt.cy = 1;
833  pdcattr->szlViewportExt.cx = 1;
834  pdcattr->szlViewportExt.cy = 1;
836  break;
837 
838  case MM_ISOTROPIC:
839  flXform |= ISO_OR_ANISO_MAP_MODE;
840  /* Fall through */
841 
842  case MM_LOMETRIC:
843  pdcattr->szlWindowExt.cx = pdcattr->szlVirtualDeviceMm.cx * 10;
844  pdcattr->szlWindowExt.cy = pdcattr->szlVirtualDeviceMm.cy * 10;
845  pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
846  pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
847  break;
848 
849  case MM_HIMETRIC:
850  pdcattr->szlWindowExt.cx = pdcattr->szlVirtualDeviceMm.cx * 100;
851  pdcattr->szlWindowExt.cy = pdcattr->szlVirtualDeviceMm.cy * 100;
852  pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
853  pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
854  break;
855 
856  case MM_LOENGLISH:
857  pdcattr->szlWindowExt.cx = MulDiv(1000, pdcattr->szlVirtualDeviceMm.cx, 254);
858  pdcattr->szlWindowExt.cy = MulDiv(1000, pdcattr->szlVirtualDeviceMm.cy, 254);
859  pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
860  pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
861  break;
862 
863  case MM_HIENGLISH:
864  pdcattr->szlWindowExt.cx = MulDiv(10000, pdcattr->szlVirtualDeviceMm.cx, 254);
865  pdcattr->szlWindowExt.cy = MulDiv(10000, pdcattr->szlVirtualDeviceMm.cy, 254);
866  pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
867  pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
868  break;
869 
870  case MM_TWIPS:
871  pdcattr->szlWindowExt.cx = MulDiv(14400, pdcattr->szlVirtualDeviceMm.cx, 254);
872  pdcattr->szlWindowExt.cy = MulDiv(14400, pdcattr->szlVirtualDeviceMm.cy, 254);
873  pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
874  pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
875  break;
876 
877  case MM_ANISOTROPIC:
879  flXform |= ISO_OR_ANISO_MAP_MODE;
880  break;
881 
882  default:
883  return 0;
884  }
885 
886  /* Save the old map mode and set the new one */
887  iPrevMapMode = pdcattr->iMapMode;
888  pdcattr->iMapMode = MapMode;
889 
890  /* Update xform flags */
891  pdcattr->flXform = flXform | (PAGE_XLATE_CHANGED|PAGE_EXTENTS_CHANGED|
893 
894  return iPrevMapMode;
895 }
#define MM_ISOTROPIC
Definition: wingdi.h:868
#define PAGE_TO_DEVICE_IDENTITY
Definition: ntgdihdl.h:195
#define POSITIVE_Y_IS_UP
Definition: ntgdihdl.h:190
INT iMapMode
Definition: ntgdihdl.h:335
HDC dc
Definition: cylfrac.c:34
int32_t INT
Definition: typedefs.h:56
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:197
#define ISO_OR_ANISO_MAP_MODE
Definition: ntgdihdl.h:194
LONG cx
Definition: windef.h:347
unsigned long FLONG
Definition: ntbasedef.h:365
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:198
#define MM_LOMETRIC
Definition: wingdi.h:870
#define DEVICE_TO_PAGE_INVALID
Definition: ntgdihdl.h:187
#define MM_LOENGLISH
Definition: wingdi.h:869
#define MM_ANISOTROPIC
Definition: wingdi.h:865
FLONG flXform
Definition: ntgdihdl.h:342
#define MM_TWIPS
Definition: wingdi.h:872
SIZEL szlWindowExt
Definition: ntgdihdl.h:339
#define PTOD_EFM22_NEGATIVE
Definition: ntgdihdl.h:193
SIZEL szlVirtualDevicePixel
Definition: ntgdihdl.h:343
#define PAGE_TO_DEVICE_SCALE_IDENTITY
Definition: ntgdihdl.h:196
#define MM_HIMETRIC
Definition: wingdi.h:867
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
#define MM_TEXT
Definition: wingdi.h:871
SIZEL szlViewportExt
Definition: ntgdihdl.h:341
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:191
LONG cy
Definition: windef.h:348
#define MM_HIENGLISH
Definition: wingdi.h:866
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
SIZEL szlVirtualDeviceMm
Definition: ntgdihdl.h:344
#define PTOD_EFM11_NEGATIVE
Definition: ntgdihdl.h:192
VOID FASTCALL IntMirrorWindowOrg ( PDC  )

Definition at line 1039 of file coord.c.

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

1040 {
1041  PDC_ATTR pdcattr;
1042  LONG X, cx;
1043 
1044  pdcattr = dc->pdcattr;
1045 
1046  if (!(pdcattr->dwLayout & LAYOUT_RTL))
1047  {
1048  pdcattr->ptlWindowOrg.x = pdcattr->lWindowOrgx; // Flip it back.
1049  return;
1050  }
1051 
1052  /* Copy the window extension, so no one can mess with it */
1053  cx = pdcattr->szlViewportExt.cx;
1054  if (cx == 0) return;
1055  //
1056  // WOrgx = wox - (Width - 1) * WExtx / VExtx
1057  //
1058  X = (dc->erclWindow.right - dc->erclWindow.left) - 1; // Get device width - 1
1059 
1060  X = (X * pdcattr->szlWindowExt.cx) / cx;
1061 
1062  pdcattr->ptlWindowOrg.x = pdcattr->lWindowOrgx - X; // Now set the inverted win origion.
1063  pdcattr->flXform |= PAGE_XLATE_CHANGED;
1064 
1065  return;
1066 }
#define LAYOUT_RTL
Definition: wingdi.h:1352
HDC dc
Definition: cylfrac.c:34
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:197
long LONG
Definition: pedump.c:60
LONG cx
Definition: windef.h:347
LONG x
Definition: windef.h:342
LONG lWindowOrgx
Definition: ntgdihdl.h:337
FLONG flXform
Definition: ntgdihdl.h:342
SIZEL szlWindowExt
Definition: ntgdihdl.h:339
_Out_opt_ int * cx
Definition: commctrl.h:570
SIZEL szlViewportExt
Definition: ntgdihdl.h:341
DWORD dwLayout
Definition: ntgdihdl.h:336
#define X(b, s)
POINTL ptlWindowOrg
Definition: ntgdihdl.h:338
FORCEINLINE void InvertXform ( XFORML pxformDest,
const XFORML pxformSource 
)

Definition at line 45 of file coord.h.

48 {
49  XFORMOBJ xo;
50  MATRIX mx;
51 
52  XFORMOBJ_vInit(&xo, &mx);
53  XFORMOBJ_iSetXform(&xo, pxformSource);
54  XFORMOBJ_iInverse(&xo, &xo);
55  XFORMOBJ_iGetXform(&xo, pxformDest);
56 }
#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
FORCEINLINE void MatrixToXForm ( XFORML pxform,
const MATRIX pmx 
)

Definition at line 34 of file coord.h.

37 {
38  XFORMOBJ xo;
39  XFORMOBJ_vInit(&xo, (MATRIX*)pmx);
40  XFORMOBJ_iGetXform(&xo, pxform);
41 }
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
FORCEINLINE void XFormToMatrix ( MATRIX pmx,
const XFORML pxform 
)

Definition at line 23 of file coord.h.

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