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.
|
|
|
|
*
|
|
|
|
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2003-12-21 18:38:37 +00:00
|
|
|
/* $Id: coord.c,v 1.20 2003/12/21 18:38:37 navaraf Exp $
|
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 ******************************************************************/
|
1999-07-22 16:21:53 +00:00
|
|
|
|
|
|
|
#include <windows.h>
|
1999-10-28 23:37:14 +00:00
|
|
|
#include <ddk/ntddk.h>
|
2003-03-18 08:34:37 +00:00
|
|
|
#include <internal/safe.h>
|
1999-07-22 16:21:53 +00:00
|
|
|
#include <win32k/coord.h>
|
1999-10-28 23:37:14 +00:00
|
|
|
#include <win32k/dc.h>
|
2003-05-27 07:23:05 +00:00
|
|
|
#include <include/error.h>
|
2003-03-18 08:34:37 +00:00
|
|
|
#define NDEBUG
|
2000-06-29 23:35:53 +00:00
|
|
|
#include <win32k/debug1.h>
|
1999-07-22 16:21:53 +00:00
|
|
|
|
2002-07-04 19:56:38 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2003-08-19 11:48:50 +00:00
|
|
|
BOOL STDCALL NtGdiCombineTransform(LPXFORM UnsafeXFormResult,
|
2003-03-14 22:48:32 +00:00
|
|
|
CONST LPXFORM Unsafexform1,
|
|
|
|
CONST LPXFORM Unsafexform2)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
1999-10-28 23:37:14 +00:00
|
|
|
XFORM xformTemp;
|
2003-03-14 22:48:32 +00:00
|
|
|
XFORM xform1, xform2;
|
2002-07-13 21:37:27 +00:00
|
|
|
|
1999-10-28 23:37:14 +00:00
|
|
|
/* Check for illegal parameters */
|
2003-03-14 22:48:32 +00:00
|
|
|
if (!UnsafeXFormResult || !Unsafexform1 || !Unsafexform2)
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-03-14 22:48:32 +00:00
|
|
|
|
|
|
|
MmCopyFromCaller( &xform1, Unsafexform1, sizeof(XFORM) );
|
|
|
|
MmCopyFromCaller( &xform2, Unsafexform2, sizeof(XFORM) );
|
|
|
|
|
1999-10-28 23:37:14 +00:00
|
|
|
/* Create the result in a temporary XFORM, since xformResult may be
|
|
|
|
* equal to xform1 or xform2 */
|
2003-03-14 22:48:32 +00:00
|
|
|
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;
|
1999-10-28 23:37:14 +00:00
|
|
|
|
|
|
|
/* Copy the result to xformResult */
|
2003-03-14 22:48:32 +00:00
|
|
|
MmCopyToCaller( UnsafeXFormResult, &xformTemp, sizeof(XFORM) );
|
1999-10-28 23:37:14 +00:00
|
|
|
|
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2003-12-21 18:38:37 +00:00
|
|
|
VOID FASTCALL
|
2002-07-04 19:56:38 +00:00
|
|
|
CoordDPtoLP(PDC Dc, LPPOINT Point)
|
2002-07-13 21:37:27 +00:00
|
|
|
{
|
2002-07-04 19:56:38 +00:00
|
|
|
FLOAT x, y;
|
|
|
|
x = (FLOAT)Point->x;
|
|
|
|
y = (FLOAT)Point->y;
|
|
|
|
Point->x = x * Dc->w.xformVport2World.eM11 +
|
|
|
|
y * Dc->w.xformVport2World.eM21 + Dc->w.xformVport2World.eDx;
|
|
|
|
Point->y = x * Dc->w.xformVport2World.eM12 +
|
2002-07-13 21:37:27 +00:00
|
|
|
y * Dc->w.xformVport2World.eM22 + Dc->w.xformVport2World.eDy;
|
2002-07-04 19:56:38 +00:00
|
|
|
}
|
|
|
|
|
2003-12-21 18:38:37 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
IntDPtoLP ( PDC dc, LPPOINT Points, INT Count )
|
|
|
|
{
|
|
|
|
INT i;
|
|
|
|
|
|
|
|
ASSERT ( Points );
|
|
|
|
|
|
|
|
for ( i = 0; i < Count; i++ )
|
|
|
|
CoordDPtoLP ( dc, &Points[i] );
|
|
|
|
}
|
|
|
|
|
2003-03-14 22:48:32 +00:00
|
|
|
/*!
|
|
|
|
* Converts points from device coordinates into logical 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.
|
|
|
|
*/
|
2002-07-13 21:37:27 +00:00
|
|
|
BOOL STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiDPtoLP(HDC hDC,
|
2003-03-14 22:48:32 +00:00
|
|
|
LPPOINT UnsafePoints,
|
2002-07-04 19:56:38 +00:00
|
|
|
int Count)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2003-12-21 18:38:37 +00:00
|
|
|
PDC dc;
|
|
|
|
LPPOINT Points = (LPPOINT)ExAllocatePool(PagedPool, Count * sizeof(POINT));
|
|
|
|
BOOL ret = FALSE; // default to failure
|
|
|
|
|
|
|
|
if (!Points)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
dc = DC_LockDc(hDC);
|
|
|
|
if (dc)
|
|
|
|
{
|
|
|
|
ret = TRUE;
|
|
|
|
MmCopyFromCaller(Points, UnsafePoints, Count * sizeof(POINT));
|
|
|
|
IntDPtoLP(dc, Points, Count);
|
|
|
|
MmCopyToCaller(UnsafePoints, Points, Count * sizeof(POINT));
|
|
|
|
DC_UnlockDc(hDC);
|
|
|
|
}
|
|
|
|
ExFreePool(Points);
|
|
|
|
|
|
|
|
return ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2003-08-17 17:32:58 +00:00
|
|
|
int
|
|
|
|
FASTCALL
|
|
|
|
IntGetGraphicsMode ( PDC dc )
|
|
|
|
{
|
|
|
|
ASSERT ( dc );
|
|
|
|
return dc->w.GraphicsMode;
|
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
int
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiGetGraphicsMode ( HDC hDC )
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2003-08-20 07:45:02 +00:00
|
|
|
PDC dc = DC_LockDc ( hDC );
|
2003-08-17 17:32:58 +00:00
|
|
|
int GraphicsMode = 0; // default to failure
|
2002-07-13 21:37:27 +00:00
|
|
|
|
2003-08-17 17:32:58 +00:00
|
|
|
if ( dc )
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
2003-08-17 17:32:58 +00:00
|
|
|
GraphicsMode = dc->w.GraphicsMode;
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc ( hDC );
|
2001-03-31 15:35:08 +00:00
|
|
|
}
|
2002-07-13 21:37:27 +00:00
|
|
|
|
2003-08-17 17:32:58 +00:00
|
|
|
return GraphicsMode;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiGetWorldTransform(HDC hDC,
|
1999-10-28 23:37:14 +00:00
|
|
|
LPXFORM XForm)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
1999-10-28 23:37:14 +00:00
|
|
|
PDC dc;
|
2002-07-13 21:37:27 +00:00
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
if (!XForm)
|
|
|
|
return FALSE;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
dc = DC_LockDc (hDC);
|
1999-10-28 23:37:14 +00:00
|
|
|
if (!dc)
|
2003-08-20 22:07:36 +00:00
|
|
|
return FALSE;
|
|
|
|
|
1999-10-28 23:37:14 +00:00
|
|
|
*XForm = dc->w.xformWorld2Wnd;
|
2003-08-20 22:07:36 +00:00
|
|
|
|
|
|
|
DC_UnlockDc ( hDC );
|
|
|
|
|
1999-10-28 23:37:14 +00:00
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2003-08-17 17:32:58 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
CoordLPtoDP ( PDC Dc, LPPOINT Point )
|
2002-07-04 19:56:38 +00:00
|
|
|
{
|
|
|
|
FLOAT x, y;
|
2003-08-20 22:07:36 +00:00
|
|
|
|
|
|
|
ASSERT ( Dc );
|
|
|
|
ASSERT ( Point );
|
|
|
|
|
2002-07-04 19:56:38 +00:00
|
|
|
x = (FLOAT)Point->x;
|
|
|
|
y = (FLOAT)Point->y;
|
|
|
|
Point->x = x * Dc->w.xformWorld2Vport.eM11 +
|
|
|
|
y * Dc->w.xformWorld2Vport.eM21 + Dc->w.xformWorld2Vport.eDx;
|
|
|
|
Point->y = x * Dc->w.xformWorld2Vport.eM12 +
|
|
|
|
y * Dc->w.xformWorld2Vport.eM22 + Dc->w.xformWorld2Vport.eDy;
|
|
|
|
}
|
|
|
|
|
2003-08-17 17:32:58 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
IntLPtoDP ( PDC dc, LPPOINT Points, INT Count )
|
|
|
|
{
|
|
|
|
INT i;
|
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
ASSERT ( Points );
|
|
|
|
|
2003-08-17 17:32:58 +00:00
|
|
|
for ( i = 0; i < Count; i++ )
|
|
|
|
CoordLPtoDP ( dc, &Points[i] );
|
|
|
|
}
|
|
|
|
|
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.
|
|
|
|
*/
|
2002-07-04 19:56:38 +00:00
|
|
|
BOOL STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiLPtoDP ( HDC hDC, LPPOINT UnsafePoints, INT Count )
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2003-08-20 22:07:36 +00:00
|
|
|
PDC dc;
|
|
|
|
LPPOINT Points = (LPPOINT)ExAllocatePool ( PagedPool, Count*sizeof(POINT) );
|
|
|
|
BOOL ret = FALSE; // default to failure
|
2003-08-17 17:32:58 +00:00
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
ASSERT(Points);
|
|
|
|
if ( !Points )
|
2003-08-17 17:32:58 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
dc = DC_LockDc ( hDC );
|
2003-08-17 17:32:58 +00:00
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
if ( dc )
|
|
|
|
{
|
|
|
|
ret = TRUE;
|
2003-03-14 22:48:32 +00:00
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
MmCopyFromCaller( Points, UnsafePoints, Count*sizeof(POINT) );
|
2002-07-13 21:37:27 +00:00
|
|
|
|
2003-09-09 09:39:21 +00:00
|
|
|
IntLPtoDP ( dc, Points, Count );
|
2002-07-13 21:37:27 +00:00
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
MmCopyToCaller ( UnsafePoints, Points, Count*sizeof(POINT) );
|
2003-08-17 17:32:58 +00:00
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
DC_UnlockDc ( hDC );
|
|
|
|
}
|
2003-08-17 17:32:58 +00:00
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
ExFreePool ( Points );
|
2003-08-17 17:32:58 +00:00
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
return ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-20 22:07:36 +00:00
|
|
|
NtGdiModifyWorldTransform(HDC hDC,
|
|
|
|
CONST LPXFORM UnsafeXForm,
|
|
|
|
DWORD Mode)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
1999-10-28 23:37:14 +00:00
|
|
|
PDC dc;
|
2003-03-14 22:48:32 +00:00
|
|
|
LPXFORM XForm = (LPXFORM) ExAllocatePool( PagedPool, sizeof( XFORM ) );
|
2003-08-20 22:07:36 +00:00
|
|
|
BOOL ret = FALSE; // default to failure
|
2003-03-14 22:48:32 +00:00
|
|
|
|
|
|
|
ASSERT( XForm );
|
2003-08-20 22:07:36 +00:00
|
|
|
if (!XForm)
|
|
|
|
return FALSE;
|
2003-03-14 22:48:32 +00:00
|
|
|
|
|
|
|
MmCopyFromCaller( XForm, UnsafeXForm, sizeof( XFORM ) );
|
2002-07-13 21:37:27 +00:00
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
dc = DC_LockDc (hDC);
|
2003-08-20 22:07:36 +00:00
|
|
|
if ( dc )
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
2003-08-20 22:07:36 +00:00
|
|
|
/* Check that graphics mode is GM_ADVANCED */
|
|
|
|
if ( dc->w.GraphicsMode == GM_ADVANCED )
|
|
|
|
{
|
|
|
|
ret = TRUE; // switch to a default of success
|
|
|
|
switch (Mode)
|
|
|
|
{
|
|
|
|
case MWT_IDENTITY:
|
|
|
|
dc->w.xformWorld2Wnd.eM11 = 1.0f;
|
|
|
|
dc->w.xformWorld2Wnd.eM12 = 0.0f;
|
|
|
|
dc->w.xformWorld2Wnd.eM21 = 0.0f;
|
|
|
|
dc->w.xformWorld2Wnd.eM22 = 1.0f;
|
|
|
|
dc->w.xformWorld2Wnd.eDx = 0.0f;
|
|
|
|
dc->w.xformWorld2Wnd.eDy = 0.0f;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MWT_LEFTMULTIPLY:
|
|
|
|
NtGdiCombineTransform(&dc->w.xformWorld2Wnd, XForm, &dc->w.xformWorld2Wnd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MWT_RIGHTMULTIPLY:
|
|
|
|
NtGdiCombineTransform(&dc->w.xformWorld2Wnd, &dc->w.xformWorld2Wnd, XForm);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ( ret )
|
|
|
|
DC_UpdateXforms ( dc );
|
|
|
|
}
|
|
|
|
DC_UnlockDc ( hDC );
|
2001-03-31 15:35:08 +00:00
|
|
|
}
|
2003-08-20 22:07:36 +00:00
|
|
|
ExFreePool ( XForm );
|
|
|
|
return ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiOffsetViewportOrgEx(HDC hDC,
|
2003-05-27 07:23:05 +00:00
|
|
|
int XOffset,
|
|
|
|
int YOffset,
|
|
|
|
LPPOINT UnsafePoint)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2003-08-20 22:07:36 +00:00
|
|
|
PDC dc;
|
|
|
|
POINT Point;
|
2003-05-27 07:23:05 +00:00
|
|
|
NTSTATUS Status;
|
2003-08-20 22:07:36 +00:00
|
|
|
BOOL ret = FALSE; // default to failure
|
2003-05-27 07:23:05 +00:00
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
dc = DC_LockDc ( hDC );
|
|
|
|
if ( dc )
|
|
|
|
{
|
|
|
|
ret = TRUE;
|
|
|
|
if (NULL != UnsafePoint)
|
|
|
|
{
|
|
|
|
Point.x = dc->vportOrgX;
|
|
|
|
Point.y = dc->vportOrgY;
|
|
|
|
Status = MmCopyToCaller(UnsafePoint, &Point, sizeof(POINT));
|
|
|
|
if ( !NT_SUCCESS(Status) )
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ret )
|
2003-05-27 07:23:05 +00:00
|
|
|
{
|
2003-08-20 22:07:36 +00:00
|
|
|
dc->vportOrgX += XOffset;
|
|
|
|
dc->vportOrgY += YOffset;
|
|
|
|
DC_UpdateXforms(dc);
|
2003-05-27 07:23:05 +00:00
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
dc->w.DCOrgX += XOffset;
|
|
|
|
dc->w.DCOrgY += YOffset;
|
2003-05-27 07:23:05 +00:00
|
|
|
}
|
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
DC_UnlockDc ( hDC );
|
|
|
|
}
|
2003-05-27 07:23:05 +00:00
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiOffsetWindowOrgEx(HDC hDC,
|
2003-07-22 20:02:08 +00:00
|
|
|
int XOffset,
|
|
|
|
int YOffset,
|
|
|
|
LPPOINT Point)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2003-07-22 20:02:08 +00:00
|
|
|
PDC dc;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
dc = DC_LockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Point)
|
|
|
|
{
|
|
|
|
Point->x = dc->wndOrgX;
|
|
|
|
Point->y = dc->wndOrgY;
|
|
|
|
}
|
|
|
|
|
|
|
|
dc->wndOrgX += XOffset;
|
|
|
|
dc->wndOrgY += YOffset;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiScaleViewportExtEx(HDC hDC,
|
1999-07-22 16:21:53 +00:00
|
|
|
int Xnum,
|
|
|
|
int Xdenom,
|
|
|
|
int Ynum,
|
|
|
|
int Ydenom,
|
|
|
|
LPSIZE Size)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiScaleWindowExtEx(HDC hDC,
|
1999-07-22 16:21:53 +00:00
|
|
|
int Xnum,
|
|
|
|
int Xdenom,
|
|
|
|
int Ynum,
|
|
|
|
int Ydenom,
|
|
|
|
LPSIZE Size)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
int
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiSetGraphicsMode(HDC hDC,
|
2003-07-22 20:02:08 +00:00
|
|
|
int Mode)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
1999-10-28 23:37:14 +00:00
|
|
|
INT ret;
|
2003-07-22 20:02:08 +00:00
|
|
|
PDC dc;
|
2002-07-13 21:37:27 +00:00
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
dc = DC_LockDc (hDC);
|
1999-10-28 23:37:14 +00:00
|
|
|
if (!dc)
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
1999-10-28 23:37:14 +00:00
|
|
|
|
|
|
|
/* One would think that setting the graphics mode to GM_COMPATIBLE
|
|
|
|
* would also reset the world transformation matrix to the unity
|
|
|
|
* matrix. However, in Windows, this is not the case. This doesn't
|
|
|
|
* make a lot of sense to me, but that's the way it is.
|
|
|
|
*/
|
2002-07-13 21:37:27 +00:00
|
|
|
|
|
|
|
if ((Mode != GM_COMPATIBLE) && (Mode != GM_ADVANCED))
|
2003-07-22 20:02:08 +00:00
|
|
|
{
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc( hDC );
|
2003-07-22 20:02:08 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-10-28 23:37:14 +00:00
|
|
|
ret = dc->w.GraphicsMode;
|
|
|
|
dc->w.GraphicsMode = Mode;
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc( hDC );
|
1999-10-28 23:37:14 +00:00
|
|
|
return ret;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
int
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiSetMapMode(HDC hDC,
|
2003-08-20 22:07:36 +00:00
|
|
|
int MapMode)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2003-07-22 20:02:08 +00:00
|
|
|
int PrevMapMode;
|
|
|
|
PDC dc;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
dc = DC_LockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
if (!dc)
|
2003-08-20 22:07:36 +00:00
|
|
|
return 0;
|
2003-07-22 20:02:08 +00:00
|
|
|
|
|
|
|
PrevMapMode = dc->w.MapMode;
|
|
|
|
dc->w.MapMode = MapMode;
|
|
|
|
|
2003-08-20 22:07:36 +00:00
|
|
|
DC_UnlockDc ( hDC );
|
|
|
|
|
2003-07-22 20:02:08 +00:00
|
|
|
return PrevMapMode;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiSetViewportExtEx(HDC hDC,
|
2003-08-20 22:07:36 +00:00
|
|
|
int XExtent,
|
|
|
|
int YExtent,
|
|
|
|
LPSIZE Size)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2003-07-22 20:02:08 +00:00
|
|
|
PDC dc;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
dc = DC_LockDc(hDC);
|
2003-08-20 22:07:36 +00:00
|
|
|
if ( !dc )
|
|
|
|
return FALSE;
|
2003-07-22 20:02:08 +00:00
|
|
|
|
|
|
|
switch (dc->w.MapMode)
|
|
|
|
{
|
|
|
|
case MM_HIENGLISH:
|
|
|
|
case MM_HIMETRIC:
|
|
|
|
case MM_LOENGLISH:
|
|
|
|
case MM_LOMETRIC:
|
|
|
|
case MM_TEXT:
|
|
|
|
case MM_TWIPS:
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
case MM_ISOTROPIC:
|
|
|
|
// Here we should (probably) check that SetWindowExtEx *really* has
|
|
|
|
// been called
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Size)
|
|
|
|
{
|
|
|
|
Size->cx = dc->vportExtX;
|
|
|
|
Size->cy = dc->vportExtY;
|
|
|
|
}
|
|
|
|
|
|
|
|
dc->vportExtX = XExtent;
|
|
|
|
dc->vportExtY = YExtent;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiSetViewportOrgEx(HDC hDC,
|
2003-07-22 20:02:08 +00:00
|
|
|
int X,
|
|
|
|
int Y,
|
|
|
|
LPPOINT Point)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2003-07-22 20:02:08 +00:00
|
|
|
PDC dc;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
dc = DC_LockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Point)
|
|
|
|
{
|
|
|
|
Point->x = dc->vportOrgX;
|
|
|
|
Point->y = dc->vportOrgY;
|
|
|
|
}
|
|
|
|
|
|
|
|
dc->vportOrgX = X;
|
|
|
|
dc->vportOrgY = Y;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiSetWindowExtEx(HDC hDC,
|
2003-07-22 20:02:08 +00:00
|
|
|
int XExtent,
|
|
|
|
int YExtent,
|
|
|
|
LPSIZE Size)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2003-07-22 20:02:08 +00:00
|
|
|
PDC dc;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
dc = DC_LockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (dc->w.MapMode)
|
|
|
|
{
|
|
|
|
case MM_HIENGLISH:
|
|
|
|
case MM_HIMETRIC:
|
|
|
|
case MM_LOENGLISH:
|
|
|
|
case MM_LOMETRIC:
|
|
|
|
case MM_TEXT:
|
|
|
|
case MM_TWIPS:
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Size)
|
|
|
|
{
|
|
|
|
Size->cx = dc->wndExtX;
|
|
|
|
Size->cy = dc->wndExtY;
|
|
|
|
}
|
|
|
|
|
|
|
|
dc->wndExtX = XExtent;
|
|
|
|
dc->wndExtY = YExtent;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiSetWindowOrgEx(HDC hDC,
|
2003-07-22 20:02:08 +00:00
|
|
|
int X,
|
|
|
|
int Y,
|
|
|
|
LPPOINT Point)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
2003-07-22 20:02:08 +00:00
|
|
|
PDC dc;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
dc = DC_LockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
if (!dc)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Point)
|
|
|
|
{
|
|
|
|
Point->x = dc->wndOrgX;
|
|
|
|
Point->y = dc->wndOrgY;
|
|
|
|
}
|
|
|
|
|
|
|
|
dc->wndOrgX = X;
|
|
|
|
dc->wndOrgY = Y;
|
|
|
|
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc(hDC);
|
2003-07-22 20:02:08 +00:00
|
|
|
|
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
|
|
|
STDCALL
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiSetWorldTransform(HDC hDC,
|
2003-07-22 20:02:08 +00:00
|
|
|
CONST LPXFORM XForm)
|
1999-07-22 16:21:53 +00:00
|
|
|
{
|
1999-10-28 23:37:14 +00:00
|
|
|
PDC dc;
|
2002-07-13 21:37:27 +00:00
|
|
|
|
1999-10-28 23:37:14 +00:00
|
|
|
if (!XForm)
|
2003-08-20 22:07:36 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
dc = DC_LockDc (hDC);
|
|
|
|
if ( !dc )
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-07-13 21:37:27 +00:00
|
|
|
|
1999-10-28 23:37:14 +00:00
|
|
|
/* Check that graphics mode is GM_ADVANCED */
|
2003-08-20 22:07:36 +00:00
|
|
|
if ( dc->w.GraphicsMode != GM_ADVANCED )
|
2001-03-31 15:35:08 +00:00
|
|
|
{
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc( hDC );
|
2001-03-31 15:35:08 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
1999-10-28 23:37:14 +00:00
|
|
|
dc->w.xformWorld2Wnd = *XForm;
|
|
|
|
DC_UpdateXforms (dc);
|
2003-08-20 07:45:02 +00:00
|
|
|
DC_UnlockDc( hDC );
|
1999-10-28 23:37:14 +00:00
|
|
|
return TRUE;
|
1999-07-22 16:21:53 +00:00
|
|
|
}
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|