ReactOS  0.4.14-dev-554-g2f8d847
coord.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for coord.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 C_ASSERT (sizeof(XFORML)==sizeof(XFORM))
 
VOID FASTCALL DC_vFixIsotropicMapping (PDC pdc)
 
VOID FASTCALL DC_vGetPageToDevice (PDC pdc, MATRIX *pmx)
 
VOID FASTCALL DC_vUpdateWorldToDevice (PDC pdc)
 
VOID FASTCALL DC_vUpdateDeviceToWorld (PDC pdc)
 
BOOL NTAPI GreCombineTransform (XFORML *pxformDest, XFORML *pxform1, XFORML *pxform2)
 
BOOL APIENTRY NtGdiCombineTransform (LPXFORM UnsafeXFormResult, LPXFORM Unsafexform1, LPXFORM Unsafexform2)
 
BOOL APIENTRY NtGdiGetTransform (HDC hdc, DWORD iXform, LPXFORM pXForm)
 
BOOL APIENTRY NtGdiTransformPoints (HDC hDC, PPOINT UnsafePtsIn, PPOINT UnsafePtOut, INT Count, INT iMode)
 
BOOL NTAPI GreModifyWorldTransform (PDC pdc, const XFORML *pxform, DWORD dwMode)
 
BOOL APIENTRY NtGdiModifyWorldTransform (HDC hdc, LPXFORM pxformUnsafe, DWORD dwMode)
 
BOOL APIENTRY NtGdiOffsetViewportOrgEx (HDC hDC, int XOffset, int YOffset, LPPOINT UnsafePoint)
 
BOOL APIENTRY NtGdiOffsetWindowOrgEx (HDC hDC, int XOffset, int YOffset, LPPOINT Point)
 
BOOL APIENTRY NtGdiScaleViewportExtEx (HDC hDC, int Xnum, int Xdenom, int Ynum, int Ydenom, LPSIZE pSize)
 
BOOL APIENTRY NtGdiScaleWindowExtEx (HDC hDC, int Xnum, int Xdenom, int Ynum, int Ydenom, LPSIZE pSize)
 
int APIENTRY IntGdiSetMapMode (PDC dc, int MapMode)
 
BOOL FASTCALL GreSetViewportOrgEx (HDC hDC, int X, int Y, LPPOINT Point)
 
BOOL APIENTRY NtGdiSetViewportOrgEx (HDC hDC, int X, int Y, LPPOINT Point)
 
BOOL APIENTRY NtGdiSetWindowOrgEx (HDC hDC, int X, int Y, LPPOINT Point)
 
VOID FASTCALL IntMirrorWindowOrg (PDC dc)
 
VOID NTAPI DC_vSetLayout (IN PDC pdc, IN LONG wox, IN DWORD dwLayout)
 
DWORD APIENTRY NtGdiSetLayout (IN HDC hdc, IN LONG wox, IN DWORD dwLayout)
 
LONG APIENTRY NtGdiGetDeviceWidth (IN HDC hdc)
 
BOOL APIENTRY NtGdiMirrorWindowOrg (IN HDC hdc)
 
BOOL APIENTRY NtGdiSetSizeDevice (IN HDC hdc, IN INT cxVirtualDevice, IN INT cyVirtualDevice)
 
BOOL APIENTRY NtGdiSetVirtualResolution (IN HDC hdc, IN INT cxVirtualDevicePixel, IN INT cyVirtualDevicePixel, IN INT cxVirtualDeviceMm, IN INT cyVirtualDeviceMm)
 
static VOID FASTCALL DC_vGetAspectRatioFilter (PDC pDC, LPSIZE AspectRatio)
 
BOOL APIENTRY GreGetDCPoint (HDC hDC, UINT iPoint, PPOINTL Point)
 
BOOL WINAPI GreSetDCOrg (_In_ HDC hdc, _In_ LONG x, _In_ LONG y, _In_opt_ PRECTL Rect)
 
BOOL WINAPI GreGetDCOrgEx (_In_ HDC hdc, _Out_ PPOINTL Point, _Out_ PRECTL Rect)
 
BOOL WINAPI GreGetWindowExtEx (_In_ HDC hdc, _Out_ LPSIZE lpSize)
 
BOOL WINAPI GreGetViewportExtEx (_In_ HDC hdc, _Out_ LPSIZE lpSize)
 
BOOL APIENTRY NtGdiGetDCPoint (HDC hDC, UINT iPoint, PPOINTL Point)
 

Variables

const MATRIX gmxIdentity
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 73 of file coord.c.

Function Documentation

◆ C_ASSERT()

