ReactOS  0.4.13-dev-92-gf251225
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 72 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 92 of file coord.c.

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: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:198
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
SIZEL szlWindowExt
Definition: ntgdihdl.h:339
GLfixed fx
Definition: tritemp.h:482
GLdouble s
Definition: gl.h:2039
SIZEL szlViewportExt
Definition: ntgdihdl.h:341
GLfixed fy
Definition: tritemp.h:490
LONG cy
Definition: windef.h:320

Referenced by DC_pszlViewportExt(), and NtGdiScaleViewportExtEx().

◆ DC_vGetAspectRatioFilter()

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

Definition at line 1257 of file coord.c.

1258 {
1259  if (pDC->pdcattr->flFontMapper & 1) // TRUE assume 1.
1260  {
1261  // "This specifies that Windows should only match fonts that have the
1262  // same aspect ratio as the display.", Programming Windows, Fifth Ed.
1263  AspectRatio->cx = pDC->ppdev->gdiinfo.ulLogPixelsX;
1264  AspectRatio->cy = pDC->ppdev->gdiinfo.ulLogPixelsY;
1265  }
1266  else
1267  {
1268  AspectRatio->cx = 0;
1269  AspectRatio->cy = 0;
1270  }
1271 }
LONG cx
Definition: windef.h:319
LONG cy
Definition: windef.h:320

Referenced by GreGetDCPoint().

◆ DC_vGetPageToDevice()

VOID FASTCALL DC_vGetPageToDevice ( PDC  pdc,
MATRIX pmx 
)

Definition at line 135 of file coord.c.

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

Referenced by DC_vUpdateWorldToDevice(), and NtGdiGetTransform().

◆ DC_vSetLayout()

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

Definition at line 1070 of file coord.c.

