added several new functions

svn path=/trunk/; revision=742
This commit is contained in:
Rex Jolliff 1999-10-28 23:37:14 +00:00
parent 7d45bbd5da
commit f886c2b9d6
18 changed files with 450 additions and 52 deletions

View file

@ -7,12 +7,44 @@
#include <win32k/gdiobj.h>
/* (RJJ) Taken from WINE */
typedef struct _DEVICECAPS
{
WORD version; /* 0: driver version */
WORD technology; /* 2: device technology */
WORD horzSize; /* 4: width of display in mm */
WORD vertSize; /* 6: height of display in mm */
WORD horzRes; /* 8: width of display in pixels */
WORD vertRes; /* 10: width of display in pixels */
WORD bitsPixel; /* 12: bits per pixel */
WORD planes; /* 14: color planes */
WORD numBrushes; /* 16: device-specific brushes */
WORD numPens; /* 18: device-specific pens */
WORD numMarkers; /* 20: device-specific markers */
WORD numFonts; /* 22: device-specific fonts */
WORD numColors; /* 24: size of color table */
WORD pdeviceSize; /* 26: size of PDEVICE structure */
WORD curveCaps; /* 28: curve capabilities */
WORD lineCaps; /* 30: line capabilities */
WORD polygonalCaps; /* 32: polygon capabilities */
WORD textCaps; /* 34: text capabilities */
WORD clipCaps; /* 36: clipping capabilities */
WORD rasterCaps; /* 38: raster capabilities */
WORD aspectX; /* 40: relative width of device pixel */
WORD aspectY; /* 42: relative height of device pixel */
WORD aspectXY; /* 44: relative diagonal width of device pixel */
WORD pad1[21]; /* 46-86: reserved */
WORD logPixelsX; /* 88: pixels / logical X inch */
WORD logPixelsY; /* 90: pixels / logical Y inch */
WORD pad2[6]; /* 92-102: reserved */
WORD sizePalette; /* 104: entries in system palette */
WORD numReserved; /* 106: reserved entries */
WORD colorRes; /* 108: color resolution */
} DEVICECAPS, *PDEVICECAPS;
typedef struct _WIN_DC_INFO
{
int flags;
#if 0
const DeviceCaps *devCaps;
#endif
const PDEVICECAPS devCaps;
HRGN hClipRgn; /* Clip region (may be 0) */
@ -68,12 +100,10 @@ typedef struct _WIN_DC_INFO
INT CursPosY;
INT ArcDirection;
#if 0
XFORM xformWorld2Wnd; /* World-to-window transformation */
XFORM xformWorld2Vport; /* World-to-viewport transformation */
XFORM xformVport2World; /* Inverse of the above transformation */
BOOL vport2WorldValid; /* Is xformVport2World valid? */
#endif
XFORM xformWorld2Wnd; /* World-to-window transformation */
XFORM xformWorld2Vport; /* World-to-viewport transformation */
XFORM xformVport2World; /* Inverse of the above transformation */
BOOL vport2WorldValid; /* Is xformVport2World valid? */
} WIN_DC_INFO;
/* DC flags */
@ -123,6 +153,8 @@ HDC DC_PtrToHandle(PDC pDC);
PDC DC_HandleToPtr(HDC hDC);
BOOL DC_LockDC(HDC hDC);
BOOL DC_UnlockDC(HDC hDC);
void DC_UpdateXforms(PDC dc);
BOOL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest);
/* User entry points */

View file

@ -1,4 +1,4 @@
/* $Id: driver.c,v 1.3 1999/10/27 05:49:58 rex Exp $
/* $Id: driver.c,v 1.4 1999/10/28 23:37:14 rex Exp $
*
* GDI Driver support routines
* (mostly swiped from Wine)
@ -91,7 +91,8 @@ HANDLE DRIVER_FindMPDriver(LPCWSTR Name)
}
else
{
lName = Name;
lName = ExAllocatePool(NonPagedPool, wcslen(Name) * sizeof(WCHAR));
wcscpy(lName, Name);
}
RtlInitUnicodeString(&DeviceName, lName);

View file

@ -1,9 +1,10 @@
/* $Id: brush.c,v 1.4 1999/07/22 16:21:52 rex Exp $
/* $Id: brush.c,v 1.5 1999/10/28 23:37:14 rex Exp $
*/
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/brush.h>
// #define NDEBUG

View file

@ -2,6 +2,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/cliprgn.h>
// #define NDEBUG

View file

@ -1,6 +1,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/color.h>
// #define NDEBUG

View file

