Commit 9208301d authored by Alexandre Julliard's avatar Alexandre Julliard

Rewrote Escape to avoid calling down to Escape16.

Replaced Escape by ExtEscape in the DC function table.
parent b7190295
......@@ -69,9 +69,9 @@ static struct graphics_driver *create_driver( HMODULE module )
GET_FUNC(EndPage);
GET_FUNC(EndPath);
GET_FUNC(EnumDeviceFonts);
GET_FUNC(Escape);
GET_FUNC(ExcludeClipRect);
GET_FUNC(ExtDeviceMode);
GET_FUNC(ExtEscape);
GET_FUNC(ExtFloodFill);
GET_FUNC(ExtTextOut);
GET_FUNC(FillPath);
......
......@@ -47,7 +47,7 @@ rsrc version16.res
s_word s_word long) StretchBlt16
36 pascal16 Polygon (word ptr word) Polygon16
37 pascal16 Polyline (word ptr word) Polyline16
38 pascal Escape(word word word segptr segptr) Escape16
38 pascal Escape(word word word segptr ptr) Escape16
39 pascal16 RestoreDC(word s_word) RestoreDC16
40 pascal16 FillRgn(word word word) FillRgn16
41 pascal16 FrameRgn(word word word word word) FrameRgn16
......
......@@ -67,10 +67,12 @@ INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
* and the output data (which is used as a second input parameter).pointing at
* the whole docinfo structure. This seems to be an undocumented feature of
* the STARTDOC Escape.
*
* Note: we now do it the other way, with the STARTDOC Escape calling StartDoc.
*/
INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
{
INT ret;
INT ret = 0;
DC *dc = DC_GetDCPtr( hdc );
TRACE("DocName = '%s' Output = '%s' Datatype = '%s'\n",
......@@ -78,11 +80,7 @@ INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
if(!dc) return SP_ERROR;
if(dc->funcs->pStartDoc)
ret = dc->funcs->pStartDoc( dc, doc );
else
ret = Escape(hdc, STARTDOC, strlen(doc->lpszDocName),
doc->lpszDocName, (LPVOID)doc);
if (dc->funcs->pStartDoc) ret = dc->funcs->pStartDoc( dc, doc );
GDI_ReleaseObj( hdc );
return ret;
}
......@@ -132,14 +130,11 @@ INT16 WINAPI EndDoc16(HDC16 hdc)
*/
INT WINAPI EndDoc(HDC hdc)
{
INT ret;
INT ret = 0;
DC *dc = DC_GetDCPtr( hdc );
if(!dc) return SP_ERROR;
if(dc->funcs->pEndDoc)
ret = dc->funcs->pEndDoc( dc );
else
ret = Escape(hdc, ENDDOC, 0, 0, 0);
if (dc->funcs->pEndDoc) ret = dc->funcs->pEndDoc( dc );
GDI_ReleaseObj( hdc );
return ret;
}
......@@ -186,14 +181,11 @@ INT16 WINAPI EndPage16( HDC16 hdc )
*/
INT WINAPI EndPage(HDC hdc)
{
INT ret;
INT ret = 0;
DC *dc = DC_GetDCPtr( hdc );
if(!dc) return SP_ERROR;
if(dc->funcs->pEndPage)
ret = dc->funcs->pEndPage( dc );
else
ret = Escape(hdc, NEWFRAME, 0, 0, 0);
if (dc->funcs->pEndPage) ret = dc->funcs->pEndPage( dc );
GDI_ReleaseObj( hdc );
if (!QueryAbort16( hdc, 0 ))
{
......@@ -216,14 +208,11 @@ INT16 WINAPI AbortDoc16(HDC16 hdc)
*/
INT WINAPI AbortDoc(HDC hdc)
{
INT ret;
INT ret = 0;
DC *dc = DC_GetDCPtr( hdc );
if(!dc) return SP_ERROR;
if(dc->funcs->pAbortDoc)
ret = dc->funcs->pAbortDoc( dc );
else
ret = Escape(hdc, ABORTDOC, 0, 0, 0);
if (dc->funcs->pAbortDoc) ret = dc->funcs->pAbortDoc( dc );
GDI_ReleaseObj( hdc );
return ret;
}
......
......@@ -254,6 +254,79 @@ BOOL PSDRV_DeleteDC( DC *dc )
/***********************************************************************
* get_phys_page_size
*
* Helper function to compute PHYSICALWIDTH and PHYSICALHEIGHT dev caps.
*/
static void get_phys_page_size( const PSDRV_PDEVICE *pdev, POINT *p )
{
p->x = p->y = 0;
if ((pdev->Devmode->dmPublic.dmFields & DM_PAPERSIZE) != 0 &&
pdev->Devmode->dmPublic.u1.s1.dmPaperSize != 0)
{
PAGESIZE *page = pdev->pi->ppd->PageSizes;
while (page != NULL)
{
if (page->WinPage == pdev->Devmode->dmPublic.u1.s1.dmPaperSize)
break;
page = page->next;
}
if (page == NULL)
{
ERR("No entry for papersize %u in PPD file for '%s'\n",
pdev->Devmode->dmPublic.u1.s1.dmPaperSize,
pdev->pi->FriendlyName);
return;
}
TRACE("Found '%s' for paper size %u\n", page->FullName,
pdev->Devmode->dmPublic.u1.s1.dmPaperSize);
p->x = page->PaperDimension->x * pdev->logPixelsX / 72;
p->y = page->PaperDimension->y * pdev->logPixelsY / 72;
TRACE("%fx%f PostScript points = %lix%li device units\n",
page->PaperDimension->x, page->PaperDimension->y,
p->x, p->y);
}
/* These are in tenths of a millimeter */
if ((pdev->Devmode->dmPublic.dmFields & DM_PAPERWIDTH) != 0 &&
pdev->Devmode->dmPublic.u1.s1.dmPaperWidth != 0)
{
p->x = (pdev->Devmode->dmPublic.u1.s1.dmPaperWidth *
pdev->logPixelsX) / 254;
TRACE("dmPaperWidth = %li device units\n", p->x);
}
if ((pdev->Devmode->dmPublic.dmFields & DM_PAPERLENGTH) != 0 &&
pdev->Devmode->dmPublic.u1.s1.dmPaperLength != 0)
{
p->y = (pdev->Devmode->dmPublic.u1.s1.dmPaperLength *
pdev->logPixelsY) / 254;
TRACE("dmPaperLength = %li device units\n", p->y);
}
if (p->x == 0 || p->y == 0)
{
ERR("Paper size not properly set for '%s'\n", pdev->pi->FriendlyName);
return;
}
if ((pdev->Devmode->dmPublic.dmFields & DM_ORIENTATION) != 0 &&
pdev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE)
{
INT temp = p->y;
p->y = p->x;
p->x = temp;
}
}
/***********************************************************************
* GetDeviceCaps (WINEPS.@)
*/
INT PSDRV_GetDeviceCaps( DC *dc, INT cap )
......@@ -326,23 +399,15 @@ INT PSDRV_GetDeviceCaps( DC *dc, INT cap )
case COLORRES:
return 0;
case PHYSICALWIDTH:
if (Escape(dc->hSelf, GETPHYSPAGESIZE, 0, NULL, &pt) > 0) return pt.x;
return 0;
get_phys_page_size( physDev, &pt );
return pt.x;
case PHYSICALHEIGHT:
if (Escape(dc->hSelf, GETPHYSPAGESIZE, 0, NULL, &pt) > 0) return pt.y;
return 0;
get_phys_page_size( physDev, &pt );
return pt.y;
case PHYSICALOFFSETX:
if(Escape(dc->hSelf, GETPRINTINGOFFSET, 0, NULL, &pt) > 0) return pt.x;
return 0;
case PHYSICALOFFSETY:
if (Escape(dc->hSelf, GETPRINTINGOFFSET, 0, NULL, &pt) > 0) return pt.y;
return 0;
case SCALINGFACTORX:
if (Escape(dc->hSelf, GETSCALINGFACTOR, 0, NULL, &pt) > 0) return pt.x;
return 0;
case SCALINGFACTORY:
if (Escape(dc->hSelf, GETSCALINGFACTOR, 0, NULL, &pt) > 0) return pt.y;
return 0;
case VREFRESH:
case DESKTOPVERTRES:
case DESKTOPHORZRES:
......
......@@ -23,8 +23,8 @@ debug_channels (psdrv)
@ 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 ExtEscape(ptr long long ptr long ptr) PSDRV_ExtEscape
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) PSDRV_ExtTextOut
@ cdecl GetCharWidth(ptr long long ptr) PSDRV_GetCharWidth
@ cdecl GetDeviceCaps(ptr long) PSDRV_GetDeviceCaps
......
......@@ -287,10 +287,8 @@ static void X11DRV_DDHAL_SetInfo(void)
(ddraw_fns->lpSetInfo)(&hal_info, FALSE);
}
INT X11DRV_DCICommand(INT cbInput, LPVOID lpInData, LPVOID lpOutData)
INT X11DRV_DCICommand(INT cbInput, const DCICMD *lpCmd, LPVOID lpOutData)
{
LPDCICMD lpCmd = (LPDCICMD)lpInData;
TRACE("(%d,(%ld,%ld,%ld),%p)\n", cbInput, lpCmd->dwCommand,
lpCmd->dwParam1, lpCmd->dwParam2, lpOutData);
......
......@@ -26,8 +26,8 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
@ 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 ExtEscape(ptr long long ptr long ptr) X11DRV_ExtEscape
@ 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
......
......@@ -40,9 +40,9 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
NULL, /* pEndPage */
EMFDRV_EndPath, /* pEndPath */
NULL, /* pEnumDeviceFonts */
NULL, /* pEscape */
EMFDRV_ExcludeClipRect, /* pExcludeClipRect */
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
EMFDRV_ExtFloodFill, /* pExtFloodFill */
NULL, /* pExtTextOut */
EMFDRV_FillPath, /* pFillPath */
......
......@@ -41,9 +41,9 @@ static const DC_FUNCTIONS MFDRV_Funcs =
NULL, /* pEndPage */
MFDRV_EndPath, /* pEndPath */
NULL, /* pEnumDeviceFonts */
NULL, /* pEscape */
MFDRV_ExcludeClipRect, /* pExcludeClipRect */
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
MFDRV_ExtFloodFill, /* pExtFloodFill */
MFDRV_ExtTextOut, /* pExtTextOut */
MFDRV_FillPath, /* pFillPath */
......
......@@ -40,8 +40,8 @@ LPDRAWMODE win16drv_DrawModeP;
static BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODEA* initData );
static INT WIN16DRV_GetDeviceCaps( DC *dc, INT cap );
static INT WIN16DRV_Escape( DC *dc, INT nEscape, INT cbInput,
SEGPTR lpInData, SEGPTR lpOutData );
static INT WIN16DRV_ExtEscape( DC *dc, INT escape, INT in_count, LPCVOID in_data,
INT out_count, LPVOID out_data );
static const DC_FUNCTIONS WIN16DRV_Funcs =
{
......@@ -68,9 +68,9 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pEndPage */
NULL, /* pEndPath */
WIN16DRV_EnumDeviceFonts, /* pEnumDeviceFonts */
WIN16DRV_Escape, /* pEscape */
NULL, /* pExcludeClipRect */
WIN16DRV_ExtDeviceMode, /* pExtDeviceMode */
WIN16DRV_ExtEscape, /* pExtEscape */
NULL, /* pExtFloodFill */
WIN16DRV_ExtTextOut, /* pExtTextOut */
NULL, /* pFillPath */
......@@ -319,12 +319,13 @@ static INT WIN16DRV_GetDeviceCaps( DC *dc, INT cap )
}
/*
* Escape (GDI.38)
/***********************************************************************
* WIN16DRV_ExtEscape
*/
static INT WIN16DRV_Escape( DC *dc, INT nEscape, INT cbInput,
SEGPTR lpInData, SEGPTR lpOutData )
static INT WIN16DRV_ExtEscape( DC *dc, INT escape, INT in_count, LPCVOID in_data,
INT out_count, LPVOID out_data )
{
#if 0
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
int nRet = 0;
......@@ -414,6 +415,10 @@ static INT WIN16DRV_Escape( DC *dc, INT nEscape, INT cbInput,
else
WARN("Escape(nEscape = %04x) - ???\n", nEscape);
return nRet;
#endif
/* FIXME: should convert args to SEGPTR and redo all the above */
FIXME("temporarily broken, please fix\n");
return 0;
}
......@@ -263,42 +263,32 @@ INT X11DRV_GetDeviceCaps( DC *dc, INT cap )
/**********************************************************************
* X11DRV_Escape
* ExtEscape (X11DRV.@)
*/
INT X11DRV_Escape( DC *dc, INT nEscape, INT cbInput, SEGPTR lpInData, SEGPTR lpOutData )
INT X11DRV_ExtEscape( DC *dc, INT escape, INT in_count, LPCVOID in_data,
INT out_count, LPVOID out_data )
{
switch( nEscape )
switch(escape)
{
case QUERYESCSUPPORT:
if( lpInData )
{
LPINT16 lpEscape = MapSL(lpInData);
switch (*lpEscape)
{
case DCICOMMAND:
return DD_HAL_VERSION;
}
}
break;
case GETSCALINGFACTOR:
if( lpOutData )
{
LPPOINT16 lppt = MapSL(lpOutData);
lppt->x = lppt->y = 0; /* no device scaling */
return 1;
}
break;
case DCICOMMAND:
if( lpInData )
{
LPDCICMD lpCmd = MapSL(lpInData);
if (lpCmd->dwVersion != DD_VERSION) break;
return X11DRV_DCICommand(cbInput, lpCmd, MapSL(lpOutData));
}
break;
case QUERYESCSUPPORT:
if (in_data)
{
switch (*(INT *)in_data)
{
case DCICOMMAND:
return DD_HAL_VERSION;
}
}
break;
case DCICOMMAND:
if (in_data)
{
const DCICMD *lpCmd = in_data;
if (lpCmd->dwVersion != DD_VERSION) break;
return X11DRV_DCICommand(in_count, lpCmd, out_data);
}
break;
}
return 0;
}
......@@ -148,10 +148,9 @@ typedef struct tagDC_FUNCS
INT (*pEndPage)(DC*);
BOOL (*pEndPath)(DC*);
BOOL (*pEnumDeviceFonts)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM);
INT (*pEscape)(DC*,INT,INT,SEGPTR,SEGPTR);
INT (*pExcludeClipRect)(DC*,INT,INT,INT,INT);
INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,
LPSTR,DWORD);
INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
INT (*pExtEscape)(DC*,INT,INT,LPCVOID,INT,LPVOID);
BOOL (*pExtFloodFill)(DC*,INT,INT,COLORREF,UINT);
BOOL (*pExtTextOut)(DC*,INT,INT,UINT,const RECT*,LPCWSTR,UINT,
const INT*);
......
......@@ -368,7 +368,7 @@ INT16 WINAPI EnumFonts16(HDC16,LPCSTR,FONTENUMPROC16,LPARAM);
BOOL16 WINAPI EnumMetaFile16(HDC16,HMETAFILE16,MFENUMPROC16,LPARAM);
INT16 WINAPI EnumObjects16(HDC16,INT16,GOBJENUMPROC16,LPARAM);
BOOL16 WINAPI EqualRgn16(HRGN16,HRGN16);
INT16 WINAPI Escape16(HDC16,INT16,INT16,SEGPTR,SEGPTR);
INT16 WINAPI Escape16(HDC16,INT16,INT16,SEGPTR,LPVOID);
INT16 WINAPI ExcludeClipRect16(HDC16,INT16,INT16,INT16,INT16);
INT16 WINAPI ExcludeVisRect16(HDC16,INT16,INT16,INT16,INT16);
HPEN16 WINAPI ExtCreatePen16(DWORD,DWORD,const LOGBRUSH16*,DWORD,const DWORD*);
......
......@@ -255,8 +255,8 @@ void X11DRV_DIB_CopyDIBSection(DC *dcSrc, DC *dcDst,
DWORD xSrc, DWORD ySrc,
DWORD xDest, DWORD yDest,
DWORD width, DWORD height);
extern INT X11DRV_DCICommand(INT cbInput, LPVOID lpInData, LPVOID lpOutData);
struct _DCICMD;
extern INT X11DRV_DCICommand(INT cbInput, const struct _DCICMD *lpCmd, LPVOID lpOutData);
/**************************************************************************
* X11 GDI driver
......
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