1074 {
1075  PDC_ATTR pdcattr = pdc->pdcattr;
1076 
1077  pdcattr->dwLayout = dwLayout;
1078 
1079  if (!(dwLayout & LAYOUT_ORIENTATIONMASK)) return;
1080 
1081  if (dwLayout & LAYOUT_RTL)
1082  {
1083  pdcattr->iMapMode = MM_ANISOTROPIC;
1084  }
1085 
1086  //pdcattr->szlWindowExt.cy = -pdcattr->szlWindowExt.cy;
1087  //pdcattr->ptlWindowOrg.x = -pdcattr->ptlWindowOrg.x;
1088 
1089  //if (wox == -1)
1090  // IntMirrorWindowOrg(pdc);
1091  //else
1092  // pdcattr->ptlWindowOrg.x = wox - pdcattr->ptlWindowOrg.x;
1093 
1094  if (!(pdcattr->flTextAlign & TA_CENTER)) pdcattr->flTextAlign |= TA_RIGHT;
1095 
1096  if (pdc->dclevel.flPath & DCPATH_CLOCKWISE)
1097  pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
1098  else
1099  pdc->dclevel.flPath |= DCPATH_CLOCKWISE;
1100 
1101  pdcattr->flXform |= (PAGE_EXTENTS_CHANGED |
1104 }
#define LAYOUT_RTL
Definition: wingdi.h:1353
INT iMapMode
Definition: ntgdihdl.h:335
#define LAYOUT_ORIENTATIONMASK
Definition: wingdi.h:1356
#define TA_RIGHT
Definition: wingdi.h:932
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:198
#define MM_ANISOTROPIC
Definition: wingdi.h:866
FLONG flXform
Definition: ntgdihdl.h:342
FLONG flTextAlign
Definition: ntgdihdl.h:321
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
DWORD dwLayout
Definition: ntgdihdl.h:336
#define TA_CENTER
Definition: wingdi.h:930
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:191

Referenced by NtGdiSetLayout().

◆ DC_vUpdateDeviceToWorld()

VOID FASTCALL DC_vUpdateDeviceToWorld ( PDC  pdc)

Definition at line 203 of file coord.c.

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

Referenced by DC_pmxDeviceToWorld().

◆ DC_vUpdateWorldToDevice()

VOID FASTCALL DC_vUpdateWorldToDevice ( PDC  pdc)

Definition at line 181 of file coord.c.

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

Referenced by DC_pmxWorldToDevice(), and IntExtTextOutW().

◆ GreCombineTransform()

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

Definition at line 226 of file coord.c.

230 {
231  MATRIX mxDest, mx1, mx2;
232  XFORMOBJ xoDest, xo1, xo2;
233 
234  /* Check for illegal parameters */
235  if (!pxformDest || !pxform1 || !pxform2) return FALSE;
236 
237  /* Initialize XFORMOBJs */
238  XFORMOBJ_vInit(&xoDest, &mxDest);
239  XFORMOBJ_vInit(&xo1, &mx1);
240  XFORMOBJ_vInit(&xo2, &mx2);
241 
242  /* Convert the XFORMLs into XFORMOBJs */
243  XFORMOBJ_iSetXform(&xo1, pxform1);
244  XFORMOBJ_iSetXform(&xo2, pxform2);
245 
246  /* Combine them */
247  XFORMOBJ_iCombine(&xoDest, &xo1, &xo2);
248 
249  /* Translate back into XFORML */
250  XFORMOBJ_iGetXform(&xoDest, pxformDest);
251 
252  return TRUE;
253 }
#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 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
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1274
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237

◆ GreGetDCPoint()

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

Definition at line 1274 of file coord.c.

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 
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
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:1257
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:72
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 1399 of file coord.c.

1402 {
1403  return GreGetDCPoint(hdc, GdiGetViewPortExt, (PPOINTL)lpSize);
1404 }
HDC hdc
Definition: main.c:9
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1274

Referenced by DrawTextExWorker().

◆ GreGetWindowExtEx()

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

Definition at line 1390 of file coord.c.

1393 {
1394  return GreGetDCPoint(hdc, GdiGetWindowExt, (PPOINTL)lpSize);
1395 }
HDC hdc
Definition: main.c:9
BOOL APIENTRY GreGetDCPoint(HDC hDC, UINT iPoint, PPOINTL Point)
Definition: coord.c:1274

Referenced by DrawTextExWorker().

◆ GreModifyWorldTransform()

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

Definition at line 453 of file coord.c.

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_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_SET
Definition: ntgdityp.h:177
#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:199
#define XFORMOBJ_iCombine
Definition: xformobj.h:15
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
#define MWT_IDENTITY
Definition: wingdi.h:943
const MATRIX gmxIdentity
Definition: coord.c:79
#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 1340 of file coord.c.

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
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  hDC,
int  X,
int  Y,
LPPOINT  Point 
)

Definition at line 899 of file coord.c.

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 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:197
Definition: polytest.cpp:40
LONG x
Definition: windef.h:314
FLONG flXform
Definition: ntgdihdl.h:342
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)

Referenced by MENU_DrawBitmapItem().

◆ IntGdiSetMapMode()

int APIENTRY IntGdiSetMapMode ( PDC  dc,
int  MapMode 
)

Definition at line 816 of file coord.c.

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:869
#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:319
unsigned long FLONG
Definition: ntbasedef.h:373
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:198
#define MM_LOMETRIC
Definition: wingdi.h:871
#define DEVICE_TO_PAGE_INVALID
Definition: ntgdihdl.h:187
#define MM_LOENGLISH
Definition: wingdi.h:870
#define MM_ANISOTROPIC
Definition: wingdi.h:866
FLONG flXform
Definition: ntgdihdl.h:342
#define MM_TWIPS
Definition: wingdi.h:873
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:868
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
#define MM_TEXT
Definition: wingdi.h:872
SIZEL szlViewportExt
Definition: ntgdihdl.h:341
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:191
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:344
#define PTOD_EFM11_NEGATIVE
Definition: ntgdihdl.h:192

Referenced by _Success_(), and PATH_FillPathEx().

◆ IntMirrorWindowOrg()

VOID FASTCALL IntMirrorWindowOrg ( PDC  dc)

