mirror of
https://github.com/reactos/reactos.git
synced 2024-10-15 13:45:58 +00:00
some additions to the GDI engine
svn path=/trunk/; revision=554
This commit is contained in:
parent
e0c5a61982
commit
11d31698d5
21
reactos/include/win32k/dc.h
Normal file
21
reactos/include/win32k/dc.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _WIN_DC_INFO
|
||||||
|
{
|
||||||
|
|
||||||
|
} WIN_DC_INFO;
|
||||||
|
typedef struct _DC
|
||||||
|
{
|
||||||
|
DHPDEV PDev;
|
||||||
|
DEVMODEW DMW;
|
||||||
|
HSURF FillPatternSurfaces[HS_DDI_MAX];
|
||||||
|
GDIINFO GDIInfo;
|
||||||
|
DEVINFO DevInfo;
|
||||||
|
HSURF Surface = NULL;
|
||||||
|
|
||||||
|
DRIVER_FUNCTIONS DriverFunctions;
|
||||||
|
HANDLE DeviceDriver;
|
||||||
|
|
||||||
|
WIN_DC_INFO WinDCInfo;
|
||||||
|
} DC, *PDC;
|
||||||
|
|
72
reactos/include/win32k/driver.h
Normal file
72
reactos/include/win32k/driver.h
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
|
||||||
|
|
||||||
|
BOOL (*PGD_ENABLEDRIVER)(ULONG, ULONG, PDRVENABLEDATA);
|
||||||
|
|
||||||
|
typedef struct _DRIVER_FUNCTIONS
|
||||||
|
{
|
||||||
|
PGD_ENABLEDRIVER EnableDriver;
|
||||||
|
PGD_ENABLEPDEV EnablePDev;
|
||||||
|
PGD_COMPLETEPDEV CompletePDev;
|
||||||
|
PGD_DISABLEPDEV DisablePDev;
|
||||||
|
PGD_ENABLESURFACE EnableSurface;
|
||||||
|
PGD_DISABLESURFACE DisableSurface;
|
||||||
|
PGD_ASSERTMODE AssertMode;
|
||||||
|
PGD_RESETPDEV ResetPDev;
|
||||||
|
#if 0
|
||||||
|
PGD_CREATEDEVICEBITMAP,
|
||||||
|
PGD_DELETEDEVICEBITMAP,
|
||||||
|
PGD_REALIZEBRUSH,
|
||||||
|
PGD_DITHERCOLOR,
|
||||||
|
PGD_STROKEPATH,
|
||||||
|
PGD_FILLPATH,
|
||||||
|
PGD_STROKEANDFILLPATH,
|
||||||
|
PGD_PAINT
|
||||||
|
PGD_BITBLT,
|
||||||
|
PGD_COPYBITS,
|
||||||
|
PGD_STRETCHBLT,
|
||||||
|
PGD_SETPALETTE,
|
||||||
|
PGD_TEXTOUT,
|
||||||
|
PGD_ESCAPE,
|
||||||
|
PGD_DRAWESCAPE,
|
||||||
|
PGD_QUERYFONT,
|
||||||
|
PGD_QUERYFONTTREE,
|
||||||
|
PGD_QUERYFONTDATA,
|
||||||
|
PGD_SETPOINTERSHAPE,
|
||||||
|
PGD_MOVEPOINTER,
|
||||||
|
PGD_LINETO,
|
||||||
|
PGD_SENDPAGE,
|
||||||
|
PGD_STARTPAGE,
|
||||||
|
PGD_ENDDOC,
|
||||||
|
PGD_STARTDOC,
|
||||||
|
PGD_GETGLYPHMODE,
|
||||||
|
PGD_SYNCHRONIZE,
|
||||||
|
PGD_SAVESCREENBITS,
|
||||||
|
PGD_GETMODES,
|
||||||
|
PGD_FREE,
|
||||||
|
PGD_DESTROYFONT,
|
||||||
|
PGD_QUERYFONTCAPS,
|
||||||
|
PGD_LOADFONTFILE,
|
||||||
|
PGD_UNLOADFONTFILE,
|
||||||
|
PGD_FONTMANAGEMENT,
|
||||||
|
PGD_QUERYTRUETYPETABLE,
|
||||||
|
PGD_QUERYTRUETYPEOUTLINE,
|
||||||
|
PGD_GETTRUETYPEFILE,
|
||||||
|
PGD_QUERYFONTFILE,
|
||||||
|
PGD_QUERYADVANCEWIDTHS,
|
||||||
|
PGD_SETPIXELFORMAT,
|
||||||
|
PGD_DESCRIBEPIXELFORMAT,
|
||||||
|
PGD_SWAPBUFFERS,
|
||||||
|
PGD_STARTBANDING,
|
||||||
|
PGD_NEXTBAND,
|
||||||
|
PGD_GETDIRECTDRAWINFO,
|
||||||
|
PGD_ENABLEDIRECTDRAW,
|
||||||
|
PGD_DISABLEDIRECTDRAW,
|
||||||
|
PGD_QUERYSPOOLTYPE,
|
||||||
|
#endif
|
||||||
|
} DRIVER_FUNCTIONS, *PDRIVER_FUNCTIONS;
|
||||||
|
|
||||||
|
BOOL DRIVER_RegisterDriver(PWSTR Name, GD_ENABLEDRIVER EnableDriver);
|
||||||
|
PDRIVER_FUNCTIONS DRIVER_FindDriver(PWSTR Name);
|
||||||
|
BOOL DRIVER_BuildFunctions(PWSTR Name, PDRVENABLEDATA DED);
|
||||||
|
BOOL DRIVER_UnregisterDriver(PWSTR Name);
|
||||||
|
|
|
@ -6,23 +6,12 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <win32k/dc.h>
|
#include <win32k/dc.h>
|
||||||
|
#include <win32k/driver.h>
|
||||||
|
|
||||||
// --------------------------------------------------------- File Statics
|
// --------------------------------------------------------- File Statics
|
||||||
|
|
||||||
/* FIXME: these should probably be placed in an object in the future */
|
/* FIXME: these should probably be placed in an object in the future */
|
||||||
HANDLE gDriverHandle = NULL;
|
DC gSurfaceDC;
|
||||||
DRVENABLEDATA gDED;
|
|
||||||
typedef struct _DC
|
|
||||||
{
|
|
||||||
DHPDEV PDev;
|
|
||||||
DEVMODEW DMW;
|
|
||||||
HSURF FillPatternSurfaces[HS_DDI_MAX];
|
|
||||||
GDIINFO GDIInfo;
|
|
||||||
DEVINFO DevInfo;
|
|
||||||
HSURF Surface = NULL;
|
|
||||||
} DC, *PDC;
|
|
||||||
|
|
||||||
DC gSurfaceDC;
|
|
||||||
|
|
||||||
// ----------------------------------------------------- Public Functions
|
// ----------------------------------------------------- Public Functions
|
||||||
|
|
||||||
|
@ -37,89 +26,92 @@ NTSTATUS W32kCreateDC(HDC *DC,
|
||||||
CONST PDEVMODE InitData)
|
CONST PDEVMODE InitData)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
PGD_ENABLEDRIVER GDEnableDriver;
|
||||||
UNICODE_STRING DeviceName, ErrorMsg;
|
UNICODE_STRING DeviceName, ErrorMsg;
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
|
||||||
/* Is this a request for a printer DC? */
|
/* Get the DDI driver's entry point */
|
||||||
if (wcsicmp(Driver, L"DISPLAY"))
|
if ((GDEnableDriver = DRIVER_FindDriver(Driver)) == NULL)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize driver pair here on first call for display DC. */
|
/* FIXME: left off here... */
|
||||||
if (gDriverHandle == NULL)
|
/* FIXME: allocate a DC object */
|
||||||
|
/* FIXME: recode the rest of the function to use the allocated DC */
|
||||||
|
|
||||||
|
/* FIXME: should get the device name from the DRIVER funcs */
|
||||||
|
RtlInitUnicodeString(&DeviceName, L"\\Device\\DISPLAY");
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&DeviceName,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
Status = ZwOpenFile(&NewDC->DeviceDriver,
|
||||||
|
FILE_ALL_ACCESS,
|
||||||
|
&ObjectAttributes,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
FILE_SYNCHRONOUS_IO_ALERT);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* FIXME: should get the device name from the registry */
|
DbgPrint("Failed to open display device\n");
|
||||||
RtlInitUnicodeString(&DeviceName, L"\\Device\\DISPLAY");
|
DbgGetErrorText(Status, &ErrorMsg, 0xf);
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
DbgPrint("%W\n", &ErrorMsg);
|
||||||
&DeviceName,
|
RtlFreeUnicodeString(&ErrorMsg);
|
||||||
0,
|
|
||||||
NULL,
|
return Status;
|
||||||
NULL);
|
}
|
||||||
Status = ZwOpenFile(&gDriverHandle,
|
|
||||||
FILE_ALL_ACCESS,
|
|
||||||
&ObjectAttributes,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
FILE_SYNCHRONOUS_IO_ALERT);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DbgPrint("Failed to open display device\n");
|
|
||||||
DbgGetErrorText(Status, &ErrorMsg, 0xf);
|
|
||||||
DbgPrint("%W\n", &ErrorMsg);
|
|
||||||
RtlFreeUnicodeString(&ErrorMsg);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Call DrvEnableDriver */
|
/* Call DrvEnableDriver */
|
||||||
RtlZeroMemory(&gDED, sizeof(gDED));
|
/* FIXME: we should only call this once, so the data should be stored in
|
||||||
if (!DrvEnableDriver(DDI_DRIVER_VERSION, sizeof(gDED), &gDED))
|
* DRIVER funcs */
|
||||||
{
|
RtlZeroMemory(&gDED, sizeof(gDED));
|
||||||
DbgPrint("DrvEnableDriver failed\n");
|
if (!GDEnableDriver(DDI_DRIVER_VERSION, sizeof(gDED), &gDED))
|
||||||
|
{
|
||||||
return STATUS_UNSUCCESSFUL;
|
DbgPrint("DrvEnableDriver failed\n");
|
||||||
}
|
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a phyical device handle from the driver */
|
/* Allocate a phyical device handle from the driver */
|
||||||
if (gSurfaceDC.PDev == NULL)
|
/* FIXME: get mode selection information from somewhere */
|
||||||
|
if (Device != NULL)
|
||||||
{
|
{
|
||||||
RtlZeroMemory(&gSurfaceDC, sizeof(gSurfaceDC));
|
wcsncpy(gDMW.dmDeviceName, Device, DMMAXDEVICENAME);
|
||||||
/* FIXME: get mode selection information from somewhere */
|
|
||||||
if (Device != NULL)
|
|
||||||
{
|
|
||||||
wcsncpy(gDMW.dmDeviceName, Device, DMMAXDEVICENAME);
|
|
||||||
}
|
|
||||||
gSurfaceDC.DMW.dmSize = sizeof(gSurfaceDC.DMW);
|
|
||||||
gSurfaceDC.DMW.dmFields = 0x000fc000;
|
|
||||||
gSurfaceDC.DMW.dmLogPixels = 96;
|
|
||||||
gSurfaceDC.DMW.BitsPerPel = 8;
|
|
||||||
gSurfaceDC.DMW.dmPelsWidth = 640;
|
|
||||||
gSurfaceDC.DMW.dmPelsHeight = 480;
|
|
||||||
gSurfaceDC.DMW.dmDisplayFlags = 0;
|
|
||||||
gSurfaceDC.DMW.dmDisplayFrequency = 0;
|
|
||||||
gSurfaceDC.PDev = DrvEnablePDEV(&gSurfaceDC.DMW,
|
|
||||||
L"",
|
|
||||||
HS_DDI_MAX,
|
|
||||||
gSurfaceDC.FillPatternSurfaces,
|
|
||||||
sizeof(gSurfaceDC.GDIInfo),
|
|
||||||
&gSurfaceDC.GDIInfo,
|
|
||||||
sizeof(gSurfaceDC.DevInfo),
|
|
||||||
&gSurfaceDC.DevInfo,
|
|
||||||
NULL,
|
|
||||||
L"",
|
|
||||||
gDriverHandle);
|
|
||||||
if (gSurfaceDC.PDev == NULL)
|
|
||||||
{
|
|
||||||
DbgPrint("DrvEnablePDEV failed\n");
|
|
||||||
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
DrvCompletePDEV(gSurfaceDC.PDev, gSurfaceDC);
|
|
||||||
gSurfaceDC.Surface = DrvEnableSurface(gSurfaceDC.PDev);
|
|
||||||
}
|
}
|
||||||
*DC = &SurfaceDC;
|
gSurfaceDC.DMW.dmSize = sizeof(gSurfaceDC.DMW);
|
||||||
|
gSurfaceDC.DMW.dmFields = 0x000fc000;
|
||||||
|
gSurfaceDC.DMW.dmLogPixels = 96;
|
||||||
|
gSurfaceDC.DMW.BitsPerPel = 8;
|
||||||
|
gSurfaceDC.DMW.dmPelsWidth = 640;
|
||||||
|
gSurfaceDC.DMW.dmPelsHeight = 480;
|
||||||
|
gSurfaceDC.DMW.dmDisplayFlags = 0;
|
||||||
|
gSurfaceDC.DMW.dmDisplayFrequency = 0;
|
||||||
|
/* FIXME: get the function pointer from the DED struct */
|
||||||
|
gSurfaceDC.PDev = GDEnablePDEV(&NewDC->DMW,
|
||||||
|
L"",
|
||||||
|
HS_DDI_MAX,
|
||||||
|
NewDC->FillPatternSurfaces,
|
||||||
|
sizeof(NewDC->GDIInfo),
|
||||||
|
&NewDC->GDIInfo,
|
||||||
|
sizeof(NewDC->DevInfo),
|
||||||
|
&NewDC->DevInfo,
|
||||||
|
NULL,
|
||||||
|
L"",
|
||||||
|
NewDC->DeviceDriver);
|
||||||
|
if (NewDC->PDev == NULL)
|
||||||
|
{
|
||||||
|
DbgPrint("DrvEnablePDEV failed\n");
|
||||||
|
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
/* FIXME: get func pointer from DED */
|
||||||
|
GDCompletePDEV(NewDC->PDev, NewDC);
|
||||||
|
|
||||||
|
/* FIXME: get func pointer from DED */
|
||||||
|
NewDC->Surface = GDEnableSurface(NewDC->PDev);
|
||||||
|
*DC = NewDC;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
110
reactos/subsys/win32k/misc/driver.c
Normal file
110
reactos/subsys/win32k/misc/driver.c
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
/* $Id: driver.c,v 1.1 1999/06/15 02:26:43 rex Exp $
|
||||||
|
*
|
||||||
|
* GDI Driver support routines
|
||||||
|
* (mostly swiped from Wine)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <win32k/driver.h>
|
||||||
|
|
||||||
|
typedef struct _GRAPHICS_DRIVER
|
||||||
|
{
|
||||||
|
PWSTR Name;
|
||||||
|
PGD_ENABLEDRIVER EnableDriver;
|
||||||
|
struct _GRAPHICS_DRIVER *Next;
|
||||||
|
} GRAPHICS_DRIVER, *PGRAPHICS_DRIVER;
|
||||||
|
|
||||||
|
static PGRAPHICS_DRIVER DriverList;
|
||||||
|
static PGRAPHICS_DRIVER GenericDriver;
|
||||||
|
|
||||||
|
BOOL DRIVER_RegisterDriver(PWSTR Name, PGD_ENABLEDRIVER EnableDriver)
|
||||||
|
{
|
||||||
|
PGRAPHICS_DRIVER Driver = ExAllocatePool(NonPagedPool, sizeof(*Driver));
|
||||||
|
if (!Driver)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
Driver->EnableDriver = EnableDriver;
|
||||||
|
if (Name)
|
||||||
|
{
|
||||||
|
Driver->Name = ExAllocatePool(NonPagedPool,
|
||||||
|
(wcslen(Name) + 1) * sizeof(WCHAR));
|
||||||
|
wcscpy(Driver->Name, Name);
|
||||||
|
Driver->Next = DriverList;
|
||||||
|
DriverList = Driver;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GenericDriver != NULL)
|
||||||
|
{
|
||||||
|
ExFreePool(Driver);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Driver->name = NULL;
|
||||||
|
GenericDriver = Driver;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
PGD_ENABLEDRIVER DRIVER_FindDriver(PWSTR Name)
|
||||||
|
{
|
||||||
|
GRAPHICS_DRIVER *Driver = DriverList;
|
||||||
|
|
||||||
|
while (Driver && Name)
|
||||||
|
{
|
||||||
|
if (!wcsicmp( Driver->Name, Name))
|
||||||
|
{
|
||||||
|
return Driver->EnableDriver;
|
||||||
|
}
|
||||||
|
Driver = Driver->Next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GenericDriver ? GenericDriver->EnableDriver : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL DRIVER_UnregisterDriver(PWSTR Name)
|
||||||
|
{
|
||||||
|
PGRAPHICS_DRIVER Driver = NULL;
|
||||||
|
|
||||||
|
if (Name)
|
||||||
|
{
|
||||||
|
if (DriverList != NULL)
|
||||||
|
{
|
||||||
|
if (!wcsicmp(DriverList->Name, Name))
|
||||||
|
{
|
||||||
|
Driver = DriverList;
|
||||||
|
DriverList = DriverList->Next;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Driver = DriverList;
|
||||||
|
while (Driver->Next && wcsicmp(Driver->Name, Name))
|
||||||
|
{
|
||||||
|
Driver = Driver->Next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (GenericDriver != NULL)
|
||||||
|
{
|
||||||
|
Driver = GenericDriver;
|
||||||
|
GenericDriver = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Driver != NULL)
|
||||||
|
{
|
||||||
|
ExFreePool(Driver->Name);
|
||||||
|
ExFreePool(Driver);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue