Build the DC function table by using GetProcAddress on the graphics
driver module. Moved driver support to dlls/gdi.
This commit is contained in:
parent
e9dd63ef16
commit
3dd63eb2ad
|
@ -9,6 +9,7 @@ IMPORTS = kernel32 ntdll
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
bidi16.c \
|
bidi16.c \
|
||||||
|
driver.c \
|
||||||
gdi_main.c \
|
gdi_main.c \
|
||||||
printdrv.c \
|
printdrv.c \
|
||||||
thunk.c \
|
thunk.c \
|
||||||
|
|
|
@ -0,0 +1,434 @@
|
||||||
|
/*
|
||||||
|
* Graphics driver management functions
|
||||||
|
*
|
||||||
|
* Copyright 1996 Alexandre Julliard
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "winreg.h"
|
||||||
|
#include "ntddk.h"
|
||||||
|
|
||||||
|
#include "gdi.h"
|
||||||
|
#include "debugtools.h"
|
||||||
|
|
||||||
|
DEFAULT_DEBUG_CHANNEL(driver);
|
||||||
|
|
||||||
|
struct graphics_driver
|
||||||
|
{
|
||||||
|
struct graphics_driver *next;
|
||||||
|
struct graphics_driver *prev;
|
||||||
|
HMODULE module; /* module handle */
|
||||||
|
unsigned int count; /* reference count */
|
||||||
|
DC_FUNCTIONS funcs;
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct graphics_driver *first_driver;
|
||||||
|
static struct graphics_driver *display_driver;
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* create_driver
|
||||||
|
*
|
||||||
|
* Allocate and fill the driver structure for a given module.
|
||||||
|
*/
|
||||||
|
static struct graphics_driver *create_driver( HMODULE module )
|
||||||
|
{
|
||||||
|
struct graphics_driver *driver;
|
||||||
|
|
||||||
|
if (!(driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver)))) return NULL;
|
||||||
|
driver->next = NULL;
|
||||||
|
driver->prev = NULL;
|
||||||
|
driver->module = module;
|
||||||
|
driver->count = 1;
|
||||||
|
|
||||||
|
/* fill the function table */
|
||||||
|
|
||||||
|
#define GET_FUNC(name) driver->funcs.p##name = (void*)GetProcAddress( module, #name )
|
||||||
|
|
||||||
|
GET_FUNC(AbortDoc);
|
||||||
|
GET_FUNC(AbortPath);
|
||||||
|
GET_FUNC(AngleArc);
|
||||||
|
GET_FUNC(Arc);
|
||||||
|
GET_FUNC(ArcTo);
|
||||||
|
GET_FUNC(BeginPath);
|
||||||
|
GET_FUNC(BitBlt);
|
||||||
|
GET_FUNC(BitmapBits);
|
||||||
|
GET_FUNC(ChoosePixelFormat);
|
||||||
|
GET_FUNC(Chord);
|
||||||
|
GET_FUNC(CloseFigure);
|
||||||
|
GET_FUNC(CreateBitmap);
|
||||||
|
GET_FUNC(CreateDC);
|
||||||
|
GET_FUNC(CreateDIBSection);
|
||||||
|
GET_FUNC(DeleteDC);
|
||||||
|
GET_FUNC(DeleteObject);
|
||||||
|
GET_FUNC(DescribePixelFormat);
|
||||||
|
GET_FUNC(DeviceCapabilities);
|
||||||
|
GET_FUNC(Ellipse);
|
||||||
|
GET_FUNC(EndDoc);
|
||||||
|
GET_FUNC(EndPage);
|
||||||
|
GET_FUNC(EndPath);
|
||||||
|
GET_FUNC(EnumDeviceFonts);
|
||||||
|
GET_FUNC(Escape);
|
||||||
|
GET_FUNC(ExcludeClipRect);
|
||||||
|
GET_FUNC(ExtDeviceMode);
|
||||||
|
GET_FUNC(ExtFloodFill);
|
||||||
|
GET_FUNC(ExtTextOut);
|
||||||
|
GET_FUNC(FillPath);
|
||||||
|
GET_FUNC(FillRgn);
|
||||||
|
GET_FUNC(FlattenPath);
|
||||||
|
GET_FUNC(FrameRgn);
|
||||||
|
GET_FUNC(GetCharWidth);
|
||||||
|
GET_FUNC(GetDCOrgEx);
|
||||||
|
GET_FUNC(GetDeviceGammaRamp);
|
||||||
|
GET_FUNC(GetPixel);
|
||||||
|
GET_FUNC(GetPixelFormat);
|
||||||
|
GET_FUNC(GetTextExtentPoint);
|
||||||
|
GET_FUNC(GetTextMetrics);
|
||||||
|
GET_FUNC(IntersectClipRect);
|
||||||
|
GET_FUNC(InvertRgn);
|
||||||
|
GET_FUNC(LineTo);
|
||||||
|
GET_FUNC(MoveTo);
|
||||||
|
GET_FUNC(OffsetClipRgn);
|
||||||
|
GET_FUNC(OffsetViewportOrg);
|
||||||
|
GET_FUNC(OffsetWindowOrg);
|
||||||
|
GET_FUNC(PaintRgn);
|
||||||
|
GET_FUNC(PatBlt);
|
||||||
|
GET_FUNC(Pie);
|
||||||
|
GET_FUNC(PolyBezier);
|
||||||
|
GET_FUNC(PolyBezierTo);
|
||||||
|
GET_FUNC(PolyDraw);
|
||||||
|
GET_FUNC(PolyPolygon);
|
||||||
|
GET_FUNC(PolyPolyline);
|
||||||
|
GET_FUNC(Polygon);
|
||||||
|
GET_FUNC(Polyline);
|
||||||
|
GET_FUNC(PolylineTo);
|
||||||
|
GET_FUNC(RealizePalette);
|
||||||
|
GET_FUNC(Rectangle);
|
||||||
|
GET_FUNC(RestoreDC);
|
||||||
|
GET_FUNC(RoundRect);
|
||||||
|
GET_FUNC(SaveDC);
|
||||||
|
GET_FUNC(ScaleViewportExt);
|
||||||
|
GET_FUNC(ScaleWindowExt);
|
||||||
|
GET_FUNC(SelectClipPath);
|
||||||
|
GET_FUNC(SelectClipRgn);
|
||||||
|
GET_FUNC(SelectObject);
|
||||||
|
GET_FUNC(SelectPalette);
|
||||||
|
GET_FUNC(SetBkColor);
|
||||||
|
GET_FUNC(SetBkMode);
|
||||||
|
GET_FUNC(SetDIBitsToDevice);
|
||||||
|
GET_FUNC(SetDeviceClipping);
|
||||||
|
GET_FUNC(SetDeviceGammaRamp);
|
||||||
|
GET_FUNC(SetMapMode);
|
||||||
|
GET_FUNC(SetMapperFlags);
|
||||||
|
GET_FUNC(SetPixel);
|
||||||
|
GET_FUNC(SetPixelFormat);
|
||||||
|
GET_FUNC(SetPolyFillMode);
|
||||||
|
GET_FUNC(SetROP2);
|
||||||
|
GET_FUNC(SetRelAbs);
|
||||||
|
GET_FUNC(SetStretchBltMode);
|
||||||
|
GET_FUNC(SetTextAlign);
|
||||||
|
GET_FUNC(SetTextCharacterExtra);
|
||||||
|
GET_FUNC(SetTextColor);
|
||||||
|
GET_FUNC(SetTextJustification);
|
||||||
|
GET_FUNC(SetViewportExt);
|
||||||
|
GET_FUNC(SetViewportOrg);
|
||||||
|
GET_FUNC(SetWindowExt);
|
||||||
|
GET_FUNC(SetWindowOrg);
|
||||||
|
GET_FUNC(StartDoc);
|
||||||
|
GET_FUNC(StartPage);
|
||||||
|
GET_FUNC(StretchBlt);
|
||||||
|
GET_FUNC(StretchDIBits);
|
||||||
|
GET_FUNC(StrokeAndFillPath);
|
||||||
|
GET_FUNC(StrokePath);
|
||||||
|
GET_FUNC(SwapBuffers);
|
||||||
|
GET_FUNC(WidenPath);
|
||||||
|
#undef GET_FUNC
|
||||||
|
|
||||||
|
/* add it to the list */
|
||||||
|
driver->prev = NULL;
|
||||||
|
if ((driver->next = first_driver)) driver->next->prev = driver;
|
||||||
|
first_driver = driver;
|
||||||
|
return driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* load_display_driver
|
||||||
|
*
|
||||||
|
* Special case for loading the display driver: get the name from the config file
|
||||||
|
*/
|
||||||
|
static struct graphics_driver *load_display_driver(void)
|
||||||
|
{
|
||||||
|
char buffer[MAX_PATH];
|
||||||
|
HMODULE module;
|
||||||
|
HKEY hkey;
|
||||||
|
|
||||||
|
if (display_driver) /* already loaded */
|
||||||
|
{
|
||||||
|
display_driver->count++;
|
||||||
|
return display_driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy( buffer, "x11drv" ); /* default value */
|
||||||
|
if (!RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Wine", &hkey ))
|
||||||
|
{
|
||||||
|
DWORD type, count = sizeof(buffer);
|
||||||
|
RegQueryValueExA( hkey, "GraphicsDriver", 0, &type, buffer, &count );
|
||||||
|
RegCloseKey( hkey );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(module = LoadLibraryA( buffer )))
|
||||||
|
{
|
||||||
|
MESSAGE( "Could not load graphics driver '%s'\n", buffer );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(display_driver = create_driver( module )))
|
||||||
|
{
|
||||||
|
MESSAGE( "Could not create graphics driver '%s'\n", buffer );
|
||||||
|
FreeLibrary( module );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
display_driver->count++; /* we don't want to free it */
|
||||||
|
return display_driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* DRIVER_load_driver
|
||||||
|
*/
|
||||||
|
const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name )
|
||||||
|
{
|
||||||
|
HMODULE module;
|
||||||
|
struct graphics_driver *driver;
|
||||||
|
|
||||||
|
RtlAcquirePebLock();
|
||||||
|
|
||||||
|
/* display driver is a special case */
|
||||||
|
if (!strcasecmp( name, "display" ))
|
||||||
|
{
|
||||||
|
driver = load_display_driver();
|
||||||
|
RtlReleasePebLock();
|
||||||
|
return &driver->funcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((module = GetModuleHandleA( name )))
|
||||||
|
{
|
||||||
|
for (driver = first_driver; driver; driver = driver->next)
|
||||||
|
{
|
||||||
|
if (driver->module == module)
|
||||||
|
{
|
||||||
|
driver->count++;
|
||||||
|
RtlReleasePebLock();
|
||||||
|
return &driver->funcs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(module = LoadLibraryA( name )))
|
||||||
|
{
|
||||||
|
RtlReleasePebLock();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(driver = create_driver( module )))
|
||||||
|
{
|
||||||
|
FreeLibrary( module );
|
||||||
|
RtlReleasePebLock();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE( "loaded driver %p for %s\n", driver, name );
|
||||||
|
RtlReleasePebLock();
|
||||||
|
return &driver->funcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* DRIVER_get_driver
|
||||||
|
*
|
||||||
|
* Get a new copy of an existing driver.
|
||||||
|
*/
|
||||||
|
const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs )
|
||||||
|
{
|
||||||
|
struct graphics_driver *driver;
|
||||||
|
|
||||||
|
RtlAcquirePebLock();
|
||||||
|
for (driver = first_driver; driver; driver = driver->next)
|
||||||
|
if (&driver->funcs == funcs) break;
|
||||||
|
if (!driver) ERR( "driver not found, trouble ahead\n" );
|
||||||
|
driver->count++;
|
||||||
|
RtlReleasePebLock();
|
||||||
|
return funcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* DRIVER_release_driver
|
||||||
|
*
|
||||||
|
* Release a driver by decrementing ref count and freeing it if needed.
|
||||||
|
*/
|
||||||
|
void DRIVER_release_driver( const DC_FUNCTIONS *funcs )
|
||||||
|
{
|
||||||
|
struct graphics_driver *driver;
|
||||||
|
|
||||||
|
RtlAcquirePebLock();
|
||||||
|
|
||||||
|
for (driver = first_driver; driver; driver = driver->next)
|
||||||
|
if (&driver->funcs == funcs) break;
|
||||||
|
|
||||||
|
if (!driver) goto done;
|
||||||
|
if (--driver->count) goto done;
|
||||||
|
|
||||||
|
/* removed last reference, free it */
|
||||||
|
if (driver->next) driver->next->prev = driver->prev;
|
||||||
|
if (driver->prev) driver->prev->next = driver->next;
|
||||||
|
else first_driver = driver->next;
|
||||||
|
if (driver == display_driver) display_driver = NULL;
|
||||||
|
|
||||||
|
FreeLibrary( driver->module );
|
||||||
|
HeapFree( GetProcessHeap(), 0, driver );
|
||||||
|
done:
|
||||||
|
RtlReleasePebLock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* DRIVER_GetDriverName
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
BOOL DRIVER_GetDriverName( LPCSTR device, LPSTR driver, DWORD size )
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
size = GetProfileStringA("devices", device, "", driver, size);
|
||||||
|
if(!size) {
|
||||||
|
WARN("Unable to find '%s' in [devices] section of win.ini\n", device);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
p = strchr(driver, ',');
|
||||||
|
if(!p)
|
||||||
|
{
|
||||||
|
WARN("'%s' entry in [devices] section of win.ini is malformed.\n", device);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
*p = '\0';
|
||||||
|
TRACE("Found '%s' for '%s'\n", driver, device);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* @ [GDI32.100]
|
||||||
|
*
|
||||||
|
* This should thunk to 16-bit and simply call the proc with the given args.
|
||||||
|
*/
|
||||||
|
INT WINAPI GDI_CallDevInstall16( FARPROC16 lpfnDevInstallProc, HWND hWnd,
|
||||||
|
LPSTR lpModelName, LPSTR OldPort, LPSTR NewPort )
|
||||||
|
{
|
||||||
|
FIXME("(%p, %04x, %s, %s, %s)\n", lpfnDevInstallProc, hWnd, lpModelName, OldPort, NewPort );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* @ [GDI32.101]
|
||||||
|
*
|
||||||
|
* This should load the correct driver for lpszDevice and calls this driver's
|
||||||
|
* ExtDeviceModePropSheet proc.
|
||||||
|
*
|
||||||
|
* Note: The driver calls a callback routine for each property sheet page; these
|
||||||
|
* pages are supposed to be filled into the structure pointed to by lpPropSheet.
|
||||||
|
* The layout of this structure is:
|
||||||
|
*
|
||||||
|
* struct
|
||||||
|
* {
|
||||||
|
* DWORD nPages;
|
||||||
|
* DWORD unknown;
|
||||||
|
* HPROPSHEETPAGE pages[10];
|
||||||
|
* };
|
||||||
|
*/
|
||||||
|
INT WINAPI GDI_CallExtDeviceModePropSheet16( HWND hWnd, LPCSTR lpszDevice,
|
||||||
|
LPCSTR lpszPort, LPVOID lpPropSheet )
|
||||||
|
{
|
||||||
|
FIXME("(%04x, %s, %s, %p)\n", hWnd, lpszDevice, lpszPort, lpPropSheet );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* @ [GDI32.102]
|
||||||
|
*
|
||||||
|
* This should load the correct driver for lpszDevice and calls this driver's
|
||||||
|
* ExtDeviceMode proc.
|
||||||
|
*/
|
||||||
|
INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd,
|
||||||
|
LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
|
||||||
|
LPSTR lpszPort, LPDEVMODEA lpdmInput,
|
||||||
|
LPSTR lpszProfile, DWORD fwMode )
|
||||||
|
{
|
||||||
|
char buf[300];
|
||||||
|
HDC hdc;
|
||||||
|
DC *dc;
|
||||||
|
INT ret = -1;
|
||||||
|
|
||||||
|
TRACE("(%04x, %p, %s, %s, %p, %s, %ld)\n",
|
||||||
|
hwnd, lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile, fwMode );
|
||||||
|
|
||||||
|
if(!DRIVER_GetDriverName( lpszDevice, buf, sizeof(buf) )) return -1;
|
||||||
|
|
||||||
|
if (!(hdc = CreateICA( buf, NULL, lpszPort, NULL ))) return -1;
|
||||||
|
|
||||||
|
if ((dc = DC_GetDCPtr( hdc )))
|
||||||
|
{
|
||||||
|
if (dc->funcs->pExtDeviceMode)
|
||||||
|
ret = dc->funcs->pExtDeviceMode(buf, hwnd, lpdmOutput, lpszDevice, lpszPort,
|
||||||
|
lpdmInput, lpszProfile, fwMode);
|
||||||
|
GDI_ReleaseObj( hdc );
|
||||||
|
}
|
||||||
|
DeleteDC( hdc );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* @ [GDI32.103]
|
||||||
|
*
|
||||||
|
* This should load the correct driver for lpszDevice and calls this driver's
|
||||||
|
* AdvancedSetupDialog proc.
|
||||||
|
*/
|
||||||
|
INT WINAPI GDI_CallAdvancedSetupDialog16( HWND hwnd, LPSTR lpszDevice,
|
||||||
|
LPDEVMODEA devin, LPDEVMODEA devout )
|
||||||
|
{
|
||||||
|
TRACE("(%04x, %s, %p, %p)\n", hwnd, lpszDevice, devin, devout );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* @ [GDI32.104]
|
||||||
|
*
|
||||||
|
* This should load the correct driver for lpszDevice and calls this driver's
|
||||||
|
* DeviceCapabilities proc.
|
||||||
|
*/
|
||||||
|
DWORD WINAPI GDI_CallDeviceCapabilities16( LPCSTR lpszDevice, LPCSTR lpszPort,
|
||||||
|
WORD fwCapability, LPSTR lpszOutput,
|
||||||
|
LPDEVMODEA lpdm )
|
||||||
|
{
|
||||||
|
char buf[300];
|
||||||
|
HDC hdc;
|
||||||
|
DC *dc;
|
||||||
|
INT ret = -1;
|
||||||
|
|
||||||
|
TRACE("(%s, %s, %d, %p, %p)\n", lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm );
|
||||||
|
|
||||||
|
if(!DRIVER_GetDriverName( lpszDevice, buf, sizeof(buf) )) return -1;
|
||||||
|
|
||||||
|
if (!(hdc = CreateICA( buf, NULL, lpszPort, NULL ))) return -1;
|
||||||
|
|
||||||
|
if ((dc = DC_GetDCPtr( hdc )))
|
||||||
|
{
|
||||||
|
if (dc->funcs->pDeviceCapabilities)
|
||||||
|
ret = dc->funcs->pDeviceCapabilities( buf, lpszDevice, lpszPort,
|
||||||
|
fwCapability, lpszOutput, lpdm );
|
||||||
|
GDI_ReleaseObj( hdc );
|
||||||
|
}
|
||||||
|
DeleteDC( hdc );
|
||||||
|
return ret;
|
||||||
|
}
|
|
@ -17,14 +17,7 @@
|
||||||
BOOL WINAPI MAIN_GdiInit(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved)
|
BOOL WINAPI MAIN_GdiInit(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved)
|
||||||
{
|
{
|
||||||
if (reason != DLL_PROCESS_ATTACH) return TRUE;
|
if (reason != DLL_PROCESS_ATTACH) return TRUE;
|
||||||
|
return GDI_Init();
|
||||||
/* GDI initialisation */
|
|
||||||
if(!GDI_Init()) return FALSE;
|
|
||||||
|
|
||||||
/* Create the Win16 printer driver */
|
|
||||||
if (!WIN16DRV_Init()) return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ DEFAULT_DEBUG_CHANNEL(ttydrv);
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
|
extern const DC_FUNCTIONS *TTYDRV_DC_Funcs; /* hack */
|
||||||
|
|
||||||
static LONG TTYDRV_DC_GetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count);
|
static LONG TTYDRV_DC_GetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count);
|
||||||
static LONG TTYDRV_DC_SetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count);
|
static LONG TTYDRV_DC_SetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count);
|
||||||
|
|
||||||
|
@ -31,7 +33,7 @@ TTYDRV_PHYSBITMAP *TTYDRV_DC_AllocBitmap(BITMAPOBJ *bitmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmap->physBitmap = physBitmap;
|
bitmap->physBitmap = physBitmap;
|
||||||
bitmap->funcs = DRIVER_FindDriver("DISPLAY");
|
bitmap->funcs = TTYDRV_DC_Funcs;
|
||||||
|
|
||||||
return physBitmap;
|
return physBitmap;
|
||||||
}
|
}
|
||||||
|
|
111
dlls/ttydrv/dc.c
111
dlls/ttydrv/dc.c
|
@ -17,108 +17,6 @@ DEFAULT_DEBUG_CHANNEL(ttydrv);
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
static const DC_FUNCTIONS TTYDRV_DC_Driver =
|
|
||||||
{
|
|
||||||
NULL, /* pAbortDoc */
|
|
||||||
NULL, /* pAbortPath */
|
|
||||||
NULL, /* pAngleArc */
|
|
||||||
TTYDRV_DC_Arc, /* pArc */
|
|
||||||
NULL, /* pArcTo */
|
|
||||||
NULL, /* pBeginPath */
|
|
||||||
TTYDRV_DC_BitBlt, /* pBitBlt */
|
|
||||||
TTYDRV_DC_BitmapBits,/* pBitmapBits */
|
|
||||||
NULL, /* pChoosePixelFormat */
|
|
||||||
TTYDRV_DC_Chord, /* pChord */
|
|
||||||
NULL, /* pCloseFigure */
|
|
||||||
TTYDRV_DC_CreateBitmap, /* pCreateBitmap */
|
|
||||||
TTYDRV_DC_CreateDC, /* pCreateDC */
|
|
||||||
NULL, /* pCreateDIBSection */
|
|
||||||
TTYDRV_DC_DeleteDC, /* pDeleteDC */
|
|
||||||
TTYDRV_DC_DeleteObject, /* pDeleteObject */
|
|
||||||
NULL, /* pDescribePixelFormat */
|
|
||||||
NULL, /* pDeviceCapabilities */
|
|
||||||
TTYDRV_DC_Ellipse, /* pEllipse */
|
|
||||||
NULL, /* pEndDoc */
|
|
||||||
NULL, /* pEndPage */
|
|
||||||
NULL, /* pEndPath */
|
|
||||||
NULL, /* pEnumDeviceFonts */
|
|
||||||
TTYDRV_DC_Escape, /* pEscape */
|
|
||||||
NULL, /* pExcludeClipRect */
|
|
||||||
NULL, /* pExtDeviceMode */
|
|
||||||
TTYDRV_DC_ExtFloodFill, /* pExtFloodFill */
|
|
||||||
TTYDRV_DC_ExtTextOut, /* pExtTextOut */
|
|
||||||
NULL, /* pFillPath */
|
|
||||||
NULL, /* pFillRgn */
|
|
||||||
NULL, /* pFlattenPath */
|
|
||||||
NULL, /* pFrameRgn */
|
|
||||||
TTYDRV_DC_GetCharWidth, /* pGetCharWidth */
|
|
||||||
NULL, /* pGetDCOrgEx */
|
|
||||||
NULL, /* pGetDeviceGammaRamp */
|
|
||||||
TTYDRV_DC_GetPixel, /* pGetPixel */
|
|
||||||
NULL, /* pGetPixelFormat */
|
|
||||||
TTYDRV_DC_GetTextExtentPoint, /* pGetTextExtentPoint */
|
|
||||||
TTYDRV_DC_GetTextMetrics, /* pGetTextMetrics */
|
|
||||||
NULL, /* pIntersectClipRect */
|
|
||||||
NULL, /* pIntersectVisRect */
|
|
||||||
TTYDRV_DC_LineTo, /* pLineTo */
|
|
||||||
NULL, /* pMoveTo */
|
|
||||||
NULL, /* pOffsetClipRgn */
|
|
||||||
NULL, /* pOffsetViewportOrg (optional) */
|
|
||||||
NULL, /* pOffsetWindowOrg (optional) */
|
|
||||||
TTYDRV_DC_PaintRgn, /* pPaintRgn */
|
|
||||||
TTYDRV_DC_PatBlt, /* pPatBlt */
|
|
||||||
TTYDRV_DC_Pie, /* pPie */
|
|
||||||
NULL, /* pPolyBezier */
|
|
||||||
NULL, /* pPolyBezierTo */
|
|
||||||
NULL, /* pPolyDraw */
|
|
||||||
TTYDRV_DC_PolyPolygon, /* pPolyPolygon */
|
|
||||||
TTYDRV_DC_PolyPolyline, /* pPolyPolyline */
|
|
||||||
TTYDRV_DC_Polygon, /* pPolygon */
|
|
||||||
TTYDRV_DC_Polyline, /* pPolyline */
|
|
||||||
NULL, /* pPolylineTo */
|
|
||||||
NULL, /* pRealizePalette */
|
|
||||||
TTYDRV_DC_Rectangle, /* pRectangle */
|
|
||||||
NULL, /* pRestoreDC */
|
|
||||||
TTYDRV_DC_RoundRect, /* pRoundRect */
|
|
||||||
NULL, /* pSaveDC */
|
|
||||||
NULL, /* pScaleViewportExt (optional) */
|
|
||||||
NULL, /* pScaleWindowExt (optional) */
|
|
||||||
NULL, /* pSelectClipPath */
|
|
||||||
NULL, /* pSelectClipRgn */
|
|
||||||
TTYDRV_DC_SelectObject, /* pSelectObject */
|
|
||||||
NULL, /* pSelectPalette */
|
|
||||||
TTYDRV_DC_SetBkColor, /* pSetBkColor */
|
|
||||||
NULL, /* pSetBkMode */
|
|
||||||
TTYDRV_DC_SetDeviceClipping, /* pSetDeviceClipping */
|
|
||||||
NULL, /* pSetDeviceGammaRamp */
|
|
||||||
TTYDRV_DC_SetDIBitsToDevice, /* pSetDIBitsToDevice */
|
|
||||||
NULL, /* pSetMapMode (optional) */
|
|
||||||
NULL, /* pSetMapperFlags */
|
|
||||||
TTYDRV_DC_SetPixel, /* pSetPixel */
|
|
||||||
NULL, /* pSetPixelFormat */
|
|
||||||
NULL, /* pSetPolyFillMode */
|
|
||||||
NULL, /* pSetROP2 */
|
|
||||||
NULL, /* pSetRelAbs */
|
|
||||||
NULL, /* pSetStretchBltMode */
|
|
||||||
NULL, /* pSetTextAlign */
|
|
||||||
NULL, /* pSetTextCharacterExtra */
|
|
||||||
TTYDRV_DC_SetTextColor, /* pSetTextColor */
|
|
||||||
NULL, /* pSetTextJustification */
|
|
||||||
NULL, /* pSetViewportExt (optional) */
|
|
||||||
NULL, /* pSetViewportOrg (optional) */
|
|
||||||
NULL, /* pSetWindowExt (optional) */
|
|
||||||
NULL, /* pSetWindowOrg (optional) */
|
|
||||||
NULL, /* pStartDoc */
|
|
||||||
NULL, /* pStartPage */
|
|
||||||
TTYDRV_DC_StretchBlt, /* pStretchBlt */
|
|
||||||
NULL, /* pStretchDIBits */
|
|
||||||
NULL, /* pStrokeAndFillPath */
|
|
||||||
NULL, /* pStrokePath */
|
|
||||||
NULL, /* pSwapBuffers */
|
|
||||||
NULL /* pWidenPath */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
BITMAP_DRIVER TTYDRV_BITMAP_Driver =
|
BITMAP_DRIVER TTYDRV_BITMAP_Driver =
|
||||||
{
|
{
|
||||||
TTYDRV_BITMAP_SetDIBits,
|
TTYDRV_BITMAP_SetDIBits,
|
||||||
|
@ -162,6 +60,8 @@ DeviceCaps TTYDRV_DC_DevCaps = {
|
||||||
/* ..etc */ 0, 0
|
/* ..etc */ 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const DC_FUNCTIONS *TTYDRV_DC_Funcs = NULL; /* hack */
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* TTYDRV_GDI_Initialize
|
* TTYDRV_GDI_Initialize
|
||||||
*/
|
*/
|
||||||
|
@ -183,10 +83,7 @@ BOOL TTYDRV_GDI_Initialize(void)
|
||||||
TTYDRV_DC_DevCaps.logPixelsX = (int) (TTYDRV_DC_DevCaps.horzRes * 25.4 / TTYDRV_DC_DevCaps.horzSize);
|
TTYDRV_DC_DevCaps.logPixelsX = (int) (TTYDRV_DC_DevCaps.horzRes * 25.4 / TTYDRV_DC_DevCaps.horzSize);
|
||||||
TTYDRV_DC_DevCaps.logPixelsY = (int) (TTYDRV_DC_DevCaps.vertRes * 25.4 / TTYDRV_DC_DevCaps.vertSize);
|
TTYDRV_DC_DevCaps.logPixelsY = (int) (TTYDRV_DC_DevCaps.vertRes * 25.4 / TTYDRV_DC_DevCaps.vertSize);
|
||||||
|
|
||||||
if(!TTYDRV_PALETTE_Initialize())
|
return TTYDRV_PALETTE_Initialize();
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return DRIVER_RegisterDriver( "DISPLAY", &TTYDRV_DC_Driver );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
@ -210,6 +107,8 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
|
||||||
dc, debugstr_a(driver), debugstr_a(device),
|
dc, debugstr_a(driver), debugstr_a(device),
|
||||||
debugstr_a(output), initData);
|
debugstr_a(output), initData);
|
||||||
|
|
||||||
|
if (!TTYDRV_DC_Funcs) TTYDRV_DC_Funcs = dc->funcs; /* hack */
|
||||||
|
|
||||||
dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
sizeof(TTYDRV_PDEVICE));
|
sizeof(TTYDRV_PDEVICE));
|
||||||
if(!dc->physDev) {
|
if(!dc->physDev) {
|
||||||
|
|
|
@ -9,6 +9,42 @@ import ntdll.dll
|
||||||
|
|
||||||
debug_channels (ttydrv)
|
debug_channels (ttydrv)
|
||||||
|
|
||||||
|
# GDI driver
|
||||||
|
|
||||||
|
@ cdecl Arc(ptr long long long long long long long long) TTYDRV_DC_Arc
|
||||||
|
@ cdecl BitBlt(ptr long long long long ptr long long long) TTYDRV_DC_BitBlt
|
||||||
|
@ cdecl BitmapBits(long ptr long long) TTYDRV_DC_BitmapBits
|
||||||
|
@ cdecl Chord(ptr long long long long long long long long) TTYDRV_DC_Chord
|
||||||
|
@ cdecl CreateBitmap(long) TTYDRV_DC_CreateBitmap
|
||||||
|
@ cdecl CreateDC(ptr str str str ptr) TTYDRV_DC_CreateDC
|
||||||
|
@ cdecl DeleteDC(ptr) TTYDRV_DC_DeleteDC
|
||||||
|
@ cdecl DeleteObject(long) TTYDRV_DC_DeleteObject
|
||||||
|
@ cdecl Ellipse(ptr long long long long) TTYDRV_DC_Ellipse
|
||||||
|
@ cdecl Escape(ptr long long long long) TTYDRV_DC_Escape
|
||||||
|
@ cdecl ExtFloodFill(ptr long long long long) TTYDRV_DC_ExtFloodFill
|
||||||
|
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) TTYDRV_DC_ExtTextOut
|
||||||
|
@ cdecl GetCharWidth(ptr long long ptr) TTYDRV_DC_GetCharWidth
|
||||||
|
@ cdecl GetPixel(ptr long long) TTYDRV_DC_GetPixel
|
||||||
|
@ cdecl GetTextExtentPoint(ptr ptr long ptr) TTYDRV_DC_GetTextExtentPoint
|
||||||
|
@ cdecl GetTextMetrics(ptr ptr) TTYDRV_DC_GetTextMetrics
|
||||||
|
@ cdecl LineTo(ptr long long) TTYDRV_DC_LineTo
|
||||||
|
@ cdecl PaintRgn(ptr long) TTYDRV_DC_PaintRgn
|
||||||
|
@ cdecl PatBlt(ptr long long long long long) TTYDRV_DC_PatBlt
|
||||||
|
@ cdecl Pie(ptr long long long long long long long long) TTYDRV_DC_Pie
|
||||||
|
@ cdecl PolyPolygon(ptr ptr ptr long) TTYDRV_DC_PolyPolygon
|
||||||
|
@ cdecl PolyPolyline(ptr ptr ptr long) TTYDRV_DC_PolyPolyline
|
||||||
|
@ cdecl Polygon(ptr ptr long) TTYDRV_DC_Polygon
|
||||||
|
@ cdecl Polyline(ptr ptr long) TTYDRV_DC_Polyline
|
||||||
|
@ cdecl Rectangle(ptr long long long long) TTYDRV_DC_Rectangle
|
||||||
|
@ cdecl RoundRect(ptr long long long long long long) TTYDRV_DC_RoundRect
|
||||||
|
@ cdecl SelectObject(ptr long) TTYDRV_DC_SelectObject
|
||||||
|
@ cdecl SetBkColor(ptr long) TTYDRV_DC_SetBkColor
|
||||||
|
@ cdecl SetDeviceClipping(ptr) TTYDRV_DC_SetDeviceClipping
|
||||||
|
@ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) TTYDRV_DC_SetDIBitsToDevice
|
||||||
|
@ cdecl SetPixel(ptr long long long) TTYDRV_DC_SetPixel
|
||||||
|
@ cdecl SetTextColor(ptr long) TTYDRV_DC_SetTextColor
|
||||||
|
@ cdecl StretchBlt(ptr long long long long ptr long long long long long) TTYDRV_DC_StretchBlt
|
||||||
|
|
||||||
# USER driver
|
# USER driver
|
||||||
|
|
||||||
@ cdecl InitKeyboard() TTYDRV_InitKeyboard
|
@ cdecl InitKeyboard() TTYDRV_InitKeyboard
|
||||||
|
|
|
@ -24,112 +24,6 @@
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(psdrv);
|
DEFAULT_DEBUG_CHANNEL(psdrv);
|
||||||
|
|
||||||
static BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
|
||||||
LPCSTR output, const DEVMODEA* initData );
|
|
||||||
static BOOL PSDRV_DeleteDC( DC *dc );
|
|
||||||
|
|
||||||
static const DC_FUNCTIONS PSDRV_Funcs =
|
|
||||||
{
|
|
||||||
NULL, /* pAbortDoc */
|
|
||||||
NULL, /* pAbortPath */
|
|
||||||
NULL, /* pAngleArc */
|
|
||||||
PSDRV_Arc, /* pArc */
|
|
||||||
NULL, /* pArcTo */
|
|
||||||
NULL, /* pBeginPath */
|
|
||||||
NULL, /* pBitBlt */
|
|
||||||
NULL, /* pBitmapBits */
|
|
||||||
NULL, /* pChoosePixelFormat */
|
|
||||||
PSDRV_Chord, /* pChord */
|
|
||||||
NULL, /* pCloseFigure */
|
|
||||||
NULL, /* pCreateBitmap */
|
|
||||||
PSDRV_CreateDC, /* pCreateDC */
|
|
||||||
NULL, /* pCreateDIBSection */
|
|
||||||
PSDRV_DeleteDC, /* pDeleteDC */
|
|
||||||
NULL, /* pDeleteObject */
|
|
||||||
NULL, /* pDescribePixelFormat */
|
|
||||||
PSDRV_DeviceCapabilities, /* pDeviceCapabilities */
|
|
||||||
PSDRV_Ellipse, /* pEllipse */
|
|
||||||
PSDRV_EndDoc, /* pEndDoc */
|
|
||||||
PSDRV_EndPage, /* pEndPage */
|
|
||||||
NULL, /* pEndPath */
|
|
||||||
PSDRV_EnumDeviceFonts, /* pEnumDeviceFonts */
|
|
||||||
PSDRV_Escape, /* pEscape */
|
|
||||||
NULL, /* pExcludeClipRect */
|
|
||||||
PSDRV_ExtDeviceMode, /* pExtDeviceMode */
|
|
||||||
NULL, /* pExtFloodFill */
|
|
||||||
PSDRV_ExtTextOut, /* pExtTextOut */
|
|
||||||
NULL, /* pFillPath */
|
|
||||||
NULL, /* pFillRgn */
|
|
||||||
NULL, /* pFlattenPath */
|
|
||||||
NULL, /* pFrameRgn */
|
|
||||||
PSDRV_GetCharWidth, /* pGetCharWidth */
|
|
||||||
NULL, /* pGetDCOrgEx */
|
|
||||||
NULL, /* pGetDeviceGammaRamp */
|
|
||||||
NULL, /* pGetPixel */
|
|
||||||
NULL, /* pGetPixelFormat */
|
|
||||||
PSDRV_GetTextExtentPoint, /* pGetTextExtentPoint */
|
|
||||||
PSDRV_GetTextMetrics, /* pGetTextMetrics */
|
|
||||||
NULL, /* pIntersectClipRect */
|
|
||||||
NULL, /* pInvertRgn */
|
|
||||||
PSDRV_LineTo, /* pLineTo */
|
|
||||||
NULL, /* pMoveTo */
|
|
||||||
NULL, /* pOffsetClipRgn */
|
|
||||||
NULL, /* pOffsetViewportOrg (optional) */
|
|
||||||
NULL, /* pOffsetWindowOrg (optional) */
|
|
||||||
NULL, /* pPaintRgn */
|
|
||||||
PSDRV_PatBlt, /* pPatBlt */
|
|
||||||
PSDRV_Pie, /* pPie */
|
|
||||||
NULL, /* pPolyBezier */
|
|
||||||
NULL, /* pPolyBezierTo */
|
|
||||||
NULL, /* pPolyDraw */
|
|
||||||
PSDRV_PolyPolygon, /* pPolyPolygon */
|
|
||||||
PSDRV_PolyPolyline, /* pPolyPolyline */
|
|
||||||
PSDRV_Polygon, /* pPolygon */
|
|
||||||
PSDRV_Polyline, /* pPolyline */
|
|
||||||
NULL, /* pPolylineTo */
|
|
||||||
NULL, /* pRealizePalette */
|
|
||||||
PSDRV_Rectangle, /* pRectangle */
|
|
||||||
NULL, /* pRestoreDC */
|
|
||||||
PSDRV_RoundRect, /* pRoundRect */
|
|
||||||
NULL, /* pSaveDC */
|
|
||||||
NULL, /* pScaleViewportExt (optional) */
|
|
||||||
NULL, /* pScaleWindowExt (optional) */
|
|
||||||
NULL, /* pSelectClipPath */
|
|
||||||
NULL, /* pSelectClipRgn */
|
|
||||||
PSDRV_SelectObject, /* pSelectObject */
|
|
||||||
NULL, /* pSelectPalette */
|
|
||||||
PSDRV_SetBkColor, /* pSetBkColor */
|
|
||||||
NULL, /* pSetBkMode */
|
|
||||||
PSDRV_SetDeviceClipping, /* pSetDeviceClipping */
|
|
||||||
NULL, /* pSetDeviceGammaRamp */
|
|
||||||
NULL, /* pSetDIBitsToDevice */
|
|
||||||
NULL, /* pSetMapMode (optional) */
|
|
||||||
NULL, /* pSetMapperFlags */
|
|
||||||
PSDRV_SetPixel, /* pSetPixel */
|
|
||||||
NULL, /* pSetPixelFormat */
|
|
||||||
NULL, /* pSetPolyFillMode */
|
|
||||||
NULL, /* pSetROP2 */
|
|
||||||
NULL, /* pSetRelAbs */
|
|
||||||
NULL, /* pSetStretchBltMode */
|
|
||||||
NULL, /* pSetTextAlign */
|
|
||||||
NULL, /* pSetTextCharacterExtra */
|
|
||||||
PSDRV_SetTextColor, /* pSetTextColor */
|
|
||||||
NULL, /* pSetTextJustification */
|
|
||||||
NULL, /* pSetViewportExt (optional) */
|
|
||||||
NULL, /* pSetViewportOrg (optional) */
|
|
||||||
NULL, /* pSetWindowExt (optional) */
|
|
||||||
NULL, /* pSetWindowOrg (optional) */
|
|
||||||
PSDRV_StartDoc, /* pStartDoc */
|
|
||||||
PSDRV_StartPage, /* pStartPage */
|
|
||||||
NULL, /* pStretchBlt */
|
|
||||||
PSDRV_StretchDIBits, /* pStretchDIBits */
|
|
||||||
NULL, /* pStrokeAndFillPath */
|
|
||||||
NULL, /* pStrokePath */
|
|
||||||
NULL, /* pSwapBuffers */
|
|
||||||
NULL /* pWidenPath */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Default entries for devcaps */
|
/* Default entries for devcaps */
|
||||||
|
|
||||||
static DeviceCaps PSDRV_DevCaps = {
|
static DeviceCaps PSDRV_DevCaps = {
|
||||||
|
@ -258,38 +152,12 @@ BOOL WINAPI PSDRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
||||||
HeapDestroy(PSDRV_Heap);
|
HeapDestroy(PSDRV_Heap);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register driver as "WINEPS", "WINEPS.DLL" and "WINEPS.DRV"
|
|
||||||
to allow an easy configuring for users */
|
|
||||||
|
|
||||||
if (DRIVER_RegisterDriver("WINEPS", &PSDRV_Funcs) == FALSE) {
|
|
||||||
HeapDestroy(PSDRV_Heap);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DRIVER_RegisterDriver("WINEPS.DLL", &PSDRV_Funcs) == FALSE) {
|
|
||||||
DRIVER_UnregisterDriver("WINEPS");
|
|
||||||
HeapDestroy(PSDRV_Heap);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DRIVER_RegisterDriver("WINEPS.DRV", &PSDRV_Funcs) == FALSE) {
|
|
||||||
DRIVER_UnregisterDriver("WINEPS");
|
|
||||||
DRIVER_UnregisterDriver("WINEPS.DLL");
|
|
||||||
HeapDestroy(PSDRV_Heap);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
|
|
||||||
DeleteObject( PSDRV_DefaultFont );
|
DeleteObject( PSDRV_DefaultFont );
|
||||||
HeapDestroy( PSDRV_Heap );
|
HeapDestroy( PSDRV_Heap );
|
||||||
DRIVER_UnregisterDriver( "WINEPS" );
|
|
||||||
DRIVER_UnregisterDriver( "WINEPS.DLL" );
|
|
||||||
DRIVER_UnregisterDriver( "WINEPS.DRV" );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +168,7 @@ BOOL WINAPI PSDRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* PSDRV_CreateDC
|
* PSDRV_CreateDC
|
||||||
*/
|
*/
|
||||||
static BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
||||||
LPCSTR output, const DEVMODEA* initData )
|
LPCSTR output, const DEVMODEA* initData )
|
||||||
{
|
{
|
||||||
PSDRV_PDEVICE *physDev;
|
PSDRV_PDEVICE *physDev;
|
||||||
|
@ -437,7 +305,7 @@ static BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* PSDRV_DeleteDC
|
* PSDRV_DeleteDC
|
||||||
*/
|
*/
|
||||||
static BOOL PSDRV_DeleteDC( DC *dc )
|
BOOL PSDRV_DeleteDC( DC *dc )
|
||||||
{
|
{
|
||||||
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
|
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,38 @@ import kernel32.dll
|
||||||
import ntdll.dll
|
import ntdll.dll
|
||||||
|
|
||||||
debug_channels (psdrv)
|
debug_channels (psdrv)
|
||||||
|
|
||||||
|
# GDI driver
|
||||||
|
|
||||||
|
@ cdecl Arc(ptr long long long long long long long long) PSDRV_Arc
|
||||||
|
@ cdecl Chord(ptr long long long long long long long long) PSDRV_Chord
|
||||||
|
@ cdecl CreateDC(ptr str str str ptr) PSDRV_CreateDC
|
||||||
|
@ cdecl DeleteDC(ptr) PSDRV_DeleteDC
|
||||||
|
@ cdecl DeviceCapabilities(ptr ptr ptr long ptr ptr) PSDRV_DeviceCapabilities
|
||||||
|
@ cdecl Ellipse(ptr long long long long) PSDRV_Ellipse
|
||||||
|
@ cdecl EndDoc(ptr) PSDRV_EndDoc
|
||||||
|
@ cdecl EndPage(ptr) PSDRV_EndPage
|
||||||
|
@ cdecl EnumDeviceFonts(long ptr ptr long) PSDRV_EnumDeviceFonts
|
||||||
|
@ cdecl Escape(ptr long long long long) PSDRV_Escape
|
||||||
|
@ cdecl ExtDeviceMode(ptr long ptr ptr ptr ptr ptr long) PSDRV_ExtDeviceMode
|
||||||
|
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) PSDRV_ExtTextOut
|
||||||
|
@ cdecl GetCharWidth(ptr long long ptr) PSDRV_GetCharWidth
|
||||||
|
@ cdecl GetTextExtentPoint(ptr ptr long ptr) PSDRV_GetTextExtentPoint
|
||||||
|
@ cdecl GetTextMetrics(ptr ptr) PSDRV_GetTextMetrics
|
||||||
|
@ cdecl LineTo(ptr long long) PSDRV_LineTo
|
||||||
|
@ cdecl PatBlt(ptr long long long long long) PSDRV_PatBlt
|
||||||
|
@ cdecl Pie(ptr long long long long long long long long) PSDRV_Pie
|
||||||
|
@ cdecl PolyPolygon(ptr ptr ptr long) PSDRV_PolyPolygon
|
||||||
|
@ cdecl PolyPolyline(ptr ptr ptr long) PSDRV_PolyPolyline
|
||||||
|
@ cdecl Polygon(ptr ptr long) PSDRV_Polygon
|
||||||
|
@ cdecl Polyline(ptr ptr long) PSDRV_Polyline
|
||||||
|
@ cdecl Rectangle(ptr long long long long) PSDRV_Rectangle
|
||||||
|
@ cdecl RoundRect(ptr long long long long long long) PSDRV_RoundRect
|
||||||
|
@ cdecl SelectObject(ptr long) PSDRV_SelectObject
|
||||||
|
@ cdecl SetBkColor(ptr long) PSDRV_SetBkColor
|
||||||
|
@ cdecl SetDeviceClipping(ptr) PSDRV_SetDeviceClipping
|
||||||
|
@ cdecl SetPixel(ptr long long long) PSDRV_SetPixel
|
||||||
|
@ cdecl SetTextColor(ptr long) PSDRV_SetTextColor
|
||||||
|
@ cdecl StartDoc(ptr ptr) PSDRV_StartDoc
|
||||||
|
@ cdecl StartPage(ptr) PSDRV_StartPage
|
||||||
|
@ cdecl StretchDIBits(ptr long long long long long long long long ptr ptr long long) PSDRV_StretchDIBits
|
||||||
|
|
|
@ -11,6 +11,52 @@ import ntdll.dll
|
||||||
debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
|
debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
|
||||||
key keyboard opengl palette text win x11drv)
|
key keyboard opengl palette text win x11drv)
|
||||||
|
|
||||||
|
# GDI driver
|
||||||
|
|
||||||
|
@ cdecl Arc(ptr long long long long long long long long) X11DRV_Arc
|
||||||
|
@ cdecl BitBlt(ptr long long long long ptr long long long) X11DRV_BitBlt
|
||||||
|
@ cdecl BitmapBits(long ptr long long) X11DRV_BitmapBits
|
||||||
|
@ cdecl ChoosePixelFormat(ptr ptr) X11DRV_ChoosePixelFormat
|
||||||
|
@ cdecl Chord(ptr long long long long long long long long) X11DRV_Chord
|
||||||
|
@ cdecl CreateBitmap(long) X11DRV_CreateBitmap
|
||||||
|
@ cdecl CreateDC(ptr str str str ptr) X11DRV_CreateDC
|
||||||
|
@ cdecl CreateDIBSection(ptr ptr long ptr long long long) X11DRV_DIB_CreateDIBSection
|
||||||
|
@ cdecl DeleteDC(ptr) X11DRV_DeleteDC
|
||||||
|
@ cdecl DeleteObject(long) X11DRV_DeleteObject
|
||||||
|
@ cdecl DescribePixelFormat(ptr long long ptr) X11DRV_DescribePixelFormat
|
||||||
|
@ cdecl Ellipse(ptr long long long long) X11DRV_Ellipse
|
||||||
|
@ cdecl EnumDeviceFonts(long ptr ptr long) X11DRV_EnumDeviceFonts
|
||||||
|
@ cdecl Escape(ptr long long long long) X11DRV_Escape
|
||||||
|
@ cdecl ExtFloodFill(ptr long long long long) X11DRV_ExtFloodFill
|
||||||
|
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) X11DRV_ExtTextOut
|
||||||
|
@ cdecl GetCharWidth(ptr long long ptr) X11DRV_GetCharWidth
|
||||||
|
@ cdecl GetDCOrgEx(ptr ptr) X11DRV_GetDCOrgEx
|
||||||
|
@ cdecl GetDeviceGammaRamp(ptr ptr) X11DRV_GetDeviceGammaRamp
|
||||||
|
@ cdecl GetPixel(ptr long long) X11DRV_GetPixel
|
||||||
|
@ cdecl GetPixelFormat(ptr) X11DRV_GetPixelFormat
|
||||||
|
@ cdecl GetTextExtentPoint(ptr ptr long ptr) X11DRV_GetTextExtentPoint
|
||||||
|
@ cdecl GetTextMetrics(ptr ptr) X11DRV_GetTextMetrics
|
||||||
|
@ cdecl LineTo(ptr long long) X11DRV_LineTo
|
||||||
|
@ cdecl PaintRgn(ptr long) X11DRV_PaintRgn
|
||||||
|
@ cdecl PatBlt(ptr long long long long long) X11DRV_PatBlt
|
||||||
|
@ cdecl Pie(ptr long long long long long long long long) X11DRV_Pie
|
||||||
|
@ cdecl PolyPolygon(ptr ptr ptr long) X11DRV_PolyPolygon
|
||||||
|
@ cdecl PolyPolyline(ptr ptr ptr long) X11DRV_PolyPolyline
|
||||||
|
@ cdecl Polygon(ptr ptr long) X11DRV_Polygon
|
||||||
|
@ cdecl Polyline(ptr ptr long) X11DRV_Polyline
|
||||||
|
@ cdecl Rectangle(ptr long long long long) X11DRV_Rectangle
|
||||||
|
@ cdecl RoundRect(ptr long long long long long long) X11DRV_RoundRect
|
||||||
|
@ cdecl SelectObject(ptr long) X11DRV_SelectObject
|
||||||
|
@ cdecl SetBkColor(ptr long) X11DRV_SetBkColor
|
||||||
|
@ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) X11DRV_SetDIBitsToDevice
|
||||||
|
@ cdecl SetDeviceClipping(ptr) X11DRV_SetDeviceClipping
|
||||||
|
@ cdecl SetDeviceGammaRamp(ptr ptr) X11DRV_SetDeviceGammaRamp
|
||||||
|
@ cdecl SetPixel(ptr long long long) X11DRV_SetPixel
|
||||||
|
@ cdecl SetPixelFormat(ptr long ptr) X11DRV_SetPixelFormat
|
||||||
|
@ cdecl SetTextColor(ptr long) X11DRV_SetTextColor
|
||||||
|
@ cdecl StretchBlt(ptr long long long long ptr long long long long long) X11DRV_StretchBlt
|
||||||
|
@ cdecl SwapBuffers(ptr) X11DRV_SwapBuffers
|
||||||
|
|
||||||
# USER driver
|
# USER driver
|
||||||
|
|
||||||
@ cdecl InitKeyboard() X11DRV_InitKeyboard
|
@ cdecl InitKeyboard() X11DRV_InitKeyboard
|
||||||
|
|
|
@ -8,7 +8,6 @@ MODULE = graphics
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
bitblt.c \
|
bitblt.c \
|
||||||
dispdib.c \
|
dispdib.c \
|
||||||
driver.c \
|
|
||||||
env.c \
|
env.c \
|
||||||
escape.c \
|
escape.c \
|
||||||
fontengine.c \
|
fontengine.c \
|
||||||
|
|
|
@ -1,233 +0,0 @@
|
||||||
/*
|
|
||||||
* Graphics driver management functions
|
|
||||||
*
|
|
||||||
* Copyright 1996 Alexandre Julliard
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "gdi.h"
|
|
||||||
#include "debugtools.h"
|
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(driver);
|
|
||||||
|
|
||||||
typedef struct tagGRAPHICS_DRIVER
|
|
||||||
{
|
|
||||||
struct tagGRAPHICS_DRIVER *next;
|
|
||||||
LPSTR name;
|
|
||||||
const DC_FUNCTIONS *funcs;
|
|
||||||
} GRAPHICS_DRIVER;
|
|
||||||
|
|
||||||
static GRAPHICS_DRIVER *firstDriver;
|
|
||||||
static GRAPHICS_DRIVER *genericDriver;
|
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* DRIVER_RegisterDriver
|
|
||||||
*/
|
|
||||||
BOOL DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs )
|
|
||||||
{
|
|
||||||
GRAPHICS_DRIVER *driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver) );
|
|
||||||
if (!driver) return FALSE;
|
|
||||||
driver->funcs = funcs;
|
|
||||||
if (name)
|
|
||||||
{
|
|
||||||
driver->name = HeapAlloc( GetProcessHeap(), 0, strlen(name)+1 );
|
|
||||||
driver->next = firstDriver;
|
|
||||||
strcpy( driver->name, name );
|
|
||||||
firstDriver = driver;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
/* No name -> it's the generic driver */
|
|
||||||
if (genericDriver)
|
|
||||||
{
|
|
||||||
WARN(" already a generic driver\n" );
|
|
||||||
HeapFree( GetProcessHeap(), 0, driver );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
driver->name = NULL;
|
|
||||||
genericDriver = driver;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* DRIVER_FindDriver
|
|
||||||
*/
|
|
||||||
const DC_FUNCTIONS *DRIVER_FindDriver( LPCSTR name )
|
|
||||||
{
|
|
||||||
GRAPHICS_DRIVER *driver;
|
|
||||||
HINSTANCE hDriver;
|
|
||||||
|
|
||||||
TRACE(": %s\n", name);
|
|
||||||
|
|
||||||
if (!name) return genericDriver ? genericDriver->funcs : NULL;
|
|
||||||
|
|
||||||
for (driver = firstDriver; driver; driver = driver->next)
|
|
||||||
if (!strcasecmp( driver->name, name )) return driver->funcs;
|
|
||||||
|
|
||||||
if (!(hDriver = LoadLibraryA (name))) return NULL;
|
|
||||||
|
|
||||||
for (driver = firstDriver; driver; driver = driver->next)
|
|
||||||
if (!strcasecmp( driver->name, name )) return driver->funcs;
|
|
||||||
|
|
||||||
FreeLibrary (hDriver);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* DRIVER_UnregisterDriver
|
|
||||||
*/
|
|
||||||
BOOL DRIVER_UnregisterDriver( LPCSTR name )
|
|
||||||
{
|
|
||||||
if (name)
|
|
||||||
{
|
|
||||||
GRAPHICS_DRIVER **ppDriver = &firstDriver;
|
|
||||||
while (*ppDriver)
|
|
||||||
{
|
|
||||||
if (!strcasecmp( (*ppDriver)->name, name ))
|
|
||||||
{
|
|
||||||
GRAPHICS_DRIVER *driver = *ppDriver;
|
|
||||||
(*ppDriver) = driver->next;
|
|
||||||
HeapFree( GetProcessHeap(), 0, driver->name );
|
|
||||||
HeapFree( GetProcessHeap(), 0, driver );
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
ppDriver = &(*ppDriver)->next;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!genericDriver) return FALSE;
|
|
||||||
HeapFree( GetProcessHeap(), 0, genericDriver );
|
|
||||||
genericDriver = NULL;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* DRIVER_GetDriverName
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
BOOL DRIVER_GetDriverName( LPCSTR device, LPSTR driver, DWORD size )
|
|
||||||
{
|
|
||||||
char *p;
|
|
||||||
size = GetProfileStringA("devices", device, "", driver, size);
|
|
||||||
if(!size) {
|
|
||||||
WARN("Unable to find '%s' in [devices] section of win.ini\n", device);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
p = strchr(driver, ',');
|
|
||||||
if(!p) {
|
|
||||||
WARN("'%s' entry in [devices] section of win.ini is malformed.\n",
|
|
||||||
device);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
*p = '\0';
|
|
||||||
TRACE("Found '%s' for '%s'\n", driver, device);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* @ [GDI32.100]
|
|
||||||
*
|
|
||||||
* This should thunk to 16-bit and simply call the proc with the given args.
|
|
||||||
*/
|
|
||||||
INT WINAPI GDI_CallDevInstall16( FARPROC16 lpfnDevInstallProc, HWND hWnd,
|
|
||||||
LPSTR lpModelName, LPSTR OldPort, LPSTR NewPort )
|
|
||||||
{
|
|
||||||
FIXME("(%p, %04x, %s, %s, %s)\n",
|
|
||||||
lpfnDevInstallProc, hWnd, lpModelName, OldPort, NewPort );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* @ [GDI32.101]
|
|
||||||
*
|
|
||||||
* This should load the correct driver for lpszDevice and calls this driver's
|
|
||||||
* ExtDeviceModePropSheet proc.
|
|
||||||
*
|
|
||||||
* Note: The driver calls a callback routine for each property sheet page; these
|
|
||||||
* pages are supposed to be filled into the structure pointed to by lpPropSheet.
|
|
||||||
* The layout of this structure is:
|
|
||||||
*
|
|
||||||
* struct
|
|
||||||
* {
|
|
||||||
* DWORD nPages;
|
|
||||||
* DWORD unknown;
|
|
||||||
* HPROPSHEETPAGE pages[10];
|
|
||||||
* };
|
|
||||||
*/
|
|
||||||
INT WINAPI GDI_CallExtDeviceModePropSheet16( HWND hWnd, LPCSTR lpszDevice,
|
|
||||||
LPCSTR lpszPort, LPVOID lpPropSheet )
|
|
||||||
{
|
|
||||||
FIXME("(%04x, %s, %s, %p)\n",
|
|
||||||
hWnd, lpszDevice, lpszPort, lpPropSheet );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* @ [GDI32.102]
|
|
||||||
*
|
|
||||||
* This should load the correct driver for lpszDevice and calls this driver's
|
|
||||||
* ExtDeviceMode proc.
|
|
||||||
*/
|
|
||||||
INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd,
|
|
||||||
LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
|
|
||||||
LPSTR lpszPort, LPDEVMODEA lpdmInput,
|
|
||||||
LPSTR lpszProfile, DWORD fwMode )
|
|
||||||
{
|
|
||||||
char buf[300];
|
|
||||||
const DC_FUNCTIONS *funcs;
|
|
||||||
|
|
||||||
TRACE("(%04x, %p, %s, %s, %p, %s, %ld)\n",
|
|
||||||
hwnd, lpdmOutput, lpszDevice, lpszPort,
|
|
||||||
lpdmInput, lpszProfile, fwMode );
|
|
||||||
|
|
||||||
if(!DRIVER_GetDriverName( lpszDevice, buf, sizeof(buf) )) return -1;
|
|
||||||
funcs = DRIVER_FindDriver( buf );
|
|
||||||
if(!funcs || !funcs->pExtDeviceMode) return -1;
|
|
||||||
return funcs->pExtDeviceMode(buf, hwnd, lpdmOutput, lpszDevice, lpszPort,
|
|
||||||
lpdmInput, lpszProfile, fwMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* @ [GDI32.103]
|
|
||||||
*
|
|
||||||
* This should load the correct driver for lpszDevice and calls this driver's
|
|
||||||
* AdvancedSetupDialog proc.
|
|
||||||
*/
|
|
||||||
INT WINAPI GDI_CallAdvancedSetupDialog16( HWND hwnd, LPSTR lpszDevice,
|
|
||||||
LPDEVMODEA devin, LPDEVMODEA devout )
|
|
||||||
{
|
|
||||||
TRACE("(%04x, %s, %p, %p)\n",
|
|
||||||
hwnd, lpszDevice, devin, devout );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* @ [GDI32.104]
|
|
||||||
*
|
|
||||||
* This should load the correct driver for lpszDevice and calls this driver's
|
|
||||||
* DeviceCapabilities proc.
|
|
||||||
*/
|
|
||||||
DWORD WINAPI GDI_CallDeviceCapabilities16( LPCSTR lpszDevice, LPCSTR lpszPort,
|
|
||||||
WORD fwCapability, LPSTR lpszOutput,
|
|
||||||
LPDEVMODEA lpdm )
|
|
||||||
{
|
|
||||||
char buf[300];
|
|
||||||
const DC_FUNCTIONS *funcs;
|
|
||||||
|
|
||||||
TRACE("(%s, %s, %d, %p, %p)\n",
|
|
||||||
lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm );
|
|
||||||
|
|
||||||
|
|
||||||
if(!DRIVER_GetDriverName( lpszDevice, buf, sizeof(buf) )) return -1;
|
|
||||||
funcs = DRIVER_FindDriver( buf );
|
|
||||||
if(!funcs || !funcs->pDeviceCapabilities) return -1;
|
|
||||||
return funcs->pDeviceCapabilities( buf, lpszDevice, lpszPort,
|
|
||||||
fwCapability, lpszOutput, lpdm);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -144,17 +144,16 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* FIXME: this no longer works */
|
||||||
|
#if 0
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* WIN16DRV_Init
|
* WIN16DRV_Init
|
||||||
*/
|
*/
|
||||||
BOOL WIN16DRV_Init(void)
|
BOOL WIN16DRV_Init(void)
|
||||||
{
|
{
|
||||||
return DRIVER_RegisterDriver( NULL /* generic driver */, &WIN16DRV_Funcs );
|
return DRIVER_RegisterDriver( NULL /* generic driver */, &WIN16DRV_Funcs );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Tempory functions, for initialising structures */
|
/* Tempory functions, for initialising structures */
|
||||||
/* These values should be calculated, not hardcoded */
|
/* These values should be calculated, not hardcoded */
|
||||||
|
|
|
@ -25,6 +25,7 @@ DEFAULT_DEBUG_CHANNEL(x11drv);
|
||||||
/* GCs used for B&W and color bitmap operations */
|
/* GCs used for B&W and color bitmap operations */
|
||||||
GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
|
GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
|
||||||
|
|
||||||
|
extern const DC_FUNCTIONS *X11DRV_DC_Funcs; /* hack */
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* X11DRV_BITMAP_Init
|
* X11DRV_BITMAP_Init
|
||||||
|
@ -157,7 +158,7 @@ BOOL X11DRV_CreateBitmap( HBITMAP hbitmap )
|
||||||
GDI_ReleaseObj( hbitmap );
|
GDI_ReleaseObj( hbitmap );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
bmp->funcs = &X11DRV_DC_Funcs;
|
bmp->funcs = X11DRV_DC_Funcs;
|
||||||
|
|
||||||
if (bmp->bitmap.bmBits) /* Set bitmap bits */
|
if (bmp->bitmap.bmBits) /* Set bitmap bits */
|
||||||
X11DRV_BitmapBits( hbitmap, bmp->bitmap.bmBits,
|
X11DRV_BitmapBits( hbitmap, bmp->bitmap.bmBits,
|
||||||
|
@ -480,7 +481,7 @@ HBITMAP X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap)
|
||||||
|
|
||||||
pBmp = (BITMAPOBJ *)GDI_GetObjPtr( hBmp, BITMAP_MAGIC );
|
pBmp = (BITMAPOBJ *)GDI_GetObjPtr( hBmp, BITMAP_MAGIC );
|
||||||
|
|
||||||
pBmp->funcs = &X11DRV_DC_Funcs;
|
pBmp->funcs = X11DRV_DC_Funcs;
|
||||||
pBmp->physBitmap = (void *)pixmap;
|
pBmp->physBitmap = (void *)pixmap;
|
||||||
GDI_ReleaseObj( hBmp );
|
GDI_ReleaseObj( hBmp );
|
||||||
|
|
||||||
|
|
|
@ -19,113 +19,7 @@
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(x11drv);
|
DEFAULT_DEBUG_CHANNEL(x11drv);
|
||||||
|
|
||||||
static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
const DC_FUNCTIONS *X11DRV_DC_Funcs = NULL; /* hack */
|
||||||
LPCSTR output, const DEVMODEA* initData );
|
|
||||||
static BOOL X11DRV_DeleteDC( DC *dc );
|
|
||||||
|
|
||||||
static INT X11DRV_Escape( DC *dc, INT nEscape, INT cbInput,
|
|
||||||
SEGPTR lpInData, SEGPTR lpOutData );
|
|
||||||
|
|
||||||
const DC_FUNCTIONS X11DRV_DC_Funcs =
|
|
||||||
{
|
|
||||||
NULL, /* pAbortDoc */
|
|
||||||
NULL, /* pAbortPath */
|
|
||||||
NULL, /* pAngleArc */
|
|
||||||
X11DRV_Arc, /* pArc */
|
|
||||||
NULL, /* pArcTo */
|
|
||||||
NULL, /* pBeginPath */
|
|
||||||
X11DRV_BitBlt, /* pBitBlt */
|
|
||||||
X11DRV_BitmapBits, /* pBitmapBits */
|
|
||||||
X11DRV_ChoosePixelFormat, /* pChoosePixelFormat */
|
|
||||||
X11DRV_Chord, /* pChord */
|
|
||||||
NULL, /* pCloseFigure */
|
|
||||||
X11DRV_CreateBitmap, /* pCreateBitmap */
|
|
||||||
X11DRV_CreateDC, /* pCreateDC */
|
|
||||||
X11DRV_DIB_CreateDIBSection, /* pCreateDIBSection */
|
|
||||||
X11DRV_DeleteDC, /* pDeleteDC */
|
|
||||||
X11DRV_DeleteObject, /* pDeleteObject */
|
|
||||||
X11DRV_DescribePixelFormat, /* pDescribePixelFormat */
|
|
||||||
NULL, /* pDeviceCapabilities */
|
|
||||||
X11DRV_Ellipse, /* pEllipse */
|
|
||||||
NULL, /* pEndDoc */
|
|
||||||
NULL, /* pEndPage */
|
|
||||||
NULL, /* pEndPath */
|
|
||||||
X11DRV_EnumDeviceFonts, /* pEnumDeviceFonts */
|
|
||||||
X11DRV_Escape, /* pEscape */
|
|
||||||
NULL, /* pExcludeClipRect */
|
|
||||||
NULL, /* pExtDeviceMode */
|
|
||||||
X11DRV_ExtFloodFill, /* pExtFloodFill */
|
|
||||||
X11DRV_ExtTextOut, /* pExtTextOut */
|
|
||||||
NULL, /* pFillPath */
|
|
||||||
NULL, /* pFillRgn */
|
|
||||||
NULL, /* pFlattenPath */
|
|
||||||
NULL, /* pFrameRgn */
|
|
||||||
X11DRV_GetCharWidth, /* pGetCharWidth */
|
|
||||||
X11DRV_GetDCOrgEx, /* pGetDCOrgEx */
|
|
||||||
X11DRV_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */
|
|
||||||
X11DRV_GetPixel, /* pGetPixel */
|
|
||||||
X11DRV_GetPixelFormat, /* pGetPixelFormat */
|
|
||||||
X11DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
|
|
||||||
X11DRV_GetTextMetrics, /* pGetTextMetrics */
|
|
||||||
NULL, /* pIntersectClipRect */
|
|
||||||
NULL, /* pInvertRgn */
|
|
||||||
X11DRV_LineTo, /* pLineTo */
|
|
||||||
NULL, /* pMoveTo */
|
|
||||||
NULL, /* pOffsetClipRgn */
|
|
||||||
NULL, /* pOffsetViewportOrg (optional) */
|
|
||||||
NULL, /* pOffsetWindowOrg (optional) */
|
|
||||||
X11DRV_PaintRgn, /* pPaintRgn */
|
|
||||||
X11DRV_PatBlt, /* pPatBlt */
|
|
||||||
X11DRV_Pie, /* pPie */
|
|
||||||
NULL, /* pPolyBezier */
|
|
||||||
NULL, /* pPolyBezierTo */
|
|
||||||
NULL, /* pPolyDraw */
|
|
||||||
X11DRV_PolyPolygon, /* pPolyPolygon */
|
|
||||||
X11DRV_PolyPolyline, /* pPolyPolyline */
|
|
||||||
X11DRV_Polygon, /* pPolygon */
|
|
||||||
X11DRV_Polyline, /* pPolyline */
|
|
||||||
NULL, /* pPolylineTo */
|
|
||||||
NULL, /* pRealizePalette */
|
|
||||||
X11DRV_Rectangle, /* pRectangle */
|
|
||||||
NULL, /* pRestoreDC */
|
|
||||||
X11DRV_RoundRect, /* pRoundRect */
|
|
||||||
NULL, /* pSaveDC */
|
|
||||||
NULL, /* pScaleViewportExt (optional) */
|
|
||||||
NULL, /* pScaleWindowExt (optional) */
|
|
||||||
NULL, /* pSelectClipPath */
|
|
||||||
NULL, /* pSelectClipRgn */
|
|
||||||
X11DRV_SelectObject, /* pSelectObject */
|
|
||||||
NULL, /* pSelectPalette */
|
|
||||||
X11DRV_SetBkColor, /* pSetBkColor */
|
|
||||||
NULL, /* pSetBkMode */
|
|
||||||
X11DRV_SetDeviceClipping, /* pSetDeviceClipping */
|
|
||||||
X11DRV_SetDeviceGammaRamp, /* pSetDeviceGammaRamp */
|
|
||||||
X11DRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
|
|
||||||
NULL, /* pSetMapMode (optional) */
|
|
||||||
NULL, /* pSetMapperFlags */
|
|
||||||
X11DRV_SetPixel, /* pSetPixel */
|
|
||||||
X11DRV_SetPixelFormat, /* pSetPixelFormat */
|
|
||||||
NULL, /* pSetPolyFillMode */
|
|
||||||
NULL, /* pSetROP2 */
|
|
||||||
NULL, /* pSetRelAbs */
|
|
||||||
NULL, /* pSetStretchBltMode */
|
|
||||||
NULL, /* pSetTextAlign */
|
|
||||||
NULL, /* pSetTextCharacterExtra */
|
|
||||||
X11DRV_SetTextColor, /* pSetTextColor */
|
|
||||||
NULL, /* pSetTextJustification */
|
|
||||||
NULL, /* pSetViewportExt (optional) */
|
|
||||||
NULL, /* pSetViewportOrg (optional) */
|
|
||||||
NULL, /* pSetWindowExt (optional) */
|
|
||||||
NULL, /* pSetWindowOrg (optional) */
|
|
||||||
NULL, /* pStartDoc */
|
|
||||||
NULL, /* pStartPage */
|
|
||||||
X11DRV_StretchBlt, /* pStretchBlt */
|
|
||||||
NULL, /* pStretchDIBits */
|
|
||||||
NULL, /* pStrokeAndFillPath */
|
|
||||||
NULL, /* pStrokePath */
|
|
||||||
X11DRV_SwapBuffers, /* pSwapBuffers */
|
|
||||||
NULL /* pWidenPath */
|
|
||||||
};
|
|
||||||
|
|
||||||
BITMAP_DRIVER X11DRV_BITMAP_Driver =
|
BITMAP_DRIVER X11DRV_BITMAP_Driver =
|
||||||
{
|
{
|
||||||
|
@ -214,9 +108,7 @@ BOOL X11DRV_GDI_Initialize( Display *display )
|
||||||
|
|
||||||
/* Initialize fonts and text caps */
|
/* Initialize fonts and text caps */
|
||||||
|
|
||||||
if (!X11DRV_FONT_Init( &X11DRV_DevCaps )) return FALSE;
|
return X11DRV_FONT_Init( &X11DRV_DevCaps );
|
||||||
|
|
||||||
return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_DC_Funcs );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
@ -232,11 +124,13 @@ void X11DRV_GDI_Finalize(void)
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* X11DRV_CreateDC
|
* X11DRV_CreateDC
|
||||||
*/
|
*/
|
||||||
static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
||||||
LPCSTR output, const DEVMODEA* initData )
|
LPCSTR output, const DEVMODEA* initData )
|
||||||
{
|
{
|
||||||
X11DRV_PDEVICE *physDev;
|
X11DRV_PDEVICE *physDev;
|
||||||
|
|
||||||
|
if (!X11DRV_DC_Funcs) X11DRV_DC_Funcs = dc->funcs; /* hack */
|
||||||
|
|
||||||
dc->physDev = physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
dc->physDev = physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
sizeof(*physDev) );
|
sizeof(*physDev) );
|
||||||
if(!physDev) {
|
if(!physDev) {
|
||||||
|
@ -296,7 +190,7 @@ static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* X11DRV_DeleteDC
|
* X11DRV_DeleteDC
|
||||||
*/
|
*/
|
||||||
static BOOL X11DRV_DeleteDC( DC *dc )
|
BOOL X11DRV_DeleteDC( DC *dc )
|
||||||
{
|
{
|
||||||
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
|
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
|
@ -312,8 +206,7 @@ static BOOL X11DRV_DeleteDC( DC *dc )
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* X11DRV_Escape
|
* X11DRV_Escape
|
||||||
*/
|
*/
|
||||||
static INT X11DRV_Escape( DC *dc, INT nEscape, INT cbInput,
|
INT X11DRV_Escape( DC *dc, INT nEscape, INT cbInput, SEGPTR lpInData, SEGPTR lpOutData )
|
||||||
SEGPTR lpInData, SEGPTR lpOutData )
|
|
||||||
{
|
{
|
||||||
switch( nEscape )
|
switch( nEscape )
|
||||||
{
|
{
|
||||||
|
|
|
@ -181,6 +181,7 @@ static XpmColorSymbol OBM_BlackAndWhite[2] =
|
||||||
};
|
};
|
||||||
#endif /* defined(HAVE_LIBXXPM) */
|
#endif /* defined(HAVE_LIBXXPM) */
|
||||||
|
|
||||||
|
extern const DC_FUNCTIONS *X11DRV_DC_Funcs; /* hack */
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -232,7 +233,7 @@ static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
|
||||||
bmpObjPtr->bitmap.bmBits = NULL;
|
bmpObjPtr->bitmap.bmBits = NULL;
|
||||||
bmpObjPtr->dib = NULL;
|
bmpObjPtr->dib = NULL;
|
||||||
|
|
||||||
bmpObjPtr->funcs = &X11DRV_DC_Funcs;
|
bmpObjPtr->funcs = X11DRV_DC_Funcs;
|
||||||
bmpObjPtr->physBitmap = (void *)pixmap;
|
bmpObjPtr->physBitmap = (void *)pixmap;
|
||||||
|
|
||||||
GDI_ReleaseObj( hbitmap );
|
GDI_ReleaseObj( hbitmap );
|
||||||
|
|
|
@ -564,9 +564,9 @@ extern BOOL GDI_FreeObject( HGDIOBJ, void *obj );
|
||||||
extern void *GDI_GetObjPtr( HGDIOBJ, WORD );
|
extern void *GDI_GetObjPtr( HGDIOBJ, WORD );
|
||||||
extern void GDI_ReleaseObj( HGDIOBJ );
|
extern void GDI_ReleaseObj( HGDIOBJ );
|
||||||
|
|
||||||
extern BOOL DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs );
|
extern const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name );
|
||||||
extern const DC_FUNCTIONS *DRIVER_FindDriver( LPCSTR name );
|
extern const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs );
|
||||||
extern BOOL DRIVER_UnregisterDriver( LPCSTR name );
|
extern void DRIVER_release_driver( const DC_FUNCTIONS *funcs );
|
||||||
extern BOOL DRIVER_GetDriverName( LPCSTR device, LPSTR driver, DWORD size );
|
extern BOOL DRIVER_GetDriverName( LPCSTR device, LPSTR driver, DWORD size );
|
||||||
|
|
||||||
extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut );
|
extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut );
|
||||||
|
|
|
@ -87,8 +87,6 @@ extern unsigned int X11DRV_server_startticks;
|
||||||
|
|
||||||
/* Wine driver X11 functions */
|
/* Wine driver X11 functions */
|
||||||
|
|
||||||
extern const DC_FUNCTIONS X11DRV_DC_Funcs;
|
|
||||||
|
|
||||||
extern BOOL X11DRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst,
|
extern BOOL X11DRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst,
|
||||||
INT width, INT height, struct tagDC *dcSrc,
|
INT width, INT height, struct tagDC *dcSrc,
|
||||||
INT xSrc, INT ySrc, DWORD rop );
|
INT xSrc, INT ySrc, DWORD rop );
|
||||||
|
|
30
objects/dc.c
30
objects/dc.c
|
@ -557,8 +557,17 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
|
||||||
if (!device || !DRIVER_GetDriverName( device, buf, sizeof(buf) ))
|
if (!device || !DRIVER_GetDriverName( device, buf, sizeof(buf) ))
|
||||||
strcpy(buf, driver);
|
strcpy(buf, driver);
|
||||||
|
|
||||||
if (!(funcs = DRIVER_FindDriver( buf ))) return 0;
|
if (!(funcs = DRIVER_load_driver( buf )))
|
||||||
if (!(dc = DC_AllocDC( funcs ))) return 0;
|
{
|
||||||
|
ERR( "no driver found for %s\n", buf );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!(dc = DC_AllocDC( funcs )))
|
||||||
|
{
|
||||||
|
DRIVER_release_driver( funcs );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
dc->flags = 0;
|
dc->flags = 0;
|
||||||
|
|
||||||
TRACE("(driver=%s, device=%s, output=%s): returning %04x\n",
|
TRACE("(driver=%s, device=%s, output=%s): returning %04x\n",
|
||||||
|
@ -569,6 +578,7 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
|
||||||
{
|
{
|
||||||
WARN("creation aborted by device\n" );
|
WARN("creation aborted by device\n" );
|
||||||
GDI_FreeObject( dc->hSelf, dc );
|
GDI_FreeObject( dc->hSelf, dc );
|
||||||
|
DRIVER_release_driver( funcs );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,15 +657,23 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
|
||||||
DC *dc, *origDC;
|
DC *dc, *origDC;
|
||||||
const DC_FUNCTIONS *funcs;
|
const DC_FUNCTIONS *funcs;
|
||||||
|
|
||||||
if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) funcs = origDC->funcs;
|
if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) funcs = DRIVER_get_driver(origDC->funcs);
|
||||||
else funcs = DRIVER_FindDriver( "DISPLAY" );
|
else funcs = DRIVER_load_driver( "DISPLAY" );
|
||||||
|
|
||||||
if (!funcs || !(dc = DC_AllocDC( funcs )))
|
if (!funcs)
|
||||||
{
|
{
|
||||||
if (origDC) GDI_ReleaseObj( hdc );
|
if (origDC) GDI_ReleaseObj( hdc );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(dc = DC_AllocDC( funcs )))
|
||||||
|
{
|
||||||
|
DRIVER_release_driver( funcs );
|
||||||
|
if (origDC) GDI_ReleaseObj( hdc );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TRACE("(%04x): returning %04x\n",
|
TRACE("(%04x): returning %04x\n",
|
||||||
hdc, dc->hSelf );
|
hdc, dc->hSelf );
|
||||||
|
|
||||||
|
@ -674,6 +692,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
|
||||||
{
|
{
|
||||||
WARN("creation aborted by device\n");
|
WARN("creation aborted by device\n");
|
||||||
GDI_FreeObject( dc->hSelf, dc );
|
GDI_FreeObject( dc->hSelf, dc );
|
||||||
|
DRIVER_release_driver( funcs );
|
||||||
if (origDC) GDI_ReleaseObj( hdc );
|
if (origDC) GDI_ReleaseObj( hdc );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -734,6 +753,7 @@ BOOL WINAPI DeleteDC( HDC hdc )
|
||||||
SelectObject( hdc, GetStockObject(WHITE_BRUSH) );
|
SelectObject( hdc, GetStockObject(WHITE_BRUSH) );
|
||||||
SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
|
SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
|
||||||
if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc);
|
if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc);
|
||||||
|
DRIVER_release_driver( dc->funcs );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
|
if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
|
||||||
|
|
Loading…
Reference in New Issue