Definition at line 1039 of file coord.c.

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:1353
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:319
LONG x
Definition: windef.h:314
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

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

◆ NtGdiCombineTransform()

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

Definition at line 257 of file coord.c.

261 {
262  BOOL Ret;
263 
264  _SEH2_TRY
265  {
266  ProbeForWrite(UnsafeXFormResult, sizeof(XFORM), 1);
267  ProbeForRead(Unsafexform1, sizeof(XFORM), 1);
268  ProbeForRead(Unsafexform2, sizeof(XFORM), 1);
269  Ret = GreCombineTransform((XFORML*)UnsafeXFormResult,
270  (XFORML*)Unsafexform1,
271  (XFORML*)Unsafexform2);
272  }
274  {
275  Ret = FALSE;
276  }
277  _SEH2_END;
278 
279  return Ret;
280 }
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:226
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 1407 of file coord.c.

1411 {
1412  BOOL Ret;
1413  POINTL SafePoint;
1414 
1415  if (!Point)
1416  {
1418  return FALSE;
1419  }
1420 
1421  Ret = GreGetDCPoint(hDC, iPoint, &SafePoint);
1422  if (Ret)
1423  {
1424  _SEH2_TRY
1425  {
1426  ProbeForWrite(Point, sizeof(POINT), 1);
1427  *Point = SafePoint;
1428  }
1430  {
1431  Ret = FALSE;
1432  }
1433  _SEH2_END;
1434  }
1435 
1436  return Ret;
1437 }
#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:1274
_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 GetAspectRatioFilterEx(), GetDCOrgEx(), and GetViewportExtEx().

◆ NtGdiGetDeviceWidth()

LONG APIENTRY NtGdiGetDeviceWidth ( IN HDC  hdc)

Definition at line 1143 of file coord.c.

1145 {
1146  PDC dc;
1147  LONG Ret;
1148  dc = DC_LockDc(hdc);
1149  if (!dc)
1150  {
1152  return 0;
1153  }
1154  Ret = dc->erclWindow.right - dc->erclWindow.left;
1155  DC_UnlockDc(dc);
1156  return Ret;
1157 }
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
HDC dc
Definition: cylfrac.c:34
long LONG
Definition: pedump.c:60
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ NtGdiGetTransform()

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

Definition at line 285 of file coord.c.

289 {
290  PDC pdc;
291  BOOL ret = TRUE;
292  MATRIX mxPageToDevice;
293  XFORMOBJ xo;
294  PMATRIX pmx;
295 
296  if (!pXForm)
297  {
299  return FALSE;
300  }
301 
302  pdc = DC_LockDc(hdc);
303  if (!pdc)
304  {
306  return FALSE;
307  }
308 
309  switch (iXform)
310  {
312  pmx = DC_pmxWorldToPage(pdc);
313  break;
314 
316  pmx = DC_pmxWorldToDevice(pdc);
317  break;
318 
320  pmx = DC_pmxDeviceToWorld(pdc);
321  break;
322 
324  DC_vGetPageToDevice(pdc, &mxPageToDevice);
325  pmx = &mxPageToDevice;
326  break;
327 
328  default:
329  DPRINT1("Unknown transform %lu\n", iXform);
330  ret = FALSE;
331  goto leave;
332  }
333 
334  /* Initialize an XFORMOBJ */
335  XFORMOBJ_vInit(&xo, pmx);
336 
337  _SEH2_TRY
338  {
339  ProbeForWrite(pXForm, sizeof(XFORML), 1);
340  XFORMOBJ_iGetXform(&xo, (XFORML*)pXForm);
341  }
343  {
344  ret = FALSE;
345  }
346  _SEH2_END;
347 
348 leave:
349  DC_UnlockDc(pdc);
350  return ret;
351 }
#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:182
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:181
_In_ DWORD iXform
Definition: ntgdi.h:2251
Definition: matrix.h:43
#define GdiWorldSpaceToPageSpace
Definition: ntgdityp.h:179
int ret
HDC hdc
Definition: main.c:9
#define GdiWorldSpaceToDeviceSpace
Definition: gdi_private.h:171
VOID FASTCALL DC_vGetPageToDevice(PDC pdc, MATRIX *pmx)
Definition: coord.c:135
_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:89
FORCEINLINE PMATRIX DC_pmxWorldToDevice(PDC pdc)
Definition: coord.h:96
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
FORCEINLINE PMATRIX DC_pmxDeviceToWorld(PDC pdc)
Definition: coord.h:110
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by GetWorldTransform().

◆ NtGdiMirrorWindowOrg()

BOOL APIENTRY NtGdiMirrorWindowOrg ( IN HDC  hdc)

Definition at line 1164 of file coord.c.

1166 {
1167  PDC dc;
1168  dc = DC_LockDc(hdc);
1169  if (!dc)
1170  {
1172  return FALSE;
1173  }
1175  DC_UnlockDc(dc);
1176  return TRUE;
1177 }
#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
VOID FASTCALL IntMirrorWindowOrg(PDC dc)
Definition: coord.c:1039
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 501 of file coord.c.

505 {
506  PDC pdc;
507  XFORML xformSafe;
508  BOOL Ret = TRUE;
509 
510  pdc = DC_LockDc(hdc);
511  if (!pdc)
512  {
514  return FALSE;
515  }
516 
517  /* The xform is permitted to be NULL for MWT_IDENTITY.
518  * However, if it is not NULL, then it must be valid even
519  * though it is not used. */
520  if ((dwMode != MWT_IDENTITY) && (pxformUnsafe == NULL))
521  {
522  DC_UnlockDc(pdc);
523  return FALSE;
524  }
525 
526  if (pxformUnsafe != NULL)
527  {
528  _SEH2_TRY
529  {
530  ProbeForRead(pxformUnsafe, sizeof(XFORML), 1);
531  RtlCopyMemory(&xformSafe, pxformUnsafe, sizeof(XFORML));
532  }
534  {
535  Ret = FALSE;
536  }
537  _SEH2_END;
538  }
539 
540  /* Safe to handle kernel mode data. */
541  if (Ret) Ret = GreModifyWorldTransform(pdc, &xformSafe, dwMode);
542  DC_UnlockDc(pdc);
543  return Ret;
544 }
BOOL NTAPI GreModifyWorldTransform(PDC pdc, const XFORML *pxform, DWORD dwMode)
Definition: coord.c:453
#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 548 of file coord.c.

553 {
554  PDC dc;
555  PDC_ATTR pdcattr;
557 
558  dc = DC_LockDc(hDC);
559  if (!dc)
560  {
562  return FALSE;
563  }
564  pdcattr = dc->pdcattr;
565 
566  if (UnsafePoint)
567  {
568  _SEH2_TRY
569  {
570  ProbeForWrite(UnsafePoint, sizeof(POINT), 1);
571  UnsafePoint->x = pdcattr->ptlViewportOrg.x;
572  UnsafePoint->y = pdcattr->ptlViewportOrg.y;
573  if (pdcattr->dwLayout & LAYOUT_RTL)
574  {
575  UnsafePoint->x = -UnsafePoint->x;
576  }
577  }
579  {
581  }
582  _SEH2_END;
583 
584  if (!NT_SUCCESS(Status))
585  {
587  DC_UnlockDc(dc);
588  return FALSE;
589  }
590  }
591 
592  if (pdcattr->dwLayout & LAYOUT_RTL)
593  {
594  XOffset = -XOffset;
595  }
596  pdcattr->ptlViewportOrg.x += XOffset;
597  pdcattr->ptlViewportOrg.y += YOffset;
598  pdcattr->flXform |= PAGE_XLATE_CHANGED;
599 
600  DC_UnlockDc(dc);
601 
602  return TRUE;
603 }
POINTL ptlViewportOrg
Definition: ntgdihdl.h:340
#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:1353
long x
Definition: polytest.cpp:48
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
HDC dc
Definition: cylfrac.c:34
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:315
_SEH2_TRY
Definition: create.c:4250
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:197
#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:314
FLONG flXform
Definition: ntgdihdl.h:342
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
DWORD dwLayout
Definition: ntgdihdl.h:336
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2725
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by OffsetViewportOrgEx().