@ -2,16 +2,43 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/coord.h>
#include <win32k/dc.h>
// #define NDEBUG
#include <internal/debug.h>
BOOL W32kCombineTransform(LPXFORM XformResult,
BOOL W32kCombineTransform(LPXFORM XFormResult,
CONST LPXFORM xform1,
CONST LPXFORM xform2)
{
UNIMPLEMENTED;
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;
/* Copy the result to xformResult */
*XFormResult = xformTemp;
return TRUE;
}
BOOL W32kDPtoLP(HDC hDC,
@ -21,15 +48,43 @@ BOOL W32kDPtoLP(HDC hDC,
UNIMPLEMENTED;
}
int W32kGetGraphicsMode(HDC hDC)
int
W32kGetGraphicsMode(HDC hDC)
{
UNIMPLEMENTED;
PDC dc;
int GraphicsMode;
dc = DC_HandleToPtr (hDC);
if (!dc)
{
return 0;
}
GraphicsMode = dc->w.GraphicsMode;
DC_UnlockDC (hDC);
return GraphicsMode;
}
BOOL W32kGetWorldTransform(HDC hDC,
LPXFORM Xform)
BOOL
W32kGetWorldTransform(HDC hDC,
LPXFORM XForm)
{
UNIMPLEMENTED;
PDC dc;
dc = DC_HandleToPtr (hDC);
if (!dc)
{
return FALSE;
}
if (!XForm)
{
return FALSE;
}
*XForm = dc->w.xformWorld2Wnd;
DC_UnlockDC (hDC);
return TRUE;
}
BOOL W32kLPtoDP(HDC hDC,
@ -40,10 +95,57 @@ BOOL W32kLPtoDP(HDC hDC,
}
BOOL W32kModifyWorldTransform(HDC hDC,
CONST LPXFORM Xform,
CONST LPXFORM XForm,
DWORD Mode)
{
UNIMPLEMENTED;
PDC dc;
dc = DC_HandleToPtr (hDC);
if (!dc)
{
// SetLastError( ERROR_INVALID_HANDLE );
return FALSE;
}
if (!XForm)
{
return FALSE;
}
/* Check that graphics mode is GM_ADVANCED */
if (dc->w.GraphicsMode!=GM_ADVANCED)
{
return FALSE;
}
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:
W32kCombineTransform(&dc->w.xformWorld2Wnd,
XForm,
&dc->w.xformWorld2Wnd );
break;
case MWT_RIGHTMULTIPLY:
W32kCombineTransform(&dc->w.xformWorld2Wnd,
&dc->w.xformWorld2Wnd,
XForm);
break;
default:
return FALSE;
}
DC_UpdateXforms (dc);
DC_UnlockDC (hDC);
return TRUE;
}
BOOL W32kOffsetViewportOrgEx(HDC hDC,
@ -85,7 +187,30 @@ BOOL W32kScaleWindowExtEx(HDC hDC,
int W32kSetGraphicsMode(HDC hDC,
int Mode)
{
UNIMPLEMENTED;
INT ret;
DC *dc;
dc = DC_HandleToPtr (hDC);
if (!dc)
{
return 0;
}
/* 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.
*/
if ((Mode != GM_COMPATIBLE) && (Mode != GM_ADVANCED))
{
return 0;
}
ret = dc->w.GraphicsMode;
dc->w.GraphicsMode = Mode;
DC_UnlockDC (hDC);
return ret;
}
int W32kSetMapMode(HDC hDC,
@ -127,9 +252,31 @@ BOOL W32kSetWindowOrgEx(HDC hDC,
}
BOOL W32kSetWorldTransform(HDC hDC,
CONST LPXFORM Xform)
CONST LPXFORM XForm)
{
UNIMPLEMENTED;
PDC dc;
dc = DC_HandleToPtr (hDC);
if (!dc)
{
// SetLastError( ERROR_INVALID_HANDLE );
return FALSE;
}
if (!XForm)
{
return FALSE;
}
/* Check that graphics mode is GM_ADVANCED */
if (dc->w.GraphicsMode != GM_ADVANCED)
{
return FALSE;
}
dc->w.xformWorld2Wnd = *XForm;
DC_UpdateXforms (dc);
DC_UnlockDC (hDC);
return TRUE;
}

View file

@ -6,8 +6,12 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/bitmaps.h>
#include <win32k/coord.h>
#include <win32k/driver.h>
#include <win32k/dc.h>
#include <win32k/print.h>
#include <win32k/region.h>
// #define NDEBUG
#include <internal/debug.h>
@ -264,8 +268,11 @@ BOOL STDCALL W32kDeleteDC(HDC DCHandle)
DCToDelete = DC_HandleToPtr(DCHandle);
/* FIXME: Call driver shutdown/deallocate routines here */
/* FIXME: Verify that is is a valid handle */
DCToDelete->DriverFunctions.DisableSurface(DCToDelete->PDev);
DCToDelete->DriverFunctions.DisablePDev(DCToDelete->PDev);
DC_FreeDC(DCToDelete);
return STATUS_SUCCESS;
@ -308,7 +315,25 @@ DC_GET_VAL_EX( W32kGetCurrentPositionEx, w.CursPosX, w.CursPosY, POINT )
BOOL STDCALL W32kGetDCOrgEx(HDC hDC,
LPPOINT Point)
{
UNIMPLEMENTED;
DC * dc;
if (!Point)
{
return FALSE;
}
dc = DC_HandleToPtr(hDC);
if (dc == NULL)
{
return FALSE;
}
Point->x = Point->y = 0;
Point->x += dc->w.DCOrgX;
Point->y += dc->w.DCOrgY;
DC_UnlockDC (hDC);
return TRUE;
}
HDC W32kGetDCState16(HDC hDC)
@ -412,7 +437,74 @@ HDC W32kGetDCState16(HDC hDC)
INT STDCALL W32kGetDeviceCaps(HDC hDC,
INT Index)
{
UNIMPLEMENTED;
PDC dc;
INT ret;
POINT pt;
dc = DC_HandleToPtr(hDC);
if (dc == NULL)
{
return 0;
}
/* Device capabilities for the printer */
switch (Index)
{
case PHYSICALWIDTH:
if(W32kEscape(hDC, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0)
{
return pt.x;
}
break;
case PHYSICALHEIGHT:
if(W32kEscape(hDC, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0)
{
return pt.y;
}
break;
case PHYSICALOFFSETX:
if(W32kEscape(hDC, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0)
{
return pt.x;
}
break;
case PHYSICALOFFSETY:
if(W32kEscape(hDC, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0)
{
return pt.y;
}
break;
case SCALINGFACTORX:
if(W32kEscape(hDC, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0)
{
return pt.x;
}
break;
case SCALINGFACTORY:
if(W32kEscape(hDC, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0)
{
return pt.y;
}
break;
}
if ((Index < 0) || (Index > sizeof(DEVICECAPS) - sizeof(WORD)))
{
DC_UnlockDC(hDC);
return 0;
}
DPRINT("(%04x,%d): returning %d\n",
hDC, Index, *(WORD *)(((char *)dc->w.devCaps) + Index));
ret = *(WORD *)(((char *)dc->w.devCaps) + Index);
DC_UnlockDC(hDC);
return ret;
}
DC_GET_VAL( INT, W32kGetMapMode, w.MapMode )
@ -700,23 +792,6 @@ static void W32kSetDCState16(HDC hDC, HDC hDCSave)
DC_UnlockDC(hDCSave);
}
COLORREF STDCALL W32kSetTextColor(HDC hDC, COLORREF color)
{
COLORREF oldColor;
PDC dc = DC_HandleToPtr(hDC);
if (!dc)
{
return 0x80000000;
}
oldColor = dc->w.textColor;
dc->w.textColor = color;
DC_UnlockDC(hDC);
return oldColor;
}
// ---------------------------------------------------- Private Interface
PDC DC_AllocDC(LPCWSTR Driver)
@ -776,6 +851,11 @@ HDC DC_PtrToHandle(PDC pDC)
PDC DC_HandleToPtr(HDC hDC)
{
/* FIXME: this should actually return a pointer obtained from the handle */
if (((PDC)hDC)->header.wMagic != GO_DC_MAGIC)
{
return 0;
}
return (PDC) hDC;
}
@ -791,4 +871,57 @@ BOOL DC_UnlockDC(HDC hDC)
return TRUE;
}
void
DC_UpdateXforms(PDC dc)
{
XFORM xformWnd2Vport;
FLOAT scaleX, scaleY;
/* Construct a transformation to do the window-to-viewport conversion */
scaleX = (FLOAT)dc->vportExtX / (FLOAT)dc->wndExtX;
scaleY = (FLOAT)dc->vportExtY / (FLOAT)dc->wndExtY;
xformWnd2Vport.eM11 = scaleX;
xformWnd2Vport.eM12 = 0.0;
xformWnd2Vport.eM21 = 0.0;
xformWnd2Vport.eM22 = scaleY;
xformWnd2Vport.eDx = (FLOAT)dc->vportOrgX -
scaleX * (FLOAT)dc->wndOrgX;
xformWnd2Vport.eDy = (FLOAT)dc->vportOrgY -
scaleY * (FLOAT)dc->wndOrgY;
/* Combine with the world transformation */
W32kCombineTransform(&dc->w.xformWorld2Vport,
&dc->w.xformWorld2Wnd,
&xformWnd2Vport );
/* Create inverse of world-to-viewport transformation */
dc->w.vport2WorldValid = DC_InvertXform(&dc->w.xformWorld2Vport,
&dc->w.xformVport2World);
}
BOOL
DC_InvertXform(const XFORM *xformSrc,
XFORM *xformDest)
{
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;
}

View file

@ -1,6 +1,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/fillshap.h>
// #define NDEBUG

View file

@ -2,6 +2,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/icm.h>
// #define NDEBUG
@ -41,7 +42,8 @@ INT W32kEnumICMProfiles(HDC hDC,
HCOLORSPACE W32kGetColorSpace(HDC hDC)
{
UNIMPLEMENTED;
/* FIXME: Need to to whatever GetColorSpace actually does */
return 0;
}
BOOL W32kGetDeviceGammaRamp(HDC hDC,
@ -79,7 +81,21 @@ BOOL W32kSetDeviceGammaRamp(HDC hDC,
INT W32kSetICMMode(HDC hDC,
INT EnableICM)
{
UNIMPLEMENTED;
/* FIXME: this should be coded someday */
if (EnableICM == ICM_OFF)
{
return ICM_OFF;
}
if (EnableICM == ICM_ON)
{
return 0;
}
if (EnableICM == ICM_QUERY)
{
return ICM_OFF;
}
return 0;
}
BOOL W32kSetICMProfile(HDC hDC,

View file

@ -2,6 +2,8 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/dc.h>
#include <win32k/line.h>
// #define NDEBUG
@ -45,7 +47,19 @@ BOOL W32kArcTo(HDC hDC,
int W32kGetArcDirection(HDC hDC)
{
UNIMPLEMENTED;
PDC dc;
int ret;
dc = DC_HandleToPtr (hDC);
if (!dc)
{
return 0;
}
ret = dc->w.ArcDirection;
DC_UnlockDC (hDC);
return ret;
}
BOOL W32kLineTo(HDC hDC,
@ -110,6 +124,23 @@ BOOL W32kPolyPolyline(HDC hDC,
int W32kSetArcDirection(HDC hDC,
int ArcDirection)
{
UNIMPLEMENTED;
PDC dc;
INT nOldDirection;
dc = DC_HandleToPtr (hDC);
if (!dc)
{
return 0;
}
if (ArcDirection != AD_COUNTERCLOCKWISE && ArcDirection != AD_CLOCKWISE)
{
// SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
nOldDirection = dc->w.ArcDirection;
dc->w.ArcDirection = ArcDirection;
return nOldDirection;
}

View file

@ -2,6 +2,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/metafile.h>
// #define NDEBUG

View file

@ -2,6 +2,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/paint.h>
// #define NDEBUG

View file

@ -2,6 +2,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/brush.h>
// #define NDEBUG

View file

@ -2,6 +2,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/pen.h>
// #define NDEBUG

View file

@ -2,6 +2,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/print.h>
// #define NDEBUG

View file

@ -2,6 +2,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/region.h>
// #define NDEBUG

View file

@ -2,6 +2,8 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/dc.h>
#include <win32k/text.h>
// #define NDEBUG
@ -245,13 +247,38 @@ DWORD W32kSetMapperFlags(HDC hDC,
UINT W32kSetTextAlign(HDC hDC,
UINT Mode)
{
UNIMPLEMENTED;
UINT prevAlign;
DC *dc;
dc = DC_HandleToPtr(hDC);
if (!dc)
{
return 0;
}
prevAlign = dc->w.textAlign;
dc->w.textAlign = Mode;
DC_UnlockDC (hDC);
return prevAlign;
}
COLORREF W32kSetTextColor(HDC hDC,
COLORREF Color)
COLORREF STDCALL
W32kSetTextColor(HDC hDC,
COLORREF color)
{
UNIMPLEMENTED;
COLORREF oldColor;
PDC dc = DC_HandleToPtr(hDC);
if (!dc)
{
return 0x80000000;
}
oldColor = dc->w.textColor;
dc->w.textColor = color;
DC_UnlockDC(hDC);
return oldColor;
}
BOOL W32kSetTextJustification(HDC hDC,

View file

@ -1,6 +1,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/wingl.h>
// #define NDEBUG