C_ASSERT ( sizeof(XFORML = =sizeof(XFORM))

◆ 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:334
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:335

Referenced by DC_pszlViewportExt(), and NtGdiScaleViewportExtEx().

◆ DC_vGetAspectRatioFilter()

static VOID FASTCALL DC_vGetAspectRatioFilter ( PDC  pDC,
LPSIZE  AspectRatio 
)
static

Definition at line 1271 of file coord.c.

1272 {
1273  if (pDC->pdcattr->flFontMapper & 1) // TRUE assume 1.
1274  {
1275  // "This specifies that Windows should only match fonts that have the
1276  // same aspect ratio as the display.", Programming Windows, Fifth Ed.
1277  AspectRatio->cx = pDC->ppdev->gdiinfo.ulLogPixelsX;
1278  AspectRatio->cy = pDC->ppdev->gdiinfo.ulLogPixelsY;
1279  }
1280  else
1281  {
1282  AspectRatio->cx = 0;
1283  AspectRatio->cy = 0;
1284  }
1285 }
LONG cx
Definition: windef.h:334
LONG cy
Definition: windef.h:335

Referenced by GreGetDCPoint().

◆ DC_vGetPageToDevice()

VOID FASTCALL DC_vGetPageToDevice ( PDC  pdc,
MATRIX pmx 
)

Definition at line 136 of file coord.c.

137 {
138  PDC_ATTR pdcattr = pdc->pdcattr;
139  PSIZEL pszlViewPortExt;
140  SIZEL szlWindowExt;
141 
142  /* Get the viewport extension */
143  pszlViewPortExt = DC_pszlViewportExt(pdc);
144 
145  /* Copy the window extension, so no one can mess with it */
146  szlWindowExt = pdcattr->szlWindowExt;
147 
148  /* No shearing / rotation */
149  FLOATOBJ_SetLong(&pmx->efM12, 0);
150  FLOATOBJ_SetLong(&pmx->efM21, 0);
151 
152  /* Calculate scaling */
153  if (szlWindowExt.cx != 0)
154  {
155  FLOATOBJ_SetLong(&pmx->efM11, pszlViewPortExt->cx);
156  FLOATOBJ_DivLong(&pmx->efM11, szlWindowExt.cx);
157  }
158  else
159  FLOATOBJ_SetLong(&pmx->efM11, 1);
160 
161  if (szlWindowExt.cy != 0)
162  {
163  FLOATOBJ_SetLong(&pmx->efM22, pszlViewPortExt->cy);
164  FLOATOBJ_DivLong(&pmx->efM22, szlWindowExt.cy);
165  }
166  else
167  FLOATOBJ_SetLong(&pmx->efM22, 1);
168 
169  /* Calculate x offset */
170  FLOATOBJ_SetLong(&pmx->efDx, -pdcattr->ptlWindowOrg.x);
171  FLOATOBJ_Mul(&pmx->efDx, &pmx->efM11);
172  FLOATOBJ_AddLong(&pmx->efDx, pdcattr->ptlViewportOrg.x);
173 
174  /* Calculate y offset */
175  FLOATOBJ_SetLong(&pmx->efDy, -pdcattr->ptlWindowOrg.y);
176  FLOATOBJ_Mul(&pmx->efDy, &pmx->efM22);
177  FLOATOBJ_AddLong(&pmx->efDy, pdcattr->ptlViewportOrg.y);
178 }
POINTL ptlViewportOrg
Definition: ntgdihdl.h:347
#define FLOATOBJ_DivLong(pf, l)
Definition: winddi.h:2829
LONG y
Definition: windef.h:330
#define FLOATOBJ_AddLong(pf, l)
Definition: winddi.h:2820
LONG cx
Definition: windef.h:334
LONG x
Definition: windef.h:329
SIZEL szlWindowExt
Definition: ntgdihdl.h:346
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
FORCEINLINE PSIZEL DC_pszlViewportExt(PDC pdc)
Definition: coord.h:74
#define FLOATOBJ_Mul(pf, pf1)
Definition: winddi.h:2824
LONG cy
Definition: windef.h:335
POINTL ptlWindowOrg
Definition: ntgdihdl.h:345

Referenced by DC_vUpdateWorldToDevice(), and NtGdiGetTransform().

◆ DC_vSetLayout()

VOID NTAPI DC_vSetLayout ( IN PDC  pdc,
IN LONG  wox,
IN DWORD  dwLayout 
)

Definition at line 1083 of file coord.c.

1087 {
1088  PDC_ATTR pdcattr = pdc->pdcattr;
1089 
1090  pdcattr->dwLayout = dwLayout;
1091 
1092  if (!(dwLayout & LAYOUT_ORIENTATIONMASK)) return;
1093 
1094  if (dwLayout & LAYOUT_RTL)
1095  {
1096  pdcattr->iMapMode = MM_ANISOTROPIC;
1097  }
1098 
1099  //pdcattr->szlWindowExt.cy = -pdcattr->szlWindowExt.cy;
1100  //pdcattr->ptlWindowOrg.x = -pdcattr->ptlWindowOrg.x;
1101 
1102  //if (wox == -1)
1103  // IntMirrorWindowOrg(pdc);
1104  //else
1105  // pdcattr->ptlWindowOrg.x = wox - pdcattr->ptlWindowOrg.x;
1106 
1107  if (!(pdcattr->flTextAlign & TA_CENTER)) pdcattr->flTextAlign |= TA_RIGHT;
1108 
1109  if (pdc->dclevel.flPath & DCPATH_CLOCKWISE)
1110  pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
1111  else
1112  pdc->dclevel.flPath |= DCPATH_CLOCKWISE;
1113 
1114  pdcattr->flXform |= (PAGE_EXTENTS_CHANGED |
1118 }
#define LAYOUT_RTL
Definition: wingdi.h:1370
INT iMapMode
Definition: ntgdihdl.h:342
#define LAYOUT_ORIENTATIONMASK
Definition: wingdi.h:1373
#define TA_RIGHT
Definition: wingdi.h:932
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:202
#define MM_ANISOTROPIC
Definition: wingdi.h:866
FLONG flXform
Definition: ntgdihdl.h:349
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
FLONG flTextAlign
Definition: ntgdihdl.h:328
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
DWORD dwLayout
Definition: ntgdihdl.h:343
#define TA_CENTER
Definition: wingdi.h:930
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:195

Referenced by NtGdiSetLayout().

◆ 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().

◆ GreCombineTransform()

BOOL NTAPI GreCombineTransform ( XFORML pxformDest,
XFORML pxform1,
XFORML pxform2 
)

Definition at line 227 of file coord.c.

231 {
232  MATRIX mxDest, mx1, mx2;
233  XFORMOBJ xoDest, xo1, xo2;
234 
235  /* Check for illegal parameters */
236  if (!pxformDest || !pxform1 || !pxform2) return FALSE;
237 
238  /* Initialize XFORMOBJs */
239  XFORMOBJ_vInit(&xoDest, &mxDest);
240  XFORMOBJ_vInit(&xo1, &mx1);
241  XFORMOBJ_vInit(&xo2, &mx2);
242 
243  /* Convert the XFORMLs into XFORMOBJs */
244  XFORMOBJ_iSetXform(&xo1, pxform1);
245  XFORMOBJ_iSetXform(&xo2, pxform2);
246 
247  /* Combine them */
248  XFORMOBJ_iCombine(&xoDest, &xo1, &xo2);
249 
250  /* Translate back into XFORML */
251  XFORMOBJ_iGetXform(&xoDest, pxformDest);
252 
253  return TRUE;
254 }
#define TRUE
Definition: types.h:120
#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
#define XFORMOBJ_iCombine
Definition: xformobj.h:15

Referenced by NtGdiCombineTransform().

◆ GreGetDCOrgEx()

BOOL WINAPI GreGetDCOrgEx ( _In_ HDC  hdc,
_Out_ PPOINTL  Point,
_Out_ PRECTL  Rect 
)

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
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
static const WCHAR dc[]

◆ GreGetDCPoint()

BOOL APIENTRY GreGetDCPoint ( HDC  hDC,
UINT  iPoint,
PPOINTL  Point 
)

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:334
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:335
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().

◆ 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  hdc,
_In_ LONG  x,
_In_ LONG  y,
_In_opt_ PRECTL  Rect 
)

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
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
static const WCHAR dc[]
struct Rect Rect

Referenced by DceSetDrawable().

◆ GreSetViewportOrgEx()

BOOL FASTCALL GreSetViewportOrgEx ( HDC  hDC,
int  X,
int  Y,
LPPOINT  Point 
)

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
LONG y
Definition: windef.h:330
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
Definition: polytest.cpp:40
LONG x
Definition: windef.h:329
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
static const WCHAR dc[]
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)