◆ NtGdiOffsetWindowOrgEx()

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

Definition at line 607 of file coord.c.

612 {
613  PDC dc;
614  PDC_ATTR pdcattr;
615 
616  dc = DC_LockDc(hDC);
617  if (!dc)
618  {
620  return FALSE;
621  }
622  pdcattr = dc->pdcattr;
623 
624  if (Point)
625  {
627 
628  _SEH2_TRY
629  {
630  ProbeForWrite(Point, sizeof(POINT), 1);
631  Point->x = pdcattr->ptlWindowOrg.x;
632  Point->y = pdcattr->ptlWindowOrg.y;
633  }
635  {
637  }
638  _SEH2_END;
639 
640  if (!NT_SUCCESS(Status))
641  {
643  DC_UnlockDc(dc);
644  return FALSE;
645  }
646  }
647 
648  pdcattr->ptlWindowOrg.x += XOffset;
649  pdcattr->ptlWindowOrg.y += YOffset;
651 
652  DC_UnlockDc(dc);
653 
654  return TRUE;
655 }
#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
HDC dc
Definition: cylfrac.c:34
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:315
_SEH2_TRY
Definition: create.c:4250
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:197
#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:314
FLONG flXform
Definition: ntgdihdl.h:342
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2725
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
POINTL ptlWindowOrg
Definition: ntgdihdl.h:338

Referenced by OffsetWindowOrgEx().

◆ NtGdiScaleViewportExtEx()

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

Definition at line 659 of file coord.c.

666 {
667  PDC pDC;
668  PDC_ATTR pdcattr;
669  BOOL Ret = FALSE;
670  LONG X, Y;
671 
672  pDC = DC_LockDc(hDC);
673  if (!pDC)
674  {
676  return FALSE;
677  }
678  pdcattr = pDC->pdcattr;
679 
680  if (pdcattr->iMapMode > MM_TWIPS)
681  {
682  if (Xdenom && Ydenom)
683  {
684  DC_pszlViewportExt(pDC);
685  X = Xnum * pdcattr->szlViewportExt.cx / Xdenom;
686  if (X)
687  {
688  Y = Ynum * pdcattr->szlViewportExt.cy / Ydenom;
689  if (Y)
690  {
691  pdcattr->szlViewportExt.cx = X;
692  pdcattr->szlViewportExt.cy = Y;
693  pdcattr->flXform |= PAGE_XLATE_CHANGED;
694 
695  IntMirrorWindowOrg(pDC);
696 
697  pdcattr->flXform |= (PAGE_EXTENTS_CHANGED |
700 
701  if (pdcattr->iMapMode == MM_ISOTROPIC)
702  {
704  }
705 
706  Ret = TRUE;
707  }
708  }
709  }
710  }
711  else
712  Ret = TRUE;
713 
714  if (pSize)
715  {
716  _SEH2_TRY
717  {
718  ProbeForWrite(pSize, sizeof(SIZE), 1);
719 
720  pSize->cx = pdcattr->szlViewportExt.cx;
721  pSize->cy = pdcattr->szlViewportExt.cy;
722  }
724  {
726  Ret = FALSE;
727  }
728  _SEH2_END;
729  }
730 
731  DC_UnlockDc(pDC);
732  return Ret;
733 }
#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:335
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:197
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:319
Definition: polytest.cpp:40
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:198
FLONG flXform
Definition: ntgdihdl.h:342
#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:92
static HDC hDC
Definition: 3dtext.c:33
_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:72
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
SIZEL szlViewportExt
Definition: ntgdihdl.h:341
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:191
LONG cy
Definition: windef.h:320
VOID FASTCALL IntMirrorWindowOrg(PDC dc)
Definition: coord.c:1039
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 737 of file coord.c.

744 {
745  PDC pDC;
746  PDC_ATTR pdcattr;
747  BOOL Ret = FALSE;
748  LONG X, Y;
749 
750  pDC = DC_LockDc(hDC);
751  if (!pDC)
752  {
754  return FALSE;
755  }
756  pdcattr = pDC->pdcattr;
757 
758  if (pSize)
759  {
761 
762  _SEH2_TRY
763  {
764  ProbeForWrite(pSize, sizeof(SIZE), 1);
765 
766  X = pdcattr->szlWindowExt.cx;
767  if (pdcattr->dwLayout & LAYOUT_RTL) X = -X;
768  pSize->cx = X;
769  pSize->cy = pdcattr->szlWindowExt.cy;
770  }
772  {
774  }
775  _SEH2_END;
776 
777  if (!NT_SUCCESS(Status))
778  {
780  DC_UnlockDc(pDC);
781  return FALSE;
782  }
783  }
784 
785  if (pdcattr->iMapMode > MM_TWIPS)
786  {
787  if (Xdenom && Ydenom)
788  {
789  X = Xnum * pdcattr->szlWindowExt.cx / Xdenom;
790  if (X)
791  {
792  Y = Ynum * pdcattr->szlWindowExt.cy / Ydenom;
793  if (Y)
794  {
795  pdcattr->szlWindowExt.cx = X;
796  pdcattr->szlWindowExt.cy = Y;
797 
798  IntMirrorWindowOrg(pDC);
799 
801 
802  Ret = TRUE;
803  }
804  }
805  }
806  }
807  else
808  Ret = TRUE;
809 
810  DC_UnlockDc(pDC);
811  return Ret;
812 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
#define LAYOUT_RTL
Definition: wingdi.h:1353
#define Y(I)
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
INT iMapMode
Definition: ntgdihdl.h:335
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:319
Definition: polytest.cpp:40
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define PAGE_EXTENTS_CHANGED
Definition: ntgdihdl.h:198
FLONG flXform
Definition: ntgdihdl.h:342
#define MM_TWIPS
Definition: wingdi.h:873
SIZEL szlWindowExt
Definition: ntgdihdl.h:339
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define DEVICE_TO_WORLD_INVALID
Definition: ntgdihdl.h:188
DWORD dwLayout
Definition: ntgdihdl.h:336
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define INVALIDATE_ATTRIBUTES
Definition: ntgdihdl.h:191
return STATUS_SUCCESS
Definition: btrfs.c:2725
LONG cy
Definition: windef.h:320
VOID FASTCALL IntMirrorWindowOrg(PDC dc)
Definition: coord.c:1039
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 1116 of file coord.c.

1120 {
1121  PDC pdc;
1122  DWORD dwOldLayout;
1123 
1124  pdc = DC_LockDc(hdc);
1125  if (!pdc)
1126  {
1128  return GDI_ERROR;
1129  }
1130 
1131  dwOldLayout = pdc->pdcattr->dwLayout;
1132  DC_vSetLayout(pdc, wox, dwLayout);
1133 
1134  DC_UnlockDc(pdc);
1135  return dwOldLayout;
1136 }
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:1070
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:1291
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 1184 of file coord.c.

1188 {
1189  PDC dc;
1190  PDC_ATTR pdcattr;
1191 
1192  if (!cxVirtualDevice || !cyVirtualDevice)
1193  {
1194  return FALSE;
1195  }
1196 
1197  dc = DC_LockDc(hdc);
1198  if (!dc) return FALSE;
1199 
1200  pdcattr = dc->pdcattr;
1201 
1202  pdcattr->szlVirtualDeviceSize.cx = cxVirtualDevice;
1203  pdcattr->szlVirtualDeviceSize.cy = cyVirtualDevice;
1204 
1205  DC_UnlockDc(dc);
1206 
1207  return TRUE;
1208 }
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
HDC dc
Definition: cylfrac.c:34
LONG cx
Definition: windef.h:319
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:345
LONG cy
Definition: windef.h:320

◆ NtGdiSetViewportOrgEx()

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

Definition at line 932 of file coord.c.

937 {
938  PDC dc;
939  PDC_ATTR pdcattr;
940 
941  dc = DC_LockDc(hDC);
942  if (!dc)
943  {
945  return FALSE;
946  }
947  pdcattr = dc->pdcattr;
948 
949  if (Point)
950  {
952 
953  _SEH2_TRY
954  {
955  ProbeForWrite(Point, sizeof(POINT), 1);
956  Point->x = pdcattr->ptlViewportOrg.x;
957  Point->y = pdcattr->ptlViewportOrg.y;
958  }
960  {
962  }
963  _SEH2_END;
964 
965  if (!NT_SUCCESS(Status))
966  {
968  DC_UnlockDc(dc);
969  return FALSE;
970  }
971  }
972 
973  pdcattr->ptlViewportOrg.x = X;
974  pdcattr->ptlViewportOrg.y = Y;
975  pdcattr->flXform |= PAGE_XLATE_CHANGED;
976 
977  DC_UnlockDc(dc);
978 
979  return TRUE;
980 }
POINTL ptlViewportOrg
Definition: ntgdihdl.h:340
#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
HDC dc
Definition: cylfrac.c:34
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:315
_SEH2_TRY
Definition: create.c:4250
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:197
#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:314
FLONG flXform
Definition: ntgdihdl.h:342
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2725
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)

Referenced by SetViewportOrgEx().

◆ NtGdiSetVirtualResolution()

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

Definition at line 1215 of file coord.c.

1221 {
1222  PDC dc;
1223  PDC_ATTR pdcattr;
1224 
1225  /* Check parameters (all zeroes resets to real resolution) */
1226  if (cxVirtualDevicePixel == 0 && cyVirtualDevicePixel == 0 &&
1227  cxVirtualDeviceMm == 0 && cyVirtualDeviceMm == 0)
1228  {
1229  cxVirtualDevicePixel = NtGdiGetDeviceCaps(hdc, HORZRES);
1230  cyVirtualDevicePixel = NtGdiGetDeviceCaps(hdc, VERTRES);
1231  cxVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, HORZSIZE);
1232  cyVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, VERTSIZE);
1233  }
1234  else if (cxVirtualDevicePixel == 0 || cyVirtualDevicePixel == 0 ||
1235  cxVirtualDeviceMm == 0 || cyVirtualDeviceMm == 0)
1236  {
1237  return FALSE;
1238  }
1239 
1240  dc = DC_LockDc(hdc);
1241  if (!dc) return FALSE;
1242 
1243  pdcattr = dc->pdcattr;
1244 
1245  pdcattr->szlVirtualDevicePixel.cx = cxVirtualDevicePixel;
1246  pdcattr->szlVirtualDevicePixel.cy = cyVirtualDevicePixel;
1247  pdcattr->szlVirtualDeviceMm.cx = cxVirtualDeviceMm;
1248  pdcattr->szlVirtualDeviceMm.cy = cyVirtualDeviceMm;
1249 
1250 // DC_vUpdateXforms(dc);
1251  DC_UnlockDc(dc);
1252  return TRUE;
1253 }
#define HORZRES
Definition: wingdi.h:715
#define TRUE
Definition: types.h:120
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:219
HDC dc
Definition: cylfrac.c:34
LONG cx
Definition: windef.h:319
Definition: polytest.cpp:40
HDC hdc
Definition: main.c:9
SIZEL szlVirtualDevicePixel
Definition: ntgdihdl.h:343
#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
__kernel_entry W32KAPI INT APIENTRY NtGdiGetDeviceCaps(_In_ HDC hdc, _In_ INT i)
LONG cy
Definition: windef.h:320
SIZEL szlVirtualDeviceMm
Definition: ntgdihdl.h:344

