2003-05-18 17:16:18 +00:00
|
|
|
/*
|
|
|
|
* ReactOS W32 Subsystem
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2003-05-18 17:16:18 +00:00
|
|
|
*/
|
2008-05-13 23:26:02 +00:00
|
|
|
/*
|
2002-07-04 19:56:38 +00:00
|
|
|
*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* PURPOSE: Coordinate systems
|
|
|
|
* FILE: subsys/win32k/objects/coord.c
|
|
|
|
* PROGRAMER: Unknown
|
|
|
|
*/
|
1999-07-22 16:21:53 +00:00
|
|
|
|
2002-07-04 19:56:38 +00:00
|
|
|
/* INCLUDES ******************************************************************/
|
2005-06-29 07:09:25 +00:00
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
1999-07-22 16:21:53 +00:00
|
|
|
|
2005-06-29 07:09:25 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2002-07-04 19:56:38 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2006-06-21 08:33:27 +00:00
|
|
|
void FASTCALL
|
|
|
|
IntFixIsotropicMapping(PDC dc)
|
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2009-02-02 00:49:19 +00:00
|
|
|
LONG fx, fy, s;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
2009-02-02 00:49:19 +00:00
|
|
|
/* Get a pointer to the DC_ATTR */
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
2009-02-02 00:49:19 +00:00
|
|
|
/* Check if all values are valid */
|
2009-03-20 04:51:26 +00:00
|
|
|
if (pdcattr->szlWindowExt.cx == 0 || pdcattr->szlWindowExt.cy == 0 ||
|
|
|
|
pdcattr->szlViewportExt.cx == 0 || pdcattr->szlViewportExt.cy == 0)
|
2009-01-29 21:33:38 +00:00
|
|
|
{
|
2009-02-02 00:49:19 +00:00
|
|
|
/* Don't recalculate */
|
|
|
|
return;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
2009-02-02 00:49:19 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
fx = abs(pdcattr->szlWindowExt.cx * pdcattr->szlViewportExt.cy);
|
|
|
|
fy = abs(pdcattr->szlWindowExt.cy * pdcattr->szlViewportExt.cx);
|
2009-02-02 00:49:19 +00:00
|
|
|
|
|
|
|
if (fy > fx)
|
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
s = pdcattr->szlWindowExt.cy * pdcattr->szlViewportExt.cx > 0 ? 1 : -1;
|
|
|
|
pdcattr->szlViewportExt.cx = s * fx / pdcattr->szlWindowExt.cy;
|
2009-02-02 00:49:19 +00:00
|
|
|
}
|
|
|
|
else if (fx > fy)
|
2009-01-29 21:33:38 +00:00
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
s = pdcattr->szlWindowExt.cx * pdcattr->szlViewportExt.cy > 0 ? 1 : -1;
|
|
|
|
pdcattr->szlViewportExt.cy = s * fy / pdcattr->szlWindowExt.cx;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
2006-06-21 08:33:27 +00:00
|
|
|
}
|
|
|
|
|
2009-03-23 03:43:11 +00:00
|
|
|
// FIXME: don't use floating point in the kernel! use XFORMOBJ function
|
2004-01-04 21:26:59 +00:00
|
|
|
BOOL FASTCALL
|
2009-03-23 17:47:58 +00:00
|
|
|
IntGdiCombineTransform(
|
|
|
|
LPXFORM XFormResult,
|
|
|
|
LPXFORM xform1,
|
|
|
|
LPXFORM xform2)
|
2004-01-04 21:26:59 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
XFORM xformTemp;
|
|
|
|
/* Check for illegal parameters */
|
|
|
|
if (!XFormResult || !xform1 || !xform2)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create the result in a temporary XFORM, since xformResult may be
|
|
|
|
* equal to xform1 or xform2 */
|
|
|
|
xformTemp.eM11 = xform1->eM11 * xform2->eM11 + xform1->eM12 * xform2->eM21;
|
|
|
|
xformTemp.eM12 = xform1->eM11 * xform2->eM12 + xform1->eM12 * xform2->eM22;
|
|
|
|
xformTemp.eM21 = xform1->eM21 * xform2->eM11 + xform1->eM22 * xform2->eM21;
|
|
|
|
xformTemp.eM22 = xform1->eM21 * xform2->eM12 + xform1->eM22 * xform2->eM22;
|
|
|
|
xformTemp.eDx = xform1->eDx * xform2->eM11 + xform1->eDy * xform2->eM21 + xform2->eDx;
|
|
|
|
xformTemp.eDy = xform1->eDx * xform2->eM12 + xform1->eDy * xform2->eM22 + xform2->eDy;
|
|
|
|
*XFormResult = xformTemp;
|
|
|
|
|
|
|
|
return TRUE;
|
2004-01-04 21:26:59 +00:00
|
|
|
}
|
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
// FIXME: should be XFORML and use XFORMOBJ functions
|
|
|
|
BOOL APIENTRY NtGdiCombineTransform(
|
|
|
|
LPXFORM UnsafeXFormResult,
|
|
|
|
LPXFORM Unsafexform1,
|
|
|
|
LPXFORM Unsafexform2)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
BOOL Ret;
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
ProbeForWrite(UnsafeXFormResult, sizeof(XFORM), 1);
|
|
|
|
ProbeForRead(Unsafexform1, sizeof(XFORM), 1);
|
|
|
|
ProbeForRead(Unsafexform2, sizeof(XFORM), 1);
|
|
|
|
Ret = IntGdiCombineTransform(UnsafeXFormResult,
|
|
|
|
Unsafexform1,
|
|
|
|
Unsafexform2);
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Ret = FALSE;
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
|
|
|
return Ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
// FIXME: Don't use floating point in the kernel
|
2006-09-13 16:50:19 +00:00
|
|
|
BOOL
|
|
|
|
FASTCALL
|
2009-03-23 17:47:58 +00:00
|
|
|
IntGdiModifyWorldTransform(
|
|
|
|
PDC pDc,
|
|
|
|
CONST LPXFORM lpXForm,
|
|
|
|
DWORD Mode)
|
2006-09-13 16:50:19 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
XFORM xformWorld2Wnd;
|
2009-07-31 18:21:24 +00:00
|
|
|
ASSERT(pDc);
|
2009-01-29 21:33:38 +00:00
|
|
|
|
|
|
|
switch (Mode)
|
|
|
|
{
|
|
|
|
case MWT_IDENTITY:
|
|
|
|
xformWorld2Wnd.eM11 = 1.0f;
|
|
|
|
xformWorld2Wnd.eM12 = 0.0f;
|
|
|
|
xformWorld2Wnd.eM21 = 0.0f;
|
|
|
|
xformWorld2Wnd.eM22 = 1.0f;
|
|
|
|
xformWorld2Wnd.eDx = 0.0f;
|
|
|
|
xformWorld2Wnd.eDy = 0.0f;
|
2009-03-20 14:16:01 +00:00
|
|
|
XForm2MatrixS(&pDc->dclevel.mxWorldToPage, &xformWorld2Wnd);
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MWT_LEFTMULTIPLY:
|
2009-03-20 14:16:01 +00:00
|
|
|
MatrixS2XForm(&xformWorld2Wnd, &pDc->dclevel.mxWorldToPage);
|
2009-01-29 21:33:38 +00:00
|
|
|
IntGdiCombineTransform(&xformWorld2Wnd, lpXForm, &xformWorld2Wnd);
|
2009-03-20 14:16:01 +00:00
|
|
|
XForm2MatrixS(&pDc->dclevel.mxWorldToPage, &xformWorld2Wnd);
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MWT_RIGHTMULTIPLY:
|
2009-03-20 14:16:01 +00:00
|
|
|
MatrixS2XForm(&xformWorld2Wnd, &pDc->dclevel.mxWorldToPage);
|
2009-01-29 21:33:38 +00:00
|
|
|
IntGdiCombineTransform(&xformWorld2Wnd, &xformWorld2Wnd, lpXForm);
|
2009-03-20 14:16:01 +00:00
|
|
|
XForm2MatrixS(&pDc->dclevel.mxWorldToPage, &xformWorld2Wnd);
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MWT_MAX+1: // Must be MWT_SET????
|
2009-03-20 14:16:01 +00:00
|
|
|
XForm2MatrixS(&pDc->dclevel.mxWorldToPage, lpXForm); // Do it like Wine.
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
DC_UpdateXforms(pDc);
|
|
|
|
return TRUE;
|
2006-09-13 16:50:19 +00:00
|
|
|
}
|
|
|
|
|
2009-12-20 18:59:10 +00:00
|
|
|
// FIXME: Don't use floating point in the kernel!
|
2009-12-20 22:46:22 +00:00
|
|
|
void IntWindowToViewPort(PDC_ATTR pdcattr, LPXFORM xformWnd2Vport)
|
2009-12-20 18:59:10 +00:00
|
|
|
{
|
|
|
|
FLOAT scaleX, scaleY;
|
|
|
|
|
|
|
|
scaleX = (pdcattr->szlWindowExt.cx ? (FLOAT)pdcattr->szlViewportExt.cx / (FLOAT)pdcattr->szlWindowExt.cx : 0.0f);
|
|
|
|
scaleY = (pdcattr->szlWindowExt.cy ? (FLOAT)pdcattr->szlViewportExt.cy / (FLOAT)pdcattr->szlWindowExt.cy : 0.0f);
|
|
|
|
xformWnd2Vport->eM11 = scaleX;
|
|
|
|
xformWnd2Vport->eM12 = 0.0;
|
|
|
|
xformWnd2Vport->eM21 = 0.0;
|
|
|
|
xformWnd2Vport->eM22 = scaleY;
|
|
|
|
xformWnd2Vport->eDx = (FLOAT)pdcattr->ptlViewportOrg.x - scaleX * (FLOAT)pdcattr->ptlWindowOrg.x;
|
|
|
|
xformWnd2Vport->eDy = (FLOAT)pdcattr->ptlViewportOrg.y - scaleY * (FLOAT)pdcattr->ptlWindowOrg.y;
|
|
|
|
}
|
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
// FIXME: Should be XFORML and use XFORMOBJ functions directly
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
NtGdiGetTransform(
|
|
|
|
HDC hDC,
|
|
|
|
DWORD iXform,
|
|
|
|
LPXFORM XForm)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC dc;
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (!XForm)
|
|
|
|
{
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
ProbeForWrite(XForm, sizeof(XFORM), 1);
|
|
|
|
switch (iXform)
|
|
|
|
{
|
|
|
|
case GdiWorldSpaceToPageSpace:
|
2009-03-20 14:16:01 +00:00
|
|
|
MatrixS2XForm(XForm, &dc->dclevel.mxWorldToPage);
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
2009-03-23 17:47:58 +00:00
|
|
|
|
2009-10-25 17:23:19 +00:00
|
|
|
case GdiWorldSpaceToDeviceSpace:
|
|
|
|
MatrixS2XForm(XForm, &dc->dclevel.mxWorldToDevice);
|
|
|
|
break;
|
|
|
|
|
2009-10-25 18:49:08 +00:00
|
|
|
case GdiPageSpaceToDeviceSpace:
|
2009-12-20 22:46:22 +00:00
|
|
|
IntWindowToViewPort(dc->pdcattr, XForm);
|
2009-10-25 18:49:08 +00:00
|
|
|
break;
|
|
|
|
|
2009-10-25 17:23:19 +00:00
|
|
|
case GdiDeviceSpaceToWorldSpace:
|
|
|
|
MatrixS2XForm(XForm, &dc->dclevel.mxDeviceToWorld);
|
|
|
|
break;
|
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
default:
|
2009-10-25 18:49:08 +00:00
|
|
|
DPRINT1("Unknown transform %lu\n", iXform);
|
2009-10-25 17:23:19 +00:00
|
|
|
Status = STATUS_INVALID_PARAMETER;
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
2005-06-07 16:34:07 +00:00
|
|
|
DC_UnlockDc(dc);
|
2009-01-29 21:33:38 +00:00
|
|
|
return NT_SUCCESS(Status);
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2003-08-17 17:32:58 +00:00
|
|
|
|
2003-03-14 22:48:32 +00:00
|
|
|
/*!
|
|
|
|
* Converts points from logical coordinates into device coordinates. Conversion depends on the mapping mode,
|
|
|
|
* world transfrom, viewport origin settings for the given device context.
|
|
|
|
* \param hDC device context.
|
|
|
|
* \param Points an array of POINT structures (in/out).
|
|
|
|
* \param Count number of elements in the array of POINT structures.
|
|
|
|
* \return TRUE if success.
|
|
|
|
*/
|
2007-08-10 07:39:46 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
NtGdiTransformPoints(
|
|
|
|
HDC hDC,
|
|
|
|
PPOINT UnsafePtsIn,
|
|
|
|
PPOINT UnsafePtOut,
|
|
|
|
INT Count,
|
|
|
|
INT iMode)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC dc;
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
LPPOINT Points;
|
|
|
|
ULONG Size;
|
|
|
|
|
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!UnsafePtsIn || !UnsafePtOut || Count <= 0)
|
|
|
|
{
|
2007-08-10 07:39:46 +00:00
|
|
|
DC_UnlockDc(dc);
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Size = Count * sizeof(POINT);
|
|
|
|
|
2009-03-24 02:58:14 +00:00
|
|
|
// FIXME: It would be wise to have a small stack buffer as optimization
|
|
|
|
Points = ExAllocatePoolWithTag(PagedPool, Size, TAG_COORD);
|
2009-01-29 21:33:38 +00:00
|
|
|
if (!Points)
|
|
|
|
{
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
ProbeForWrite(UnsafePtOut, Size, 1);
|
|
|
|
ProbeForRead(UnsafePtsIn, Size, 1);
|
|
|
|
RtlCopyMemory(Points, UnsafePtsIn, Size);
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
ExFreePoolWithTag(Points, TAG_COORD);
|
|
|
|
SetLastNtError(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (iMode)
|
|
|
|
{
|
|
|
|
case GdiDpToLp:
|
|
|
|
IntDPtoLP(dc, Points, Count);
|
|
|
|
break;
|
2009-03-23 17:47:58 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
case GdiLpToDp:
|
|
|
|
IntLPtoDP(dc, Points, Count);
|
|
|
|
break;
|
2009-03-23 17:47:58 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
case 2: // Not supported yet. Need testing.
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
ExFreePoolWithTag(Points, TAG_COORD);
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
/* pointer was already probed! */
|
|
|
|
RtlCopyMemory(UnsafePtOut, Points, Size);
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
ExFreePoolWithTag(Points, TAG_COORD);
|
|
|
|
SetLastNtError(Status);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-08-21 05:01:00 +00:00
|
|
|
//
|
|
|
|
// If we are getting called that means User XForms is a mess!
|
|
|
|
//
|
2009-01-29 21:33:38 +00:00
|
|
|
DC_UnlockDc(dc);
|
|
|
|
ExFreePoolWithTag(Points, TAG_COORD);
|
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
NtGdiModifyWorldTransform(
|
|
|
|
HDC hDC,
|
|
|
|
LPXFORM UnsafeXForm,
|
|
|
|
DWORD Mode)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC dc;
|
|
|
|
XFORM SafeXForm;
|
|
|
|
BOOL Ret = TRUE;
|
|
|
|
|
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The xform is permitted to be NULL for MWT_IDENTITY.
|
|
|
|
// However, if it is not NULL, then it must be valid even though it is not used.
|
|
|
|
if (UnsafeXForm != NULL || Mode != MWT_IDENTITY)
|
|
|
|
{
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
ProbeForRead(UnsafeXForm, sizeof(XFORM), 1);
|
|
|
|
RtlCopyMemory(&SafeXForm, UnsafeXForm, sizeof(XFORM));
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Ret = FALSE;
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Safe to handle kernel mode data.
|
|
|
|
if (Ret) Ret = IntGdiModifyWorldTransform(dc, &SafeXForm, Mode);
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return Ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
NtGdiOffsetViewportOrgEx(
|
|
|
|
HDC hDC,
|
|
|
|
int XOffset,
|
|
|
|
int YOffset,
|
|
|
|
LPPOINT UnsafePoint)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC dc;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
|
|
|
if (UnsafePoint)
|
2004-01-04 21:26:59 +00:00
|
|
|
{
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_TRY
|
2005-07-26 12:22:55 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
ProbeForWrite(UnsafePoint, sizeof(POINT), 1);
|
2009-03-20 04:51:26 +00:00
|
|
|
UnsafePoint->x = pdcattr->ptlViewportOrg.x;
|
|
|
|
UnsafePoint->y = pdcattr->ptlViewportOrg.y;
|
|
|
|
if (pdcattr->dwLayout & LAYOUT_RTL)
|
2009-01-29 21:33:38 +00:00
|
|
|
{
|
|
|
|
UnsafePoint->x = -UnsafePoint->x;
|
|
|
|
}
|
2005-07-26 12:22:55 +00:00
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2005-07-26 12:22:55 +00:00
|
|
|
{
|
2008-11-30 19:28:11 +00:00
|
|
|
Status = _SEH2_GetExceptionCode();
|
2005-07-26 12:22:55 +00:00
|
|
|
}
|
2008-11-30 19:28:11 +00:00
|
|
|
_SEH2_END;
|
2005-07-26 12:22:55 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-05-27 07:23:05 +00:00
|
|
|
}
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
if (pdcattr->dwLayout & LAYOUT_RTL)
|
2009-01-29 21:33:38 +00:00
|
|
|
{
|
|
|
|
XOffset = -XOffset;
|
|
|
|
}
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->ptlViewportOrg.x += XOffset;
|
|
|
|
pdcattr->ptlViewportOrg.y += YOffset;
|
2009-01-29 21:33:38 +00:00
|
|
|
DC_UpdateXforms(dc);
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
|
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
NtGdiOffsetWindowOrgEx(
|
|
|
|
HDC hDC,
|
|
|
|
int XOffset,
|
|
|
|
int YOffset,
|
|
|
|
LPPOINT Point)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC dc;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (!dc)
|
2003-07-22 20:02:08 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
2003-07-22 20:02:08 +00:00
|
|
|
}
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2003-07-22 20:02:08 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
if (Point)
|
2003-07-22 20:02:08 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
ProbeForWrite(Point, sizeof(POINT), 1);
|
2009-03-20 04:51:26 +00:00
|
|
|
Point->x = pdcattr->ptlWindowOrg.x;
|
|
|
|
Point->y = pdcattr->ptlWindowOrg.y;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-07-22 20:02:08 +00:00
|
|
|
}
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->ptlWindowOrg.x += XOffset;
|
|
|
|
pdcattr->ptlWindowOrg.y += YOffset;
|
2003-07-22 20:02:08 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
DC_UpdateXforms(dc);
|
|
|
|
DC_UnlockDc(dc);
|
2003-07-22 20:02:08 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
NtGdiScaleViewportExtEx(
|
|
|
|
HDC hDC,
|
|
|
|
int Xnum,
|
|
|
|
int Xdenom,
|
|
|
|
int Ynum,
|
|
|
|
int Ydenom,
|
|
|
|
LPSIZE pSize)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC pDC;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
BOOL Ret = FALSE;
|
|
|
|
LONG X, Y;
|
|
|
|
|
|
|
|
pDC = DC_LockDc(hDC);
|
|
|
|
if (!pDC)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
2008-05-13 23:26:02 +00:00
|
|
|
return FALSE;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = pDC->pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
|
|
|
if (pSize)
|
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
_SEH2_TRY
|
2008-05-13 23:26:02 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
ProbeForWrite(pSize, sizeof(LPSIZE), 1);
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pSize->cx = pdcattr->szlViewportExt.cx;
|
|
|
|
pSize->cy = pdcattr->szlViewportExt.cy;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
DC_UnlockDc(pDC);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
if (pdcattr->iMapMode > MM_TWIPS)
|
2009-01-29 21:33:38 +00:00
|
|
|
{
|
|
|
|
if (Xdenom && Ydenom)
|
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
X = Xnum * pdcattr->szlViewportExt.cx / Xdenom;
|
2009-01-29 21:33:38 +00:00
|
|
|
if (X)
|
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
Y = Ynum * pdcattr->szlViewportExt.cy / Ydenom;
|
2009-01-29 21:33:38 +00:00
|
|
|
if (Y)
|
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->szlViewportExt.cx = X;
|
|
|
|
pdcattr->szlViewportExt.cy = Y;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
|
|
|
IntMirrorWindowOrg(pDC);
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->flXform |= (PAGE_EXTENTS_CHANGED |
|
2009-03-23 17:47:58 +00:00
|
|
|
INVALIDATE_ATTRIBUTES |
|
|
|
|
DEVICE_TO_WORLD_INVALID);
|
2009-01-29 21:33:38 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
if (pdcattr->iMapMode == MM_ISOTROPIC)
|
2009-01-29 21:33:38 +00:00
|
|
|
{
|
|
|
|
IntFixIsotropicMapping(pDC);
|
|
|
|
}
|
|
|
|
DC_UpdateXforms(pDC);
|
|
|
|
|
|
|
|
Ret = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2008-05-13 23:26:02 +00:00
|
|
|
}
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
Ret = TRUE;
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
DC_UnlockDc(pDC);
|
|
|
|
return Ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
NtGdiScaleWindowExtEx(
|
|
|
|
HDC hDC,
|
|
|
|
int Xnum,
|
|
|
|
int Xdenom,
|
|
|
|
int Ynum,
|
|
|
|
int Ydenom,
|
|
|
|
LPSIZE pSize)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC pDC;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
BOOL Ret = FALSE;
|
|
|
|
LONG X, Y;
|
|
|
|
|
|
|
|
pDC = DC_LockDc(hDC);
|
|
|
|
if (!pDC)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
2008-05-13 23:26:02 +00:00
|
|
|
return FALSE;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = pDC->pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
|
|
|
if (pSize)
|
|
|
|
{
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
_SEH2_TRY
|
2008-05-13 23:26:02 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
ProbeForWrite(pSize, sizeof(LPSIZE), 1);
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
X = pdcattr->szlWindowExt.cx;
|
|
|
|
if (pdcattr->dwLayout & LAYOUT_RTL) X = -X;
|
2009-01-29 21:33:38 +00:00
|
|
|
pSize->cx = X;
|
2009-03-20 04:51:26 +00:00
|
|
|
pSize->cy = pdcattr->szlWindowExt.cy;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
DC_UnlockDc(pDC);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
if (pdcattr->iMapMode > MM_TWIPS)
|
2009-01-29 21:33:38 +00:00
|
|
|
{
|
|
|
|
if (Xdenom && Ydenom)
|
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
X = Xnum * pdcattr->szlWindowExt.cx / Xdenom;
|
2009-01-29 21:33:38 +00:00
|
|
|
if (X)
|
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
Y = Ynum * pdcattr->szlWindowExt.cy / Ydenom;
|
2009-01-29 21:33:38 +00:00
|
|
|
if (Y)
|
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->szlWindowExt.cx = X;
|
|
|
|
pdcattr->szlWindowExt.cy = Y;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
|
|
|
IntMirrorWindowOrg(pDC);
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->flXform |= (PAGE_EXTENTS_CHANGED|INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID);
|
2009-01-29 21:33:38 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
if (pdcattr->iMapMode == MM_ISOTROPIC) IntFixIsotropicMapping(pDC);
|
2009-01-29 21:33:38 +00:00
|
|
|
DC_UpdateXforms(pDC);
|
|
|
|
|
|
|
|
Ret = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2008-05-13 23:26:02 +00:00
|
|
|
}
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
Ret = TRUE;
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
DC_UnlockDc(pDC);
|
|
|
|
return Ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
int
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
IntGdiSetMapMode(
|
|
|
|
PDC dc,
|
|
|
|
int MapMode)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
int PrevMapMode;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr = dc->pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
PrevMapMode = pdcattr->iMapMode;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->iMapMode = MapMode;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
|
|
|
switch (MapMode)
|
|
|
|
{
|
|
|
|
case MM_TEXT:
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->szlWindowExt.cx = 1;
|
|
|
|
pdcattr->szlWindowExt.cy = 1;
|
|
|
|
pdcattr->szlViewportExt.cx = 1;
|
|
|
|
pdcattr->szlViewportExt.cy = 1;
|
|
|
|
pdcattr->flXform &= ~(ISO_OR_ANISO_MAP_MODE|PTOD_EFM22_NEGATIVE|
|
2009-01-29 21:33:38 +00:00
|
|
|
PTOD_EFM11_NEGATIVE|POSITIVE_Y_IS_UP);
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->flXform |= (PAGE_XLATE_CHANGED|PAGE_TO_DEVICE_SCALE_IDENTITY|
|
2009-01-29 21:33:38 +00:00
|
|
|
INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MM_ISOTROPIC:
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->flXform |= ISO_OR_ANISO_MAP_MODE;
|
2009-01-29 21:33:38 +00:00
|
|
|
/* Fall through */
|
|
|
|
|
|
|
|
case MM_LOMETRIC:
|
2009-12-20 13:55:45 +00:00
|
|
|
pdcattr->szlWindowExt.cx = pdcattr->szlVirtualDeviceMm.cx * 10;
|
|
|
|
pdcattr->szlWindowExt.cy = pdcattr->szlVirtualDeviceMm.cy * 10;
|
|
|
|
pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
|
|
|
|
pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MM_HIMETRIC:
|
2009-12-20 13:55:45 +00:00
|
|
|
pdcattr->szlWindowExt.cx = pdcattr->szlVirtualDeviceMm.cx * 100;
|
|
|
|
pdcattr->szlWindowExt.cy = pdcattr->szlVirtualDeviceMm.cy * 100;
|
|
|
|
pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
|
|
|
|
pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MM_LOENGLISH:
|
2009-12-20 13:55:45 +00:00
|
|
|
pdcattr->szlWindowExt.cx = MulDiv(1000, pdcattr->szlVirtualDeviceMm.cx, 254);
|
|
|
|
pdcattr->szlWindowExt.cy = MulDiv(1000, pdcattr->szlVirtualDeviceMm.cy, 254);
|
|
|
|
pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
|
|
|
|
pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MM_HIENGLISH:
|
2009-12-20 13:55:45 +00:00
|
|
|
pdcattr->szlWindowExt.cx = MulDiv(10000, pdcattr->szlVirtualDeviceMm.cx, 254);
|
|
|
|
pdcattr->szlWindowExt.cy = MulDiv(10000, pdcattr->szlVirtualDeviceMm.cy, 254);
|
|
|
|
pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
|
|
|
|
pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MM_TWIPS:
|
2009-12-20 13:55:45 +00:00
|
|
|
pdcattr->szlWindowExt.cx = MulDiv(14400, pdcattr->szlVirtualDeviceMm.cx, 254);
|
|
|
|
pdcattr->szlWindowExt.cy = MulDiv(14400, pdcattr->szlVirtualDeviceMm.cy, 254);
|
|
|
|
pdcattr->szlViewportExt.cx = pdcattr->szlVirtualDevicePixel.cx;
|
|
|
|
pdcattr->szlViewportExt.cy = -pdcattr->szlVirtualDevicePixel.cy;
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MM_ANISOTROPIC:
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->flXform &= ~(PAGE_TO_DEVICE_IDENTITY|POSITIVE_Y_IS_UP);
|
|
|
|
pdcattr->flXform |= ISO_OR_ANISO_MAP_MODE;
|
2009-01-29 21:33:38 +00:00
|
|
|
break;
|
2009-03-23 17:47:58 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
default:
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->iMapMode = PrevMapMode;
|
2009-01-29 21:33:38 +00:00
|
|
|
PrevMapMode = 0;
|
|
|
|
}
|
2008-10-05 12:23:46 +00:00
|
|
|
DC_UpdateXforms(dc);
|
2003-07-22 20:02:08 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
return PrevMapMode;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
NtGdiSetViewportOrgEx(
|
|
|
|
HDC hDC,
|
|
|
|
int X,
|
|
|
|
int Y,
|
|
|
|
LPPOINT Point)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC dc;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2003-07-22 20:02:08 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (!dc)
|
2003-07-22 20:02:08 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
2003-07-22 20:02:08 +00:00
|
|
|
}
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2003-07-22 20:02:08 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
if (Point)
|
2003-07-22 20:02:08 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
ProbeForWrite(Point, sizeof(POINT), 1);
|
2009-03-20 04:51:26 +00:00
|
|
|
Point->x = pdcattr->ptlViewportOrg.x;
|
|
|
|
Point->y = pdcattr->ptlViewportOrg.y;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-07-22 20:02:08 +00:00
|
|
|
}
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->ptlViewportOrg.x = X;
|
|
|
|
pdcattr->ptlViewportOrg.y = Y;
|
2003-07-22 20:02:08 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
DC_UpdateXforms(dc);
|
|
|
|
DC_UnlockDc(dc);
|
2003-07-22 20:02:08 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
NtGdiSetWindowOrgEx(
|
|
|
|
HDC hDC,
|
|
|
|
int X,
|
|
|
|
int Y,
|
|
|
|
LPPOINT Point)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC dc;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2003-07-22 20:02:08 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (!dc)
|
2003-07-22 20:02:08 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
2003-07-22 20:02:08 +00:00
|
|
|
}
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
if (Point)
|
2003-07-22 20:02:08 +00:00
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
|
|
|
ProbeForWrite(Point, sizeof(POINT), 1);
|
2009-03-20 04:51:26 +00:00
|
|
|
Point->x = pdcattr->ptlWindowOrg.x;
|
|
|
|
Point->y = pdcattr->ptlWindowOrg.y;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-07-22 20:02:08 +00:00
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->ptlWindowOrg.x = X;
|
|
|
|
pdcattr->ptlWindowOrg.y = Y;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
DC_UpdateXforms(dc);
|
|
|
|
DC_UnlockDc(dc);
|
2003-07-22 20:02:08 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2007-12-01 21:47:27 +00:00
|
|
|
//
|
|
|
|
// Mirror Window function.
|
|
|
|
//
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
IntMirrorWindowOrg(PDC dc)
|
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
LONG X;
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
if (!(pdcattr->dwLayout & LAYOUT_RTL))
|
2009-01-29 21:33:38 +00:00
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->ptlWindowOrg.x = pdcattr->lWindowOrgx; // Flip it back.
|
2009-01-29 21:33:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-03-20 04:51:26 +00:00
|
|
|
if (!pdcattr->szlViewportExt.cx) return;
|
2009-01-29 21:33:38 +00:00
|
|
|
//
|
|
|
|
// WOrgx = wox - (Width - 1) * WExtx / VExtx
|
|
|
|
//
|
|
|
|
X = (dc->erclWindow.right - dc->erclWindow.left) - 1; // Get device width - 1
|
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
X = (X * pdcattr->szlWindowExt.cx) / pdcattr->szlViewportExt.cx;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->ptlWindowOrg.x = pdcattr->lWindowOrgx - X; // Now set the inverted win origion.
|
2009-01-29 21:33:38 +00:00
|
|
|
|
|
|
|
return;
|
2007-12-01 21:47:27 +00:00
|
|
|
}
|
|
|
|
|
2010-08-23 01:41:56 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
DC_vSetLayout(
|
|
|
|
IN PDC pdc,
|
2007-11-28 07:52:51 +00:00
|
|
|
IN LONG wox,
|
|
|
|
IN DWORD dwLayout)
|
|
|
|
{
|
2010-08-23 01:41:56 +00:00
|
|
|
PDC_ATTR pdcattr = pdc->pdcattr;
|
2007-11-28 07:52:51 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->dwLayout = dwLayout;
|
2007-11-28 07:52:51 +00:00
|
|
|
|
2010-08-23 01:41:56 +00:00
|
|
|
if (!(dwLayout & LAYOUT_ORIENTATIONMASK)) return;
|
2007-12-01 21:47:27 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
if (dwLayout & LAYOUT_RTL)
|
|
|
|
{
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->iMapMode = MM_ANISOTROPIC;
|
2009-01-29 21:33:38 +00:00
|
|
|
}
|
2007-12-01 21:47:27 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->szlWindowExt.cy = -pdcattr->szlWindowExt.cy;
|
|
|
|
pdcattr->ptlWindowOrg.x = -pdcattr->ptlWindowOrg.x;
|
2007-12-01 21:47:27 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
if (wox == -1)
|
2010-08-23 01:41:56 +00:00
|
|
|
IntMirrorWindowOrg(pdc);
|
2009-01-29 21:33:38 +00:00
|
|
|
else
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->ptlWindowOrg.x = wox - pdcattr->ptlWindowOrg.x;
|
2007-12-01 21:47:27 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
if (!(pdcattr->flTextAlign & TA_CENTER)) pdcattr->flTextAlign |= TA_RIGHT;
|
2007-12-01 21:47:27 +00:00
|
|
|
|
2010-08-23 01:41:56 +00:00
|
|
|
if (pdc->dclevel.flPath & DCPATH_CLOCKWISE)
|
|
|
|
pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE;
|
2009-01-29 21:33:38 +00:00
|
|
|
else
|
2010-08-23 01:41:56 +00:00
|
|
|
pdc->dclevel.flPath |= DCPATH_CLOCKWISE;
|
2007-12-01 21:47:27 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->flXform |= (PAGE_EXTENTS_CHANGED |
|
2009-01-29 21:33:38 +00:00
|
|
|
INVALIDATE_ATTRIBUTES |
|
|
|
|
DEVICE_TO_WORLD_INVALID);
|
2007-12-01 21:47:27 +00:00
|
|
|
|
2010-08-23 01:41:56 +00:00
|
|
|
// DC_UpdateXforms(pdc);
|
|
|
|
}
|
|
|
|
|
|
|
|
// NtGdiSetLayout
|
|
|
|
//
|
|
|
|
// The default is left to right. This function changes it to right to left, which
|
|
|
|
// is the standard in Arabic and Hebrew cultures.
|
|
|
|
//
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
DWORD
|
|
|
|
APIENTRY
|
|
|
|
NtGdiSetLayout(
|
|
|
|
IN HDC hdc,
|
|
|
|
IN LONG wox,
|
|
|
|
IN DWORD dwLayout)
|
|
|
|
{
|
|
|
|
PDC pdc;
|
|
|
|
PDC_ATTR pdcattr;
|
|
|
|
DWORD oLayout;
|
|
|
|
|
|
|
|
pdc = DC_LockDc(hdc);
|
|
|
|
if (!pdc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return GDI_ERROR;
|
|
|
|
}
|
|
|
|
pdcattr = pdc->pdcattr;
|
|
|
|
|
|
|
|
oLayout = pdcattr->dwLayout;
|
|
|
|
DC_vSetLayout(pdc, wox, dwLayout);
|
|
|
|
|
|
|
|
DC_UnlockDc(pdc);
|
2009-01-29 21:33:38 +00:00
|
|
|
return oLayout;
|
2007-12-01 21:47:27 +00:00
|
|
|
}
|
2007-11-28 07:52:51 +00:00
|
|
|
|
2007-12-01 21:47:27 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
LONG
|
|
|
|
APIENTRY
|
|
|
|
NtGdiGetDeviceWidth(
|
|
|
|
IN HDC hdc)
|
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC dc;
|
|
|
|
LONG Ret;
|
|
|
|
dc = DC_LockDc(hdc);
|
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
Ret = dc->erclWindow.right - dc->erclWindow.left;
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return Ret;
|
2007-12-01 21:47:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
NtGdiMirrorWindowOrg(
|
|
|
|
IN HDC hdc)
|
|
|
|
{
|
2009-01-29 21:33:38 +00:00
|
|
|
PDC dc;
|
|
|
|
dc = DC_LockDc(hdc);
|
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
IntMirrorWindowOrg(dc);
|
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return TRUE;
|
2007-11-28 07:52:51 +00:00
|
|
|
}
|
1999-07-22 16:21:53 +00:00
|
|
|
|
2008-05-13 23:26:02 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
NtGdiSetSizeDevice(
|
|
|
|
IN HDC hdc,
|
|
|
|
IN INT cxVirtualDevice,
|
|
|
|
IN INT cyVirtualDevice)
|
|
|
|
{
|
|
|
|
PDC dc;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
if (!cxVirtualDevice || !cyVirtualDevice)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-05-13 23:26:02 +00:00
|
|
|
|
|
|
|
dc = DC_LockDc(hdc);
|
|
|
|
if (!dc) return FALSE;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->szlVirtualDeviceSize.cx = cxVirtualDevice;
|
|
|
|
pdcattr->szlVirtualDeviceSize.cy = cyVirtualDevice;
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
// DC_UpdateXforms(dc);
|
2008-05-13 23:26:02 +00:00
|
|
|
DC_UnlockDc(dc);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
NtGdiSetVirtualResolution(
|
|
|
|
IN HDC hdc,
|
|
|
|
IN INT cxVirtualDevicePixel,
|
|
|
|
IN INT cyVirtualDevicePixel,
|
|
|
|
IN INT cxVirtualDeviceMm,
|
|
|
|
IN INT cyVirtualDeviceMm)
|
|
|
|
{
|
|
|
|
PDC dc;
|
2009-03-20 04:51:26 +00:00
|
|
|
PDC_ATTR pdcattr;
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-12-19 18:57:27 +00:00
|
|
|
/* Check parameters (all zeroes resets to real resolution) */
|
|
|
|
if (cxVirtualDevicePixel == 0 && cyVirtualDevicePixel == 0 &&
|
|
|
|
cxVirtualDeviceMm == 0 && cyVirtualDeviceMm == 0)
|
|
|
|
{
|
|
|
|
cxVirtualDevicePixel = NtGdiGetDeviceCaps(hdc, HORZRES);
|
|
|
|
cyVirtualDevicePixel = NtGdiGetDeviceCaps(hdc, VERTRES);
|
|
|
|
cxVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, HORZSIZE);
|
|
|
|
cyVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, VERTSIZE);
|
|
|
|
}
|
|
|
|
else if (cxVirtualDevicePixel == 0 || cyVirtualDevicePixel == 0 ||
|
|
|
|
cxVirtualDeviceMm == 0 || cyVirtualDeviceMm == 0)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-05-13 23:26:02 +00:00
|
|
|
|
|
|
|
dc = DC_LockDc(hdc);
|
|
|
|
if (!dc) return FALSE;
|
2009-01-29 21:33:38 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr = dc->pdcattr;
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-03-20 04:51:26 +00:00
|
|
|
pdcattr->szlVirtualDevicePixel.cx = cxVirtualDevicePixel;
|
|
|
|
pdcattr->szlVirtualDevicePixel.cy = cyVirtualDevicePixel;
|
|
|
|
pdcattr->szlVirtualDeviceMm.cx = cxVirtualDeviceMm;
|
|
|
|
pdcattr->szlVirtualDeviceMm.cy = cyVirtualDeviceMm;
|
2008-05-13 23:26:02 +00:00
|
|
|
|
2009-01-29 21:33:38 +00:00
|
|
|
// DC_UpdateXforms(dc);
|
2008-05-13 23:26:02 +00:00
|
|
|
DC_UnlockDc(dc);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-03-23 03:43:11 +00:00
|
|
|
|
|
|
|
// FIXME: Don't use floating point in the kernel!
|
|
|
|
BOOL FASTCALL
|
|
|
|
DC_InvertXform(const XFORM *xformSrc,
|
|
|
|
XFORM *xformDest)
|
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
FLOAT determinant;
|
|
|
|
|
|
|
|
determinant = xformSrc->eM11*xformSrc->eM22 - xformSrc->eM12*xformSrc->eM21;
|
|
|
|
if (determinant > -1e-12 && determinant < 1e-12)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
xformDest->eM11 = xformSrc->eM22 / determinant;
|
|
|
|
xformDest->eM12 = -xformSrc->eM12 / determinant;
|
|
|
|
xformDest->eM21 = -xformSrc->eM21 / determinant;
|
|
|
|
xformDest->eM22 = xformSrc->eM11 / determinant;
|
|
|
|
xformDest->eDx = -xformSrc->eDx * xformDest->eM11 - xformSrc->eDy * xformDest->eM21;
|
|
|
|
xformDest->eDy = -xformSrc->eDx * xformDest->eM12 - xformSrc->eDy * xformDest->eM22;
|
|
|
|
|
|
|
|
return TRUE;
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID FASTCALL
|
2009-03-23 17:47:58 +00:00
|
|
|
DC_UpdateXforms(PDC dc)
|
2009-03-23 03:43:11 +00:00
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
XFORM xformWnd2Vport;
|
|
|
|
PDC_ATTR pdcattr = dc->pdcattr;
|
|
|
|
XFORM xformWorld2Vport, xformWorld2Wnd, xformVport2World;
|
|
|
|
|
|
|
|
/* Construct a transformation to do the window-to-viewport conversion */
|
2009-12-20 22:46:22 +00:00
|
|
|
IntWindowToViewPort(pdcattr, &xformWnd2Vport);
|
2009-03-23 17:47:58 +00:00
|
|
|
|
|
|
|
/* Combine with the world transformation */
|
|
|
|
MatrixS2XForm(&xformWorld2Vport, &dc->dclevel.mxWorldToDevice);
|
|
|
|
MatrixS2XForm(&xformWorld2Wnd, &dc->dclevel.mxWorldToPage);
|
|
|
|
IntGdiCombineTransform(&xformWorld2Vport, &xformWorld2Wnd, &xformWnd2Vport);
|
|
|
|
|
|
|
|
/* Create inverse of world-to-viewport transformation */
|
|
|
|
MatrixS2XForm(&xformVport2World, &dc->dclevel.mxDeviceToWorld);
|
|
|
|
if (DC_InvertXform(&xformWorld2Vport, &xformVport2World))
|
|
|
|
{
|
|
|
|
pdcattr->flXform &= ~DEVICE_TO_WORLD_INVALID;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pdcattr->flXform |= DEVICE_TO_WORLD_INVALID;
|
|
|
|
}
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-12-20 22:35:16 +00:00
|
|
|
/* Update transformation matrices */
|
2009-03-23 17:47:58 +00:00
|
|
|
XForm2MatrixS(&dc->dclevel.mxWorldToDevice, &xformWorld2Vport);
|
2009-12-20 22:35:16 +00:00
|
|
|
XForm2MatrixS(&dc->dclevel.mxDeviceToWorld, &xformVport2World);
|
2009-03-23 17:47:58 +00:00
|
|
|
}
|
2009-03-23 03:43:11 +00:00
|
|
|
|
|
|
|
LONG FASTCALL
|
|
|
|
IntCalcFillOrigin(PDC pdc)
|
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
pdc->ptlFillOrigin.x = pdc->dclevel.ptlBrushOrigin.x + pdc->ptlDCOrig.x;
|
|
|
|
pdc->ptlFillOrigin.y = pdc->dclevel.ptlBrushOrigin.y + pdc->ptlDCOrig.y;
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
return pdc->ptlFillOrigin.y;
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
|
|
|
|
2010-04-07 00:46:16 +00:00
|
|
|
PPOINTL
|
|
|
|
FASTCALL
|
|
|
|
IntptlBrushOrigin(PDC pdc, LONG x, LONG y )
|
|
|
|
{
|
|
|
|
pdc->dclevel.ptlBrushOrigin.x = x;
|
|
|
|
pdc->dclevel.ptlBrushOrigin.y = y;
|
|
|
|
IntCalcFillOrigin(pdc);
|
|
|
|
return &pdc->dclevel.ptlBrushOrigin;
|
|
|
|
}
|
|
|
|
|
2009-03-23 03:43:11 +00:00
|
|
|
VOID
|
|
|
|
APIENTRY
|
|
|
|
GdiSetDCOrg(HDC hDC, LONG Left, LONG Top, PRECTL prc)
|
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
PDC pdc;
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
pdc = DC_LockDc(hDC);
|
|
|
|
if (!pdc) return;
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
pdc->ptlDCOrig.x = Left;
|
|
|
|
pdc->ptlDCOrig.y = Top;
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
IntCalcFillOrigin(pdc);
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
if (prc) pdc->erclWindow = *prc;
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
DC_UnlockDc(pdc);
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
|
|
|
|
2009-03-24 02:58:14 +00:00
|
|
|
// FIXME: remove me
|
2009-03-23 03:43:11 +00:00
|
|
|
BOOL FASTCALL
|
|
|
|
IntGdiGetDCOrg(PDC pDc, PPOINTL ppt)
|
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
*ppt = pDc->ptlDCOrig;
|
|
|
|
return TRUE;
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
|
|
|
|
2009-03-24 02:58:14 +00:00
|
|
|
// FIXME: remove me
|
2009-03-23 03:43:11 +00:00
|
|
|
BOOL APIENTRY
|
|
|
|
GdiGetDCOrgEx(HDC hDC, PPOINTL ppt, PRECTL prc)
|
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
PDC pdc;
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
pdc = DC_LockDc(hDC);
|
|
|
|
if (!pdc) return FALSE;
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
*prc = pdc->erclWindow;
|
|
|
|
*ppt = pdc->ptlDCOrig;
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
DC_UnlockDc(pdc);
|
|
|
|
return TRUE;
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
|
|
|
|
2009-03-24 02:58:14 +00:00
|
|
|
static
|
|
|
|
VOID FASTCALL
|
|
|
|
DC_vGetAspectRatioFilter(PDC pDC, LPSIZE AspectRatio)
|
2009-03-23 03:43:11 +00:00
|
|
|
{
|
2009-03-24 02:58:14 +00:00
|
|
|
if (pDC->pdcattr->flFontMapper & 1) // TRUE assume 1.
|
2009-03-23 17:47:58 +00:00
|
|
|
{
|
|
|
|
// "This specifies that Windows should only match fonts that have the
|
|
|
|
// same aspect ratio as the display.", Programming Windows, Fifth Ed.
|
2009-08-16 12:57:41 +00:00
|
|
|
AspectRatio->cx = pDC->ppdev->gdiinfo.ulLogPixelsX;
|
|
|
|
AspectRatio->cy = pDC->ppdev->gdiinfo.ulLogPixelsY;
|
2009-03-23 17:47:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
AspectRatio->cx = 0;
|
|
|
|
AspectRatio->cy = 0;
|
|
|
|
}
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
2009-03-24 02:58:14 +00:00
|
|
|
DC_vUpdateViewportExt(PDC pdc)
|
2009-03-23 03:43:11 +00:00
|
|
|
{
|
|
|
|
PDC_ATTR pdcattr;
|
|
|
|
|
|
|
|
/* Get a pointer to the dc attribute */
|
|
|
|
pdcattr = pdc->pdcattr;
|
|
|
|
|
|
|
|
/* Check if we need to recalculate */
|
|
|
|
if (pdcattr->flXform & PAGE_EXTENTS_CHANGED)
|
|
|
|
{
|
|
|
|
/* Check if we need to do isotropic fixup */
|
|
|
|
if (pdcattr->iMapMode == MM_ISOTROPIC)
|
|
|
|
{
|
|
|
|
IntFixIsotropicMapping(pdc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Update xforms, CHECKME: really done here? */
|
|
|
|
DC_UpdateXforms(pdc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL APIENTRY
|
2009-03-23 17:47:58 +00:00
|
|
|
NtGdiGetDCPoint(
|
|
|
|
HDC hDC,
|
|
|
|
UINT iPoint,
|
|
|
|
PPOINTL Point)
|
2009-03-23 03:43:11 +00:00
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
BOOL Ret = TRUE;
|
2009-03-24 02:58:14 +00:00
|
|
|
DC *pdc;
|
2009-03-23 17:47:58 +00:00
|
|
|
POINTL SafePoint;
|
|
|
|
SIZE Size;
|
|
|
|
NTSTATUS Status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
if (!Point)
|
2009-03-23 03:43:11 +00:00
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
2009-03-23 17:47:58 +00:00
|
|
|
|
2009-03-24 02:58:14 +00:00
|
|
|
pdc = DC_LockDc(hDC);
|
|
|
|
if (!pdc)
|
2009-03-23 03:43:11 +00:00
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
switch (iPoint)
|
|
|
|
{
|
|
|
|
case GdiGetViewPortExt:
|
2009-03-24 02:58:14 +00:00
|
|
|
DC_vUpdateViewportExt(pdc);
|
|
|
|
SafePoint.x = pdc->pdcattr->szlViewportExt.cx;
|
|
|
|
SafePoint.y = pdc->pdcattr->szlViewportExt.cy;
|
2009-03-23 17:47:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GdiGetWindowExt:
|
2009-03-24 02:58:14 +00:00
|
|
|
SafePoint.x = pdc->pdcattr->szlWindowExt.cx;
|
|
|
|
SafePoint.y = pdc->pdcattr->szlWindowExt.cy;
|
2009-03-23 17:47:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GdiGetViewPortOrg:
|
2009-03-24 02:58:14 +00:00
|
|
|
SafePoint = pdc->pdcattr->ptlViewportOrg;
|
2009-03-23 17:47:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GdiGetWindowOrg:
|
2009-03-24 02:58:14 +00:00
|
|
|
SafePoint = pdc->pdcattr->ptlWindowOrg;
|
2009-03-23 17:47:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GdiGetDCOrg:
|
2009-03-24 02:58:14 +00:00
|
|
|
SafePoint = pdc->ptlDCOrig;
|
2009-03-23 17:47:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GdiGetAspectRatioFilter:
|
2009-03-24 02:58:14 +00:00
|
|
|
DC_vGetAspectRatioFilter(pdc, &Size);
|
2009-03-23 17:47:58 +00:00
|
|
|
SafePoint.x = Size.cx;
|
|
|
|
SafePoint.y = Size.cy;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
Ret = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2009-03-23 03:43:11 +00:00
|
|
|
|
2009-03-23 17:47:58 +00:00
|
|
|
if (Ret)
|
|
|
|
{
|
|
|
|
_SEH2_TRY
|
|
|
|
{
|
2009-03-24 02:58:14 +00:00
|
|
|
ProbeForWrite(Point, sizeof(POINT), 1);
|
2009-03-23 17:47:58 +00:00
|
|
|
*Point = SafePoint;
|
|
|
|
}
|
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
|
|
|
|
2009-03-24 02:58:14 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
Ret = FALSE;
|
|
|
|
}
|
2009-03-23 17:47:58 +00:00
|
|
|
}
|
|
|
|
|
2009-03-24 02:58:14 +00:00
|
|
|
DC_UnlockDc(pdc);
|
2009-03-23 17:47:58 +00:00
|
|
|
return Ret;
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
APIENTRY
|
|
|
|
NtGdiGetBoundsRect(
|
|
|
|
IN HDC hdc,
|
|
|
|
OUT LPRECT prc,
|
|
|
|
IN DWORD f)
|
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
DPRINT1("stub\n");
|
|
|
|
return DCB_RESET; /* bounding rectangle always empty */
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
APIENTRY
|
|
|
|
NtGdiSetBoundsRect(
|
|
|
|
IN HDC hdc,
|
|
|
|
IN LPRECT prc,
|
|
|
|
IN DWORD f)
|
|
|
|
{
|
2009-03-23 17:47:58 +00:00
|
|
|
DPRINT1("stub\n");
|
|
|
|
return DCB_DISABLE; /* bounding rectangle always empty */
|
2009-03-23 03:43:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|