Referenced by MENU_DrawBitmapItem().

◆ IntGdiSetMapMode()

int APIENTRY IntGdiSetMapMode ( PDC  dc,
int  MapMode 
)

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
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:334
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
static const WCHAR dc[]
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:195
LONG cy
Definition: windef.h:335
#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  dc)

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
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
long LONG
Definition: pedump.c:60
LONG cx
Definition: windef.h:334
LONG x
Definition: windef.h:329
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:581
SIZEL szlViewportExt
Definition: ntgdihdl.h:348
DWORD dwLayout
Definition: ntgdihdl.h:343
static const WCHAR dc[]
#define X(b, s)
POINTL ptlWindowOrg
Definition: ntgdihdl.h:345

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

◆ NtGdiCombineTransform()

BOOL APIENTRY NtGdiCombineTransform ( LPXFORM  UnsafeXFormResult,
LPXFORM  Unsafexform1,
LPXFORM  Unsafexform2 
)

Definition at line 258 of file coord.c.

262 {
263  BOOL Ret;
264 
265  _SEH2_TRY
266  {
267  ProbeForWrite(UnsafeXFormResult, sizeof(XFORM), 1);
268  ProbeForRead(Unsafexform1, sizeof(XFORM), 1);
269  ProbeForRead(Unsafexform2, sizeof(XFORM), 1);
270  Ret = GreCombineTransform((XFORML*)UnsafeXFormResult,
271  (XFORML*)Unsafexform1,
272  (XFORML*)Unsafexform2);
273  }
275  {
276  Ret = FALSE;
277  }
278  _SEH2_END;
279 
280  return Ret;
281 }
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOL NTAPI GreCombineTransform(XFORML *pxformDest, XFORML *pxform1, XFORML *pxform2)
Definition: coord.c:227
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

◆ NtGdiGetDCPoint()

BOOL APIENTRY NtGdiGetDCPoint ( HDC  hDC,
UINT  iPoint,
PPOINTL  Point 
)

Definition at line 1421 of file coord.c.