◆ NtGdiSetWindowOrgEx()

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

Definition at line 984 of file coord.c.

989 {
990  PDC dc;
991  PDC_ATTR pdcattr;
992 
993  dc = DC_LockDc(hDC);
994  if (!dc)
995  {
997  return FALSE;
998  }
999  pdcattr = dc->pdcattr;
1000 
1001  if (Point)
1002  {
1004 
1005  _SEH2_TRY
1006  {
1007  ProbeForWrite(Point, sizeof(POINT), 1);
1008  Point->x = pdcattr->ptlWindowOrg.x;
1009  Point->y = pdcattr->ptlWindowOrg.y;
1010  }
1012  {
1014  }
1015  _SEH2_END;
1016 
1017  if (!NT_SUCCESS(Status))
1018  {
1020  DC_UnlockDc(dc);
1021  return FALSE;
1022  }
1023  }
1024 
1025  pdcattr->ptlWindowOrg.x = X;
1026  pdcattr->ptlWindowOrg.y = Y;
1027  pdcattr->flXform |= PAGE_XLATE_CHANGED;
1028 
1029  DC_UnlockDc(dc);
1030 
1031  return TRUE;
1032 }
#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
HDC dc
Definition: cylfrac.c:34
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
LONG y
Definition: windef.h:315
_SEH2_TRY
Definition: create.c:4250
#define PAGE_XLATE_CHANGED
Definition: ntgdihdl.h:197
#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:314
FLONG flXform
Definition: ntgdihdl.h:342
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:237
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2725
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define X(b, s)
POINTL ptlWindowOrg
Definition: ntgdihdl.h:338

