Implemented DC coordinate functions.

Patch by Mike Nordell.

svn path=/trunk/; revision=5219
This commit is contained in:
Eric Kohl 2003-07-22 20:02:08 +00:00
parent add211f2ff
commit c1efb7ad67

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: coord.c,v 1.12 2003/05/27 07:23:05 gvg Exp $ /* $Id: coord.c,v 1.13 2003/07/22 20:02:08 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -250,7 +250,7 @@ W32kModifyWorldTransform(HDC hDC,
break; break;
default: default:
DC_ReleasePtr( hDC ); DC_ReleasePtr( hDC );
return FALSE; return FALSE;
} }
DC_UpdateXforms (dc); DC_UpdateXforms (dc);
@ -265,10 +265,11 @@ W32kOffsetViewportOrgEx(HDC hDC,
int YOffset, int YOffset,
LPPOINT UnsafePoint) LPPOINT UnsafePoint)
{ {
DC *dc = DC_HandleToPtr(hDC); PDC dc;
POINT Point; POINT Point;
NTSTATUS Status; NTSTATUS Status;
dc = DC_HandleToPtr(hDC);
if (NULL == dc) if (NULL == dc)
{ {
return FALSE; return FALSE;
@ -299,11 +300,30 @@ W32kOffsetViewportOrgEx(HDC hDC,
BOOL BOOL
STDCALL STDCALL
W32kOffsetWindowOrgEx(HDC hDC, W32kOffsetWindowOrgEx(HDC hDC,
int XOffset, int XOffset,
int YOffset, int YOffset,
LPPOINT Point) LPPOINT Point)
{ {
UNIMPLEMENTED; PDC dc;
dc = DC_HandleToPtr(hDC);
if (!dc)
{
return FALSE;
}
if (Point)
{
Point->x = dc->wndOrgX;
Point->y = dc->wndOrgY;
}
dc->wndOrgX += XOffset;
dc->wndOrgY += YOffset;
DC_ReleasePtr(hDC);
return TRUE;
} }
BOOL BOOL
@ -333,10 +353,10 @@ W32kScaleWindowExtEx(HDC hDC,
int int
STDCALL STDCALL
W32kSetGraphicsMode(HDC hDC, W32kSetGraphicsMode(HDC hDC,
int Mode) int Mode)
{ {
INT ret; INT ret;
DC *dc; PDC dc;
dc = DC_HandleToPtr (hDC); dc = DC_HandleToPtr (hDC);
if (!dc) if (!dc)
@ -351,10 +371,11 @@ W32kSetGraphicsMode(HDC hDC,
*/ */
if ((Mode != GM_COMPATIBLE) && (Mode != GM_ADVANCED)) if ((Mode != GM_COMPATIBLE) && (Mode != GM_ADVANCED))
{ {
DC_ReleasePtr( hDC ); DC_ReleasePtr( hDC );
return 0; return 0;
} }
ret = dc->w.GraphicsMode; ret = dc->w.GraphicsMode;
dc->w.GraphicsMode = Mode; dc->w.GraphicsMode = Mode;
DC_ReleasePtr( hDC ); DC_ReleasePtr( hDC );
@ -364,55 +385,172 @@ W32kSetGraphicsMode(HDC hDC,
int int
STDCALL STDCALL
W32kSetMapMode(HDC hDC, W32kSetMapMode(HDC hDC,
int MapMode) int MapMode)
{ {
UNIMPLEMENTED; int PrevMapMode;
PDC dc;
dc = DC_HandleToPtr(hDC);
if (!dc)
{
return FALSE;
}
PrevMapMode = dc->w.MapMode;
dc->w.MapMode = MapMode;
return PrevMapMode;
} }
BOOL BOOL
STDCALL STDCALL
W32kSetViewportExtEx(HDC hDC, W32kSetViewportExtEx(HDC hDC,
int XExtent, int XExtent,
int YExtent, int YExtent,
LPSIZE Size) LPSIZE Size)
{ {
UNIMPLEMENTED; PDC dc;
dc = DC_HandleToPtr(hDC);
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:
DC_ReleasePtr(hDC);
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;
DC_ReleasePtr(hDC);
return TRUE;
} }
BOOL BOOL
STDCALL STDCALL
W32kSetViewportOrgEx(HDC hDC, W32kSetViewportOrgEx(HDC hDC,
int X, int X,
int Y, int Y,
LPPOINT Point) LPPOINT Point)
{ {
UNIMPLEMENTED; PDC dc;
dc = DC_HandleToPtr(hDC);
if (!dc)
{
return FALSE;
}
if (Point)
{
Point->x = dc->vportOrgX;
Point->y = dc->vportOrgY;
}
dc->vportOrgX = X;
dc->vportOrgY = Y;
DC_ReleasePtr(hDC);
return TRUE;
} }
BOOL BOOL
STDCALL STDCALL
W32kSetWindowExtEx(HDC hDC, W32kSetWindowExtEx(HDC hDC,
int XExtent, int XExtent,
int YExtent, int YExtent,
LPSIZE Size) LPSIZE Size)
{ {
UNIMPLEMENTED; PDC dc;
dc = DC_HandleToPtr(hDC);
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:
DC_ReleasePtr(hDC);
return FALSE;
}
if (Size)
{
Size->cx = dc->wndExtX;
Size->cy = dc->wndExtY;
}
dc->wndExtX = XExtent;
dc->wndExtY = YExtent;
DC_ReleasePtr(hDC);
return TRUE;
} }
BOOL BOOL
STDCALL STDCALL
W32kSetWindowOrgEx(HDC hDC, W32kSetWindowOrgEx(HDC hDC,
int X, int X,
int Y, int Y,
LPPOINT Point) LPPOINT Point)
{ {
UNIMPLEMENTED; PDC dc;
dc = DC_HandleToPtr(hDC);
if (!dc)
{
return FALSE;
}
if (Point)
{
Point->x = dc->wndOrgX;
Point->y = dc->wndOrgY;
}
dc->wndOrgX = X;
dc->wndOrgY = Y;
DC_ReleasePtr(hDC);
return TRUE;
} }
BOOL BOOL
STDCALL STDCALL
W32kSetWorldTransform(HDC hDC, W32kSetWorldTransform(HDC hDC,
CONST LPXFORM XForm) CONST LPXFORM XForm)
{ {
PDC dc; PDC dc;
@ -423,14 +561,14 @@ W32kSetWorldTransform(HDC hDC,
} }
if (!XForm) if (!XForm)
{ {
DC_ReleasePtr( hDC ); DC_ReleasePtr( hDC );
return FALSE; return FALSE;
} }
/* Check that graphics mode is GM_ADVANCED */ /* Check that graphics mode is GM_ADVANCED */
if (dc->w.GraphicsMode != GM_ADVANCED) if (dc->w.GraphicsMode != GM_ADVANCED)
{ {
DC_ReleasePtr( hDC ); DC_ReleasePtr( hDC );
return FALSE; return FALSE;
} }
dc->w.xformWorld2Wnd = *XForm; dc->w.xformWorld2Wnd = *XForm;