1425 {
1426  BOOL Ret;
1427  POINTL SafePoint;
1428 
1429  if (!Point)
1430  {
1432  return FALSE;
1433  }
1434 
1435  Ret = GreGetDCPoint(hDC, iPoint, &SafePoint);
1436  if (Ret)
1437  {
1438  _SEH2_TRY
1439  {
1440  ProbeForWrite(Point, sizeof(POINT), 1);
1441  *Point = SafePoint;
1442  }
1444  {
1445  Ret = FALSE;
1446  }
1447  _SEH2_END;
1448  }
1449 
1450  return Ret;
1451 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1288
_In_ UINT iPoint
Definition: ntgdi.h:2197
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by DPtoLP(), GetAspectRatioFilterEx(), GetDCOrgEx(), and GetViewportExtEx().

◆ NtGdiGetDeviceWidth()

LONG APIENTRY NtGdiGetDeviceWidth ( IN HDC  hdc)

Definition at line 1157 of file coord.c.

1159 {
1160  PDC dc;
1161  LONG Ret;
1162  dc = DC_LockDc(hdc);
1163  if (!dc)
1164  {
1166  return 0;
1167  }
1168  Ret = dc->erclWindow.right - dc->erclWindow.left;
1169  DC_UnlockDc(dc);
1170  return Ret;
1171 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
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
static const WCHAR dc[]
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ NtGdiGetTransform()

BOOL APIENTRY NtGdiGetTransform ( HDC  hdc,
DWORD  iXform,
LPXFORM  pXForm 
)

Definition at line 286 of file coord.c.

290 {
291  PDC pdc;
292  BOOL ret = TRUE;
293  MATRIX mxPageToDevice;
294  XFORMOBJ xo;
295  PMATRIX pmx;
296 
297  if (!pXForm)
298  {
300  return FALSE;
301  }
302 
303  pdc = DC_LockDc(hdc);
304  if (!pdc)
305  {
307  return FALSE;
308  }
309 
310  switch (iXform)
311  {
313  pmx = DC_pmxWorldToPage(pdc);
314  break;
315 
317  pmx = DC_pmxWorldToDevice(pdc);
318  break;
319 
321  pmx = DC_pmxDeviceToWorld(pdc);
322  break;
323 
325  DC_vGetPageToDevice(pdc, &mxPageToDevice);
326  pmx = &mxPageToDevice;
327  break;
328 
329  default:
330  DPRINT1("Unknown transform %lu\n", iXform);
331  ret = FALSE;
332  goto leave;
333  }
334 
335  /* Initialize an XFORMOBJ */
336  XFORMOBJ_vInit(&xo, pmx);
337 
338  _SEH2_TRY
339  {
340  ProbeForWrite(pXForm, sizeof(XFORML), 1);
341  XFORMOBJ_iGetXform(&xo, (XFORML*)pXForm);
342  }
344  {
345  ret = FALSE;
346  }
347  _SEH2_END;
348 
349 leave:
350  DC_UnlockDc(pdc);
351  return ret;
352 }
#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 GdiDeviceSpaceToWorldSpace
Definition: ntgdityp.h:184
FORCEINLINE VOID XFORMOBJ_vInit(OUT XFORMOBJ *pxo, IN MATRIX *pmx)
Definition: xformobj.h:21
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define XFORMOBJ_iGetXform
Definition: xformobj.h:9
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Definition: polytest.cpp:40
#define GdiPageSpaceToDeviceSpace
Definition: ntgdityp.h:183
_In_ DWORD iXform
Definition: ntgdi.h:2251
Definition: matrix.h:43
#define GdiWorldSpaceToPageSpace
Definition: ntgdityp.h:181
int ret
HDC hdc
Definition: main.c:9
#define GdiWorldSpaceToDeviceSpace
Definition: gdi_private.h:189
VOID FASTCALL DC_vGetPageToDevice(PDC pdc, MATRIX *pmx)
Definition: coord.c:136
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DPRINT1
Definition: precomp.h:8
FORCEINLINE PMATRIX DC_pmxWorldToPage(PDC pdc)
Definition: coord.h:91
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:98
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
FORCEINLINE PMATRIX DC_pmxDeviceToWorld(PDC pdc)
Definition: coord.h:112
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by GetWorldTransform().

◆ NtGdiMirrorWindowOrg()

BOOL APIENTRY NtGdiMirrorWindowOrg ( IN HDC  hdc)

Definition at line 1178 of file coord.c.

1180 {
1181  PDC dc;
1182  dc = DC_LockDc(hdc);
1183  if (!dc)
1184  {
1186  return FALSE;
1187  }
1189  DC_UnlockDc(dc);
1190  return TRUE;
1191 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
static const WCHAR dc[]
VOID FASTCALL IntMirrorWindowOrg(PDC dc)
Definition: coord.c:1052
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by SetViewportExtEx(), SetWindowExtEx(), and SetWindowOrgEx().

◆ NtGdiModifyWorldTransform()

BOOL APIENTRY NtGdiModifyWorldTransform ( HDC  hdc,
LPXFORM  pxformUnsafe,
DWORD  dwMode 
)

Definition at line 506 of file coord.c.

510 {
511  PDC pdc;
512  XFORML xformSafe;
513  BOOL Ret = TRUE;
514 
515  pdc = DC_LockDc(hdc);
516  if (!pdc)
517  {
519  return FALSE;
520  }
521 
522  /* The xform is permitted to be NULL for MWT_IDENTITY.
523  * However, if it is not NULL, then it must be valid even
524  * though it is not used. */
525  if ((dwMode != MWT_IDENTITY) && (pxformUnsafe == NULL))
526  {
527  DC_UnlockDc(pdc);
528  return FALSE;
529  }
530 
531  if (pxformUnsafe != NULL)
532  {
533  _SEH2_TRY
534  {
535  ProbeForRead(pxformUnsafe, sizeof(XFORML), 1);
536  RtlCopyMemory(&xformSafe, pxformUnsafe, sizeof(XFORML));
537  }
539  {
540  Ret = FALSE;
541  }
542  _SEH2_END;
543  }
544 
545  /* Safe to handle kernel mode data. */
546  if (Ret) Ret = GreModifyWorldTransform(pdc, &xformSafe, dwMode);
547  DC_UnlockDc(pdc);
548  return Ret;
549 }
BOOL NTAPI GreModifyWorldTransform(PDC pdc, const XFORML *pxform, DWORD dwMode)
Definition: coord.c:458
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
Definition: polytest.cpp:40
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
HDC hdc
Definition: main.c:9
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define MWT_IDENTITY
Definition: wingdi.h:943
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by ModifyWorldTransform().

◆ NtGdiOffsetViewportOrgEx()

BOOL APIENTRY NtGdiOffsetViewportOrgEx ( HDC  hDC,
int  XOffset,
int  YOffset,
LPPOINT  UnsafePoint 
)

Definition at line 553 of file coord.c.

558 {
559  PDC dc;
560  PDC_ATTR pdcattr;
562 
563  dc = DC_LockDc(hDC);
564  if (!dc)
565  {
567  return FALSE;
568  }
569  pdcattr = dc->pdcattr;
570 
571  if (UnsafePoint)
572  {
573  _SEH2_TRY
574  {
575  ProbeForWrite(UnsafePoint, sizeof(POINT), 1);
576  UnsafePoint->x = pdcattr->ptlViewportOrg.x;
577  UnsafePoint->y = pdcattr->ptlViewportOrg.y;
578  if (pdcattr->dwLayout & LAYOUT_RTL)
579  {
580  UnsafePoint->x = -UnsafePoint->x;
581  }
582  }
584  {
586  }
587  _SEH2_END;
588 
589  if (!NT_SUCCESS(Status))
590  {
592  DC_UnlockDc(dc);
593  return FALSE;
594  }
595  }
596 
597  if (pdcattr->dwLayout & LAYOUT_RTL)
598  {
599  XOffset = -XOffset;
600  }
601  pdcattr->ptlViewportOrg.x += XOffset;
602  pdcattr->ptlViewportOrg.y += YOffset;
604 
605  DC_UnlockDc(dc);
606 
607  return TRUE;
608 }
POINTL ptlViewportOrg
Definition: ntgdihdl.h:347
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
long y
Definition: polytest.cpp:48
#define LAYOUT_RTL
Definition: wingdi.h:1370
long x
Definition: polytest.cpp:48
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:330
_SEH2_TRY
Definition: create.c:4250
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LONG x
Definition: windef.h:329
FLONG flXform
Definition: ntgdihdl.h:349
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
DWORD dwLayout
Definition: ntgdihdl.h:343
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ NtGdiOffsetWindowOrgEx()

BOOL APIENTRY NtGdiOffsetWindowOrgEx ( HDC  hDC,
int  XOffset,
int  YOffset,
LPPOINT  Point 
)

Definition at line 612 of file coord.c.

617 {
618  PDC dc;
619  PDC_ATTR pdcattr;
620 
621  dc = DC_LockDc(hDC);
622  if (!dc)
623  {
625  return FALSE;
626  }
627  pdcattr = dc->pdcattr;
628 
629  if (Point)
630  {
632 
633  _SEH2_TRY
634  {
635  ProbeForWrite(Point, sizeof(POINT), 1);
636  Point->x = pdcattr->ptlWindowOrg.x;
637  Point->y = pdcattr->ptlWindowOrg.y;
638  }
640  {
642  }
643  _SEH2_END;
644 
645  if (!NT_SUCCESS(Status))
646  {
648  DC_UnlockDc(dc);
649  return FALSE;
650  }
651  }
652 
653  pdcattr->ptlWindowOrg.x += XOffset;
654  pdcattr->ptlWindowOrg.y += YOffset;
656 
657  DC_UnlockDc(dc);
658 
659  return TRUE;
660 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:330
_SEH2_TRY
Definition: create.c:4250
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LONG x
Definition: windef.h:329
FLONG flXform
Definition: ntgdihdl.h:349
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
POINTL ptlWindowOrg
Definition: ntgdihdl.h:345

◆ NtGdiScaleViewportExtEx()

BOOL APIENTRY NtGdiScaleViewportExtEx ( HDC  hDC,
int  Xnum,
int  Xdenom,
int  Ynum,
int  Ydenom,
LPSIZE  pSize 
)

Definition at line 664 of file coord.c.

671 {
672  PDC pDC;
673  PDC_ATTR pdcattr;
674  BOOL Ret = FALSE;
675  LONG X, Y;
676 
677  pDC = DC_LockDc(hDC);
678  if (!pDC)
679  {
681  return FALSE;
682  }
683  pdcattr = pDC->pdcattr;
684 
685  if (pdcattr->iMapMode > MM_TWIPS)
686  {
687  if (Xdenom && Ydenom)
688  {
689  DC_pszlViewportExt(pDC);
690  X = Xnum * pdcattr->szlViewportExt.cx / Xdenom;
691  if (X)
692  {
693  Y = Ynum * pdcattr->szlViewportExt.cy / Ydenom;
694  if (Y)
695  {
696  pdcattr->szlViewportExt.cx = X;
697  pdcattr->szlViewportExt.cy = Y;
698  pdcattr->flXform |= PAGE_XLATE_CHANGED;
699 
700  IntMirrorWindowOrg(pDC);
701 
702  pdcattr->flXform |= (PAGE_EXTENTS_CHANGED |
706 
707  if (pdcattr->iMapMode == MM_ISOTROPIC)
708  {
710  }
711 
712  Ret = TRUE;
713  }
714  }
715  }
716  }
717  else
718  Ret = TRUE;
719 
720  if (pSize)
721  {
722  _SEH2_TRY
723  {
724  ProbeForWrite(pSize, sizeof(SIZE), 1);
725 
726  pSize->cx = pdcattr->szlViewportExt.cx;
727  pSize->cy = pdcattr->szlViewportExt.cy;
728  }
730  {
732  Ret = FALSE;
733  }
734  _SEH2_END;
735  }
736 
737  DC_UnlockDc(pDC);
738  return Ret;
739 }
#define MM_ISOTROPIC
Definition: wingdi.h:869
#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
INT iMapMode
Definition: ntgdihdl.h:342
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:202
FLONG flXform
Definition: ntgdihdl.h:349
#define MM_TWIPS
Definition: wingdi.h:873
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
VOID FASTCALL DC_vFixIsotropicMapping(PDC pdc)
Definition: coord.c:93
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
FORCEINLINE PSIZEL DC_pszlViewportExt(PDC pdc)
Definition: coord.h:74
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
SIZEL szlViewportExt
Definition: ntgdihdl.h:348
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:195
LONG cy
Definition: windef.h:335
VOID FASTCALL IntMirrorWindowOrg(PDC dc)
Definition: coord.c:1052
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)

Referenced by ScaleViewportExtEx().

◆ NtGdiScaleWindowExtEx()

BOOL APIENTRY NtGdiScaleWindowExtEx ( HDC  hDC,
int  Xnum,
int  Xdenom,
int  Ynum,
int  Ydenom,
LPSIZE  pSize 
)

Definition at line 743 of file coord.c.

750 {
751  PDC pDC;
752  PDC_ATTR pdcattr;
753  BOOL Ret = FALSE;
754  LONG X, Y;
755 
756  pDC = DC_LockDc(hDC);
757  if (!pDC)
758  {
760  return FALSE;
761  }
762  pdcattr = pDC->pdcattr;
763 
764  if (pSize)
765  {
767 
768  _SEH2_TRY
769  {
770  ProbeForWrite(pSize, sizeof(SIZE), 1);
771 
772  X = pdcattr->szlWindowExt.cx;
773  if (pdcattr->dwLayout & LAYOUT_RTL) X = -X;
774  pSize->cx = X;
775  pSize->cy = pdcattr->szlWindowExt.cy;
776  }
778  {
780  }
781  _SEH2_END;
782 
783  if (!NT_SUCCESS(Status))
784  {
786  DC_UnlockDc(pDC);
787  return FALSE;
788  }
789  }
790 
791  if (pdcattr->iMapMode > MM_TWIPS)
792  {
793  if (Xdenom && Ydenom)
794  {
795  X = Xnum * pdcattr->szlWindowExt.cx / Xdenom;
796  if (X)
797  {
798  Y = Ynum * pdcattr->szlWindowExt.cy / Ydenom;
799  if (Y)
800  {
801  pdcattr->szlWindowExt.cx = X;
802  pdcattr->szlWindowExt.cy = Y;
803 
804  IntMirrorWindowOrg(pDC);
805 
806  pdcattr->flXform |= (PAGE_EXTENTS_CHANGED |
810 
811  Ret = TRUE;
812  }
813  }
814  }
815  }
816  else
817  Ret = TRUE;
818 
819  DC_UnlockDc(pDC);
820  return Ret;
821 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define LAYOUT_RTL
Definition: wingdi.h:1370
#define Y(I)
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
INT iMapMode
Definition: ntgdihdl.h:342
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:202
FLONG flXform
Definition: ntgdihdl.h:349
#define MM_TWIPS
Definition: wingdi.h:873
SIZEL szlWindowExt
Definition: ntgdihdl.h:346
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
DWORD dwLayout
Definition: ntgdihdl.h:343
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:195
return STATUS_SUCCESS
Definition: btrfs.c:2938
LONG cy
Definition: windef.h:335
VOID FASTCALL IntMirrorWindowOrg(PDC dc)
Definition: coord.c:1052
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)

Referenced by ScaleWindowExtEx().

◆ NtGdiSetLayout()

DWORD APIENTRY NtGdiSetLayout ( IN HDC  hdc,
IN LONG  wox,
IN DWORD  dwLayout 
)

Definition at line 1130 of file coord.c.

1134 {
1135  PDC pdc;
1136  DWORD dwOldLayout;
1137 
1138  pdc = DC_LockDc(hdc);
1139  if (!pdc)
1140  {
1142  return GDI_ERROR;
1143  }
1144 
1145  dwOldLayout = pdc->pdcattr->dwLayout;
1146  DC_vSetLayout(pdc, wox, dwLayout);
1147 
1148  DC_UnlockDc(pdc);
1149  return dwOldLayout;
1150 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
VOID NTAPI DC_vSetLayout(IN PDC pdc, IN LONG wox, IN DWORD dwLayout)
Definition: coord.c:1083
Definition: polytest.cpp:40
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define GDI_ERROR
Definition: wingdi.h:1308
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by SetLayout(), and SetLayoutWidth().

◆ NtGdiSetSizeDevice()

BOOL APIENTRY NtGdiSetSizeDevice ( IN HDC  hdc,
IN INT  cxVirtualDevice,
IN INT  cyVirtualDevice 
)

Definition at line 1198 of file coord.c.

1202 {
1203  PDC dc;
1204  PDC_ATTR pdcattr;
1205 
1206  if (!cxVirtualDevice || !cyVirtualDevice)
1207  {
1208  return FALSE;
1209  }
1210 
1211  dc = DC_LockDc(hdc);
1212  if (!dc) return FALSE;
1213 
1214  pdcattr = dc->pdcattr;
1215 
1216  pdcattr->szlVirtualDeviceSize.cx = cxVirtualDevice;
1217  pdcattr->szlVirtualDeviceSize.cy = cyVirtualDevice;
1218 
1219  DC_UnlockDc(dc);
1220 
1221  return TRUE;
1222 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
SIZEL szlVirtualDeviceSize
Definition: ntgdihdl.h:352
static const WCHAR dc[]
LONG cy
Definition: windef.h:335

◆ NtGdiSetViewportOrgEx()

BOOL APIENTRY NtGdiSetViewportOrgEx ( HDC  hDC,
int  X,
int  Y,
LPPOINT  Point 
)

Definition at line 945 of file coord.c.

950 {
951  PDC dc;
952  PDC_ATTR pdcattr;
953 
954  dc = DC_LockDc(hDC);
955  if (!dc)
956  {
958  return FALSE;
959  }
960  pdcattr = dc->pdcattr;
961 
962  if (Point)
963  {
965 
966  _SEH2_TRY
967  {
968  ProbeForWrite(Point, sizeof(POINT), 1);
969  Point->x = pdcattr->ptlViewportOrg.x;
970  Point->y = pdcattr->ptlViewportOrg.y;
971  }
973  {
975  }
976  _SEH2_END;
977 
978  if (!NT_SUCCESS(Status))
979  {
981  DC_UnlockDc(dc);
982  return FALSE;
983  }
984  }
985 
986  pdcattr->ptlViewportOrg.x = X;
987  pdcattr->ptlViewportOrg.y = Y;
989 
990  DC_UnlockDc(dc);
991 
992  return TRUE;
993 }
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
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:330
_SEH2_TRY
Definition: create.c:4250
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LONG x
Definition: windef.h:329
FLONG flXform
Definition: ntgdihdl.h:349
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)

◆ NtGdiSetVirtualResolution()

BOOL APIENTRY NtGdiSetVirtualResolution ( IN HDC  hdc,
IN INT  cxVirtualDevicePixel,
IN INT  cyVirtualDevicePixel,
IN INT  cxVirtualDeviceMm,
IN INT  cyVirtualDeviceMm 
)

Definition at line 1229 of file coord.c.

1235 {
1236  PDC dc;
1237  PDC_ATTR pdcattr;
1238 
1239  /* Check parameters (all zeroes resets to real resolution) */
1240  if (cxVirtualDevicePixel == 0 && cyVirtualDevicePixel == 0 &&
1241  cxVirtualDeviceMm == 0 && cyVirtualDeviceMm == 0)
1242  {
1243  cxVirtualDevicePixel = NtGdiGetDeviceCaps(hdc, HORZRES);
1244  cyVirtualDevicePixel = NtGdiGetDeviceCaps(hdc, VERTRES);
1245  cxVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, HORZSIZE);
1246  cyVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, VERTSIZE);
1247  }
1248  else if (cxVirtualDevicePixel == 0 || cyVirtualDevicePixel == 0 ||
1249  cxVirtualDeviceMm == 0 || cyVirtualDeviceMm == 0)
1250  {
1251  return FALSE;
1252  }
1253 
1254  dc = DC_LockDc(hdc);
1255  if (!dc) return FALSE;
1256 
1257  pdcattr = dc->pdcattr;
1258 
1259  pdcattr->szlVirtualDevicePixel.cx = cxVirtualDevicePixel;
1260  pdcattr->szlVirtualDevicePixel.cy = cyVirtualDevicePixel;
1261  pdcattr->szlVirtualDeviceMm.cx = cxVirtualDeviceMm;
1262  pdcattr->szlVirtualDeviceMm.cy = cyVirtualDeviceMm;
1263 
1264 // DC_vUpdateXforms(dc);
1265  DC_UnlockDc(dc);
1266  return TRUE;
1267 }
#define HORZRES
Definition: wingdi.h:715
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
LONG cx
Definition: windef.h:334
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
SIZEL szlVirtualDevicePixel
Definition: ntgdihdl.h:350
#define HORZSIZE
Definition: wingdi.h:713
#define VERTSIZE
Definition: wingdi.h:714
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define VERTRES
Definition: wingdi.h:716
static const WCHAR dc[]
__kernel_entry W32KAPI INT APIENTRY NtGdiGetDeviceCaps(_In_ HDC hdc, _In_ INT i)
LONG cy
Definition: windef.h:335
SIZEL szlVirtualDeviceMm
Definition: ntgdihdl.h:351

◆ NtGdiSetWindowOrgEx()

BOOL APIENTRY NtGdiSetWindowOrgEx ( HDC  hDC,
int  X,
int  Y,
LPPOINT  Point 
)

Definition at line 997 of file coord.c.

1002 {
1003  PDC dc;
1004  PDC_ATTR pdcattr;
1005 
1006  dc = DC_LockDc(hDC);
1007  if (!dc)
1008  {
1010  return FALSE;
1011  }
1012  pdcattr = dc->pdcattr;
1013 
1014  if (Point)
1015  {
1017 
1018  _SEH2_TRY
1019  {
1020  ProbeForWrite(Point, sizeof(POINT), 1);
1021  Point->x = pdcattr->ptlWindowOrg.x;
1022  Point->y = pdcattr->ptlWindowOrg.y;
1023  }
1025  {
1027  }
1028  _SEH2_END;
1029 
1030  if (!NT_SUCCESS(Status))
1031  {
1033  DC_UnlockDc(dc);
1034  return FALSE;
1035  }
1036  }
1037 
1038  pdcattr->ptlWindowOrg.x = X;
1039  pdcattr->ptlWindowOrg.y = Y;
1041 
1042  DC_UnlockDc(dc);
1043 
1044  return TRUE;
1045 }
#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
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:330
_SEH2_TRY
Definition: create.c:4250
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:201
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LONG x
Definition: windef.h:329
FLONG flXform
Definition: ntgdihdl.h:349
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
#define WORLD_XFORM_CHANGED
Definition: ntgdihdl.h:203
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:192
static const WCHAR dc[]
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)
POINTL ptlWindowOrg
Definition: ntgdihdl.h:345

◆ NtGdiTransformPoints()

BOOL APIENTRY NtGdiTransformPoints ( HDC  hDC,
PPOINT  UnsafePtsIn,
PPOINT  UnsafePtOut,
INT  Count,
INT  iMode 
)

Converts points from logical coordinates into device coordinates. Conversion depends on the mapping mode, world transfrom, viewport origin settings for the given device context.

Parameters
hDCdevice context.
Pointsan array of POINT structures (in/out).
Countnumber of elements in the array of POINT structures.
Returns
TRUE if success, FALSE otherwise.

Definition at line 366 of file coord.c.

372 {
373  PDC pdc;
374  LPPOINT Points;
375  ULONG Size;
376  BOOL ret = TRUE;
377 
378  if (Count <= 0)
379  return TRUE;
380 
381  if (!UnsafePtsIn || !UnsafePtOut)
382  {
383  return FALSE;
384  }
385 
386  pdc = DC_LockDc(hDC);
387  if (!pdc)
388  {
389  return FALSE;
390  }
391 
392  Size = Count * sizeof(POINT);
393 
394  // FIXME: It would be wise to have a small stack buffer as optimization
396  if (!Points)
397  {
398  DC_UnlockDc(pdc);
400  return FALSE;
401  }
402 
403  _SEH2_TRY
404  {
405  ProbeForWrite(UnsafePtOut, Size, 1);
406  ProbeForRead(UnsafePtsIn, Size, 1);
407  RtlCopyMemory(Points, UnsafePtsIn, Size);
408  }
410  {
411  /* Do not set last error */
412  _SEH2_YIELD(goto leave;)
413  }
414  _SEH2_END;
415 
416  switch (iMode)
417  {
418  case GdiDpToLp:
419  DC_vXformDeviceToWorld(pdc, Count, Points, Points);
420  break;
421 
422  case GdiLpToDp:
423  DC_vXformWorldToDevice(pdc, Count, Points, Points);
424  break;
425 
426  case 2: // Not supported yet. Need testing.
427  default:
428  {
430  ret = FALSE;
431  goto leave;
432  }
433  }
434 
435  _SEH2_TRY
436  {
437  /* Pointer was already probed! */
438  RtlCopyMemory(UnsafePtOut, Points, Size);
439  }
441  {
442  /* Do not set last error */
443  ret = 0;
444  }
445  _SEH2_END;
446 
447 //
448 // If we are getting called that means User XForms is a mess!
449 //
450 leave:
451  DC_UnlockDc(pdc);
453  return ret;
454 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define GDITAG_TEMP
Definition: tags.h:166
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
_In_ ULONG iMode
Definition: winddi.h:3520
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
_SEH2_TRY
Definition: create.c:4250
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
FORCEINLINE VOID DC_vXformDeviceToWorld(IN PDC pdc, IN ULONG cNumPoints, OUT PPOINTL pptlDest, IN PPOINTL pptlSource)
Definition: coord.h:126
#define POINT
Definition: precomp.h:30
Definition: polytest.cpp:40
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
int ret
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
FORCEINLINE VOID DC_vXformWorldToDevice(IN PDC pdc, IN ULONG cNumPoints, OUT PPOINTL pptlDest, IN PPOINTL pptlSource)
Definition: coord.h:145
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by DPtoLP(), and LPtoDP().

Variable Documentation

◆ gmxIdentity