Referenced by SetWindowOrgEx().

◆ 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 365 of file coord.c.

371 {
372  PDC pdc;
373  LPPOINT Points;
374  ULONG Size;
375  BOOL ret = TRUE;
376 
377  if (Count <= 0)
378  return TRUE;
379 
380  pdc = DC_LockDc(hDC);
381  if (!pdc)
382  {
384  return FALSE;
385  }
386 
387  Size = Count * sizeof(POINT);
388 
389  // FIXME: It would be wise to have a small stack buffer as optimization
391  if (!Points)
392  {
393  DC_UnlockDc(pdc);
395  return FALSE;
396  }
397 
398  _SEH2_TRY
399  {
400  ProbeForWrite(UnsafePtOut, Size, 1);
401  ProbeForRead(UnsafePtsIn, Size, 1);
402  RtlCopyMemory(Points, UnsafePtsIn, Size);
403  }
405  {
406  /* Do not set last error */
407  _SEH2_YIELD(goto leave;)
408  }
409  _SEH2_END;
410 
411  switch (iMode)
412  {
413  case GdiDpToLp:
414  DC_vXformDeviceToWorld(pdc, Count, Points, Points);
415  break;
416 
417  case GdiLpToDp:
418  DC_vXformWorldToDevice(pdc, Count, Points, Points);
419  break;
420 
421  case 2: // Not supported yet. Need testing.
422  default:
423  {
425  ret = FALSE;
426  goto leave;
427  }
428  }
429 
430  _SEH2_TRY
431  {
432  /* Pointer was already probed! */
433  RtlCopyMemory(UnsafePtOut, Points, Size);
434  }
436  {
437  /* Do not set last error */
438  ret = 0;
439  }
440  _SEH2_END;
441 
442 //
443 // If we are getting called that means User XForms is a mess!
444 //
445 leave:
446  DC_UnlockDc(pdc);
448  return ret;
449 }
#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
FORCEINLINE VOID DC_vXformWorldToDevice(IN PDC pdc, IN ULONG cNumPoints, IN PPOINTL pptlDest, IN PPOINTL pptlSource)
Definition: coord.h:140
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
FORCEINLINE VOID DC_vXformDeviceToWorld(IN PDC pdc, IN ULONG cNumPoints, IN PPOINTL pptlDest, IN PPOINTL pptlSource)
Definition: coord.h:124
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
#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
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by DPtoLP(), and LPtoDP().

Variable Documentation

◆ gmxIdentity