Commit 3dd63eb2 authored by Alexandre Julliard's avatar Alexandre Julliard

Build the DC function table by using GetProcAddress on the graphics

driver module. Moved driver support to dlls/gdi.
parent e9dd63ef
......@@ -9,6 +9,7 @@ IMPORTS = kernel32 ntdll
C_SRCS = \
bidi16.c \
driver.c \
gdi_main.c \
printdrv.c \
thunk.c \
......
......@@ -17,14 +17,7 @@
BOOL WINAPI MAIN_GdiInit(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved)
{
if (reason != DLL_PROCESS_ATTACH) return TRUE;
/* GDI initialisation */
if(!GDI_Init()) return FALSE;
/* Create the Win16 printer driver */
if (!WIN16DRV_Init()) return FALSE;
return TRUE;
return GDI_Init();
}
......
......@@ -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_SetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count);
......@@ -31,7 +33,7 @@ TTYDRV_PHYSBITMAP *TTYDRV_DC_AllocBitmap(BITMAPOBJ *bitmap)
}
bitmap->physBitmap = physBitmap;
bitmap->funcs = DRIVER_FindDriver("DISPLAY");
bitmap->funcs = TTYDRV_DC_Funcs;
return physBitmap;
}
......
......@@ -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 =
{
TTYDRV_BITMAP_SetDIBits,
......@@ -162,6 +60,8 @@ DeviceCaps TTYDRV_DC_DevCaps = {
/* ..etc */ 0, 0
};
const DC_FUNCTIONS *TTYDRV_DC_Funcs = NULL; /* hack */
/**********************************************************************
* 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.logPixelsY = (int) (TTYDRV_DC_DevCaps.vertRes * 25.4 / TTYDRV_DC_DevCaps.vertSize);
if(!TTYDRV_PALETTE_Initialize())
return FALSE;
return DRIVER_RegisterDriver( "DISPLAY", &TTYDRV_DC_Driver );
return TTYDRV_PALETTE_Initialize();
}
/**********************************************************************
......@@ -210,6 +107,8 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
dc, debugstr_a(driver), debugstr_a(device),
debugstr_a(output), initData);
if (!TTYDRV_DC_Funcs) TTYDRV_DC_Funcs = dc->funcs; /* hack */
dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(TTYDRV_PDEVICE));
if(!dc->physDev) {
......
......@@ -9,6 +9,42 @@ import ntdll.dll
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
@ cdecl InitKeyboard() TTYDRV_InitKeyboard
......
......@@ -24,112 +24,6 @@
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 */
static DeviceCaps PSDRV_DevCaps = {
......@@ -258,38 +152,12 @@ BOOL WINAPI PSDRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
HeapDestroy(PSDRV_Heap);
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;
case DLL_PROCESS_DETACH:
DeleteObject( PSDRV_DefaultFont );
HeapDestroy( PSDRV_Heap );
DRIVER_UnregisterDriver( "WINEPS" );
DRIVER_UnregisterDriver( "WINEPS.DLL" );
DRIVER_UnregisterDriver( "WINEPS.DRV" );
break;
}
......@@ -300,8 +168,8 @@ BOOL WINAPI PSDRV_Init( HINSTANCE hinst, DWORD reason, LPVOID reserved )
/**********************************************************************
* PSDRV_CreateDC
*/
static BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODEA* initData )
BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODEA* initData )
{
PSDRV_PDEVICE *physDev;
PRINTERINFO *pi;
......@@ -437,7 +305,7 @@ static BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
/**********************************************************************
* PSDRV_DeleteDC
*/
static BOOL PSDRV_DeleteDC( DC *dc )
BOOL PSDRV_DeleteDC( DC *dc )
{
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
......
......@@ -11,3 +11,38 @@ import kernel32.dll
import ntdll.dll
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
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
@ cdecl InitKeyboard() X11DRV_InitKeyboard
......
......@@ -8,7 +8,6 @@ MODULE = graphics
C_SRCS = \
bitblt.c \
dispdib.c \
driver.c \
env.c \
escape.c \
fontengine.c \
......
/*
* 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
*/
BOOL WIN16DRV_Init(void)
{
return DRIVER_RegisterDriver( NULL /* generic driver */, &WIN16DRV_Funcs );
}
#endif
/* Tempory functions, for initialising structures */
/* These values should be calculated, not hardcoded */
......
......@@ -25,6 +25,7 @@ DEFAULT_DEBUG_CHANNEL(x11drv);
/* GCs used for B&W and color bitmap operations */
GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
extern const DC_FUNCTIONS *X11DRV_DC_Funcs; /* hack */
/***********************************************************************
* X11DRV_BITMAP_Init
......@@ -157,7 +158,7 @@ BOOL X11DRV_CreateBitmap( HBITMAP hbitmap )
GDI_ReleaseObj( hbitmap );
return FALSE;
}
bmp->funcs = &X11DRV_DC_Funcs;
bmp->funcs = X11DRV_DC_Funcs;
if (bmp->bitmap.bmBits) /* Set bitmap bits */
X11DRV_BitmapBits( hbitmap, bmp->bitmap.bmBits,
......@@ -480,7 +481,7 @@ HBITMAP X11DRV_BITMAP_CreateBitmapHeaderFromPixmap(Pixmap pixmap)
pBmp = (BITMAPOBJ *)GDI_GetObjPtr( hBmp, BITMAP_MAGIC );
pBmp->funcs = &X11DRV_DC_Funcs;
pBmp->funcs = X11DRV_DC_Funcs;
pBmp->physBitmap = (void *)pixmap;
GDI_ReleaseObj( hBmp );
......
......@@ -19,113 +19,7 @@
DEFAULT_DEBUG_CHANNEL(x11drv);
static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
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 */
};
const DC_FUNCTIONS *X11DRV_DC_Funcs = NULL; /* hack */
BITMAP_DRIVER X11DRV_BITMAP_Driver =
{
......@@ -214,9 +108,7 @@ BOOL X11DRV_GDI_Initialize( Display *display )
/* Initialize fonts and text caps */
if (!X11DRV_FONT_Init( &X11DRV_DevCaps )) return FALSE;
return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_DC_Funcs );
return X11DRV_FONT_Init( &X11DRV_DevCaps );
}
/**********************************************************************
......@@ -232,11 +124,13 @@ void X11DRV_GDI_Finalize(void)
/**********************************************************************
* X11DRV_CreateDC
*/
static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODEA* initData )
BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODEA* initData )
{
X11DRV_PDEVICE *physDev;
if (!X11DRV_DC_Funcs) X11DRV_DC_Funcs = dc->funcs; /* hack */
dc->physDev = physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*physDev) );
if(!physDev) {
......@@ -296,7 +190,7 @@ static BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
/**********************************************************************
* X11DRV_DeleteDC
*/
static BOOL X11DRV_DeleteDC( DC *dc )
BOOL X11DRV_DeleteDC( DC *dc )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
wine_tsx11_lock();
......@@ -312,8 +206,7 @@ static BOOL X11DRV_DeleteDC( DC *dc )
/**********************************************************************
* X11DRV_Escape
*/
static INT X11DRV_Escape( DC *dc, INT nEscape, INT cbInput,
SEGPTR lpInData, SEGPTR lpOutData )
INT X11DRV_Escape( DC *dc, INT nEscape, INT cbInput, SEGPTR lpInData, SEGPTR lpOutData )
{
switch( nEscape )
{
......
......@@ -181,6 +181,7 @@ static XpmColorSymbol OBM_BlackAndWhite[2] =
};
#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->dib = NULL;
bmpObjPtr->funcs = &X11DRV_DC_Funcs;
bmpObjPtr->funcs = X11DRV_DC_Funcs;
bmpObjPtr->physBitmap = (void *)pixmap;
GDI_ReleaseObj( hbitmap );
......
......@@ -564,9 +564,9 @@ extern BOOL GDI_FreeObject( HGDIOBJ, void *obj );
extern void *GDI_GetObjPtr( HGDIOBJ, WORD );
extern void GDI_ReleaseObj( HGDIOBJ );
extern BOOL DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs );
extern const DC_FUNCTIONS *DRIVER_FindDriver( LPCSTR name );
extern BOOL DRIVER_UnregisterDriver( LPCSTR name );
extern const DC_FUNCTIONS *DRIVER_load_driver( LPCSTR name );
extern const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs );
extern void DRIVER_release_driver( const DC_FUNCTIONS *funcs );
extern BOOL DRIVER_GetDriverName( LPCSTR device, LPSTR driver, DWORD size );
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 */
extern const DC_FUNCTIONS X11DRV_DC_Funcs;
extern BOOL X11DRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst,
INT width, INT height, struct tagDC *dcSrc,
INT xSrc, INT ySrc, DWORD rop );
......
......@@ -557,8 +557,17 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
if (!device || !DRIVER_GetDriverName( device, buf, sizeof(buf) ))
strcpy(buf, driver);
if (!(funcs = DRIVER_FindDriver( buf ))) return 0;
if (!(dc = DC_AllocDC( funcs ))) return 0;
if (!(funcs = DRIVER_load_driver( buf )))
{
ERR( "no driver found for %s\n", buf );
return 0;
}
if (!(dc = DC_AllocDC( funcs )))
{
DRIVER_release_driver( funcs );
return 0;
}
dc->flags = 0;
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" );
GDI_FreeObject( dc->hSelf, dc );
DRIVER_release_driver( funcs );
return 0;
}
......@@ -647,15 +657,23 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
DC *dc, *origDC;
const DC_FUNCTIONS *funcs;
if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) funcs = origDC->funcs;
else funcs = DRIVER_FindDriver( "DISPLAY" );
if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) funcs = DRIVER_get_driver(origDC->funcs);
else funcs = DRIVER_load_driver( "DISPLAY" );
if (!funcs)
{
if (origDC) GDI_ReleaseObj( hdc );
return 0;
}
if (!funcs || !(dc = DC_AllocDC( funcs )))
if (!(dc = DC_AllocDC( funcs )))
{
DRIVER_release_driver( funcs );
if (origDC) GDI_ReleaseObj( hdc );
return 0;
}
TRACE("(%04x): returning %04x\n",
hdc, dc->hSelf );
......@@ -674,7 +692,8 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
{
WARN("creation aborted by device\n");
GDI_FreeObject( dc->hSelf, dc );
if (origDC) GDI_ReleaseObj( hdc );
DRIVER_release_driver( funcs );
if (origDC) GDI_ReleaseObj( hdc );
return 0;
}
......@@ -734,6 +753,7 @@ BOOL WINAPI DeleteDC( HDC hdc )
SelectObject( hdc, GetStockObject(WHITE_BRUSH) );
SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc);
DRIVER_release_driver( dc->funcs );
}
if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
......@@ -742,7 +762,7 @@ BOOL WINAPI DeleteDC( HDC hdc )
if (dc->pAbortProc) THUNK_Free( (FARPROC)dc->pAbortProc );
if (dc->hookThunk) THUNK_Free( (FARPROC)dc->hookThunk );
PATH_DestroyGdiPath(&dc->path);
return GDI_FreeObject( hdc, dc );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment