From 9208301d16eac919f4610299cf8d97c6afeb0f02 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 29 Jul 2001 20:25:14 +0000 Subject: [PATCH] Rewrote Escape to avoid calling down to Escape16. Replaced Escape by ExtEscape in the DC function table. --- dlls/gdi/driver.c | 2 +- dlls/gdi/gdi.spec | 2 +- dlls/gdi/printdrv.c | 31 +- dlls/wineps/escape.c | 263 ++++------------- dlls/wineps/init.c | 89 +++++- dlls/wineps/wineps.spec | 2 +- dlls/x11drv/x11ddraw.c | 4 +- dlls/x11drv/x11drv.spec | 2 +- graphics/enhmetafiledrv/init.c | 2 +- graphics/escape.c | 497 +++++++++++++++++++-------------- graphics/metafiledrv/init.c | 2 +- graphics/win16drv/init.c | 19 +- graphics/x11drv/init.c | 54 ++-- include/gdi.h | 5 +- include/wine/wingdi16.h | 2 +- include/x11drv.h | 4 +- 16 files changed, 473 insertions(+), 507 deletions(-) diff --git a/dlls/gdi/driver.c b/dlls/gdi/driver.c index b8a7d9581f8..7819a4186f8 100644 --- a/dlls/gdi/driver.c +++ b/dlls/gdi/driver.c @@ -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); diff --git a/dlls/gdi/gdi.spec b/dlls/gdi/gdi.spec index 991a66788b7..f4bdcdad148 100644 --- a/dlls/gdi/gdi.spec +++ b/dlls/gdi/gdi.spec @@ -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 diff --git a/dlls/gdi/printdrv.c b/dlls/gdi/printdrv.c index c2909eeaa95..98908c0a783 100644 --- a/dlls/gdi/printdrv.c +++ b/dlls/gdi/printdrv.c @@ -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; } diff --git a/dlls/wineps/escape.c b/dlls/wineps/escape.c index 2004d96e3e9..673dcc1b787 100644 --- a/dlls/wineps/escape.c +++ b/dlls/wineps/escape.c @@ -13,63 +13,27 @@ DEFAULT_DEBUG_CHANNEL(psdrv); -INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, - SEGPTR lpInData, SEGPTR lpOutData ) +/********************************************************************** + * ExtEscape (PSDRV.@) + */ +INT PSDRV_ExtEscape( DC *dc, INT nEscape, INT cbInput, LPCVOID in_data, + INT cbOutput, LPVOID out_data ) { PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; - switch(nEscape) { - - case NEXTBAND: { - RECT16 *r = MapSL(lpOutData); - if(!physDev->job.banding) { - physDev->job.banding = TRUE; - r->left = 0; - r->top = 0; - r->right = physDev->horzRes; - r->bottom = physDev->vertRes; - TRACE("NEXTBAND returning %d,%d - %d,%d\n", r->left, - r->top, r->right, r->bottom ); - return 1; - } - r->left = 0; - r->top = 0; - r->right = 0; - r->bottom = 0; - TRACE("NEXTBAND rect to 0,0 - 0,0\n" ); - physDev->job.banding = FALSE; - } /* Fall through */ - - case NEWFRAME: - TRACE("NEWFRAME\n"); - - if(!physDev->job.hJob) { - FIXME("hJob == 0. Now what?\n"); - return SP_ERROR; - } - - if(!PSDRV_EndPage( dc )) - return SP_ERROR; - return 1; - + switch(nEscape) + { case QUERYESCSUPPORT: - if(cbInput < 2) { - WARN("cbInput < 2 (=%d) for QUERYESCSUPPORT\n", cbInput); + if(cbInput < sizeof(INT)) + { + WARN("cbInput < sizeof(INT) (=%d) for QUERYESCSUPPORT\n", cbInput); return 0; } else { - UINT16 num = *(UINT16 *)MapSL(lpInData); - TRACE("QUERYESCSUPPORT for %d\n", num); + UINT num = *(UINT *)in_data; + TRACE("QUERYESCSUPPORT for %d\n", num); switch(num) { - case NEWFRAME: case NEXTBAND: - case QUERYESCSUPPORT: - case SETABORTPROC: - case STARTDOC: - case ENDDOC: - case GETPHYSPAGESIZE: - case GETPRINTINGOFFSET: - case GETSCALINGFACTOR: case SETCOPYCOUNT: case GETTECHNOLOGY: case SETLINECAP: @@ -88,141 +52,33 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, } } - case SETABORTPROC: - TRACE("SETABORTPROC\n"); - return 1; - - case STARTDOC: - { - DOCINFOA doc; - char *name = NULL; - INT16 ret; - - TRACE("STARTDOC\n"); - - /* lpInData may not be 0 terminated so we must copy it */ - if(lpInData) { - name = HeapAlloc( GetProcessHeap(), 0, cbInput+1 ); - memcpy(name, MapSL(lpInData), cbInput); - name[cbInput] = '\0'; - } - doc.cbSize = sizeof(doc); - doc.lpszDocName = name; - doc.lpszOutput = doc.lpszDatatype = NULL; - doc.fwType = 0; - - ret = PSDRV_StartDoc(dc, &doc); - if(name) HeapFree( GetProcessHeap(), 0, name ); - if(ret <= 0) return -1; - ret = PSDRV_StartPage(dc); - if(ret <= 0) return -1; - return ret; - } - - case ENDDOC: - TRACE("ENDDOC\n"); - return PSDRV_EndDoc( dc ); - - case GETPHYSPAGESIZE: - { - PSDRV_PDEVICE *pdev = (PSDRV_PDEVICE *)(dc->physDev); - POINT16 *p = MapSL(lpOutData); - - 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 0; - } - - TRACE("Found '%s' for paper size %u\n", page->FullName, - pdev->Devmode->dmPublic.u1.s1.dmPaperSize); - - p->x = page->PaperDimension->x * physDev->logPixelsX / 72; - p->y = page->PaperDimension->y * physDev->logPixelsY / 72; - - TRACE("%fx%f PostScript points = %ix%i 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 * - physDev->logPixelsX) / 254; - TRACE("dmPaperWidth = %i 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 * - physDev->logPixelsY) / 254; - TRACE("dmPaperLength = %i 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 0; - } - - if ((pdev->Devmode->dmPublic.dmFields & DM_ORIENTATION) != 0 && - pdev->Devmode->dmPublic.u1.s1.dmOrientation == - DMORIENT_LANDSCAPE) - { - register INT16 temp = p->y; - p->y = p->x; - p->x = temp; - } - - return 1; - } - - case GETPRINTINGOFFSET: - { - POINT16 *p = MapSL(lpOutData); - - p->x = p->y = 0; - TRACE("GETPRINTINGOFFSET: returning %dx%d\n", p->x, p->y); - return 1; - } - - case GETSCALINGFACTOR: - { - POINT16 *p = MapSL(lpOutData); - - p->x = p->y = 0; - TRACE("GETSCALINGFACTOR: returning %dx%d\n", p->x, p->y); + case NEXTBAND: + { + RECT *r = out_data; + if(!physDev->job.banding) { + physDev->job.banding = TRUE; + r->left = 0; + r->top = 0; + r->right = physDev->horzRes; + r->bottom = physDev->vertRes; + TRACE("NEXTBAND returning %d,%d - %d,%d\n", r->left, r->top, r->right, r->bottom ); return 1; } + r->left = 0; + r->top = 0; + r->right = 0; + r->bottom = 0; + TRACE("NEXTBAND rect to 0,0 - 0,0\n" ); + physDev->job.banding = FALSE; + return EndPage( dc->hSelf ); + } case SETCOPYCOUNT: { - INT16 *NumCopies = MapSL(lpInData); - INT16 *ActualCopies = MapSL(lpOutData); - if(cbInput != 2) { - WARN("cbInput != 2 (=%d) for SETCOPYCOUNT\n", cbInput); + const INT *NumCopies = in_data; + INT *ActualCopies = out_data; + if(cbInput != sizeof(INT)) { + WARN("cbInput != sizeof(INT) (=%d) for SETCOPYCOUNT\n", cbInput); return 0; } TRACE("SETCOPYCOUNT %d\n", *NumCopies); @@ -232,7 +88,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case GETTECHNOLOGY: { - LPSTR p = MapSL(lpOutData); + LPSTR p = out_data; strcpy(p, "PostScript"); *(p + strlen(p) + 1) = '\0'; /* 2 '\0's at end of string */ return 1; @@ -240,33 +96,33 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case SETLINECAP: { - INT16 newCap = *(INT16 *)MapSL(lpInData); - if(cbInput != 2) { - WARN("cbInput != 2 (=%d) for SETLINECAP\n", cbInput); + INT newCap = *(INT *)in_data; + if(cbInput != sizeof(INT)) { + WARN("cbInput != sizeof(INT) (=%d) for SETLINECAP\n", cbInput); return 0; - } + } TRACE("SETLINECAP %d\n", newCap); return 0; } - + case SETLINEJOIN: { - INT16 newJoin = *(INT16 *)MapSL(lpInData); - if(cbInput != 2) { - WARN("cbInput != 2 (=%d) for SETLINEJOIN\n", cbInput); + INT newJoin = *(INT *)in_data; + if(cbInput != sizeof(INT)) { + WARN("cbInput != sizeof(INT) (=%d) for SETLINEJOIN\n", cbInput); return 0; - } + } TRACE("SETLINEJOIN %d\n", newJoin); return 0; } case SETMITERLIMIT: { - INT16 newLimit = *(INT16 *)MapSL(lpInData); - if(cbInput != 2) { - WARN("cbInput != 2 (=%d) for SETMITERLIMIT\n", cbInput); + INT newLimit = *(INT *)in_data; + if(cbInput != sizeof(INT)) { + WARN("cbInput != sizeof(INT) (=%d) for SETMITERLIMIT\n", cbInput); return 0; - } + } TRACE("SETMITERLIMIT %d\n", newLimit); return 0; } @@ -292,23 +148,22 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case EXT_DEVICE_CAPS: { - UINT16 cap = *(UINT16 *)MapSL(lpInData); - if(cbInput != 2) { - WARN("cbInput != 2 (=%d) for EXT_DEVICE_CAPS\n", - cbInput); + UINT cap = *(UINT *)in_data; + if(cbInput != sizeof(UINT)) { + WARN("cbInput != sizeof(UINT) (=%d) for EXT_DEVICE_CAPS\n", cbInput); return 0; - } + } TRACE("EXT_DEVICE_CAPS %d\n", cap); return 0; } case SET_BOUNDS: { - RECT16 *r = MapSL(lpInData); - if(cbInput != 8) { - WARN("cbInput != 8 (=%d) for SET_BOUNDS\n", cbInput); + const RECT *r = in_data; + if(cbInput != sizeof(RECT)) { + WARN("cbInput != sizeof(RECT) (=%d) for SET_BOUNDS\n", cbInput); return 0; - } + } TRACE("SET_BOUNDS (%d,%d) - (%d,%d)\n", r->left, r->top, r->right, r->bottom); return 0; @@ -316,7 +171,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, case EPSPRINTING: { - UINT16 epsprint = *(UINT16*)MapSL(lpInData); + UINT epsprint = *(UINT*)in_data; /* FIXME: In this mode we do not need to send page intros and page * ends according to the doc. But I just ignore that detail * for now. @@ -333,7 +188,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, * (Usually we have a WORD before the data counting the size, but * cbInput is just this +2.) */ - return WriteSpool16(physDev->job.hJob,((char*)lpInData)+2,cbInput-2); + return WriteSpool16(physDev->job.hJob,((char*)in_data)+2,cbInput-2); } case GETSETPRINTORIENT: @@ -342,7 +197,7 @@ INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, * bit LONG value is the orientation. if lpInData is NULL, it * returns the current orientation. */ - FIXME("GETSETPRINTORIENT not implemented (lpInData %ld)!\n",lpInData); + FIXME("GETSETPRINTORIENT not implemented (data %p)!\n",in_data); return 1; } default: diff --git a/dlls/wineps/init.c b/dlls/wineps/init.c index a5c0830ecf7..a12786ff279 100644 --- a/dlls/wineps/init.c +++ b/dlls/wineps/init.c @@ -253,6 +253,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.@) */ @@ -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: diff --git a/dlls/wineps/wineps.spec b/dlls/wineps/wineps.spec index 6bcfb1baacb..ef1fc3aa110 100644 --- a/dlls/wineps/wineps.spec +++ b/dlls/wineps/wineps.spec @@ -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 diff --git a/dlls/x11drv/x11ddraw.c b/dlls/x11drv/x11ddraw.c index 76ec4117978..6e6367b6ab3 100644 --- a/dlls/x11drv/x11ddraw.c +++ b/dlls/x11drv/x11ddraw.c @@ -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); diff --git a/dlls/x11drv/x11drv.spec b/dlls/x11drv/x11drv.spec index 05210d9dc27..140bac8a9a7 100644 --- a/dlls/x11drv/x11drv.spec +++ b/dlls/x11drv/x11drv.spec @@ -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 diff --git a/graphics/enhmetafiledrv/init.c b/graphics/enhmetafiledrv/init.c index 7ed115b89af..838ff545066 100644 --- a/graphics/enhmetafiledrv/init.c +++ b/graphics/enhmetafiledrv/init.c @@ -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 */ diff --git a/graphics/escape.c b/graphics/escape.c index 17eb5e8c897..70add7f0d7b 100644 --- a/graphics/escape.c +++ b/graphics/escape.c @@ -2,13 +2,13 @@ * Escape() function. * * Copyright 1994 Bob Amstadt + * Copyright 2001 Alexandre Julliard */ #include #include "windef.h" #include "wingdi.h" #include "gdi.h" -#include "heap.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(driver); @@ -16,231 +16,300 @@ DEFAULT_DEBUG_CHANNEL(driver); /*********************************************************************** * Escape [GDI.38] */ -INT16 WINAPI Escape16( HDC16 hdc, INT16 nEscape, INT16 cbInput, - SEGPTR lpszInData, SEGPTR lpvOutData ) +INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count, + SEGPTR in_data, LPVOID out_data ) { - INT16 ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) + INT ret; + + switch(escape) { - if (dc->funcs->pEscape) - { - if(nEscape == SETABORTPROC) SetAbortProc16(hdc, lpszInData); - ret = dc->funcs->pEscape( dc, nEscape, cbInput, lpszInData, lpvOutData ); - } - GDI_ReleaseObj( hdc ); + /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */ + /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */ + /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */ + /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */ + /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */ + /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */ + /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */ + /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */ + /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */ + /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */ + /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */ + /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */ + /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */ + case CLIP_TO_PATH: + case DRAFTMODE: + case ENUMPAPERBINS: + case EPSPRINTING: + case EXT_DEVICE_CAPS: + case GETCOLORTABLE: + case MOUSETRAILS: + case POSTSCRIPT_IGNORE: + case QUERYESCSUPPORT: + case SET_ARC_DIRECTION: + case SET_POLY_MODE: + case SET_SCREEN_ANGLE: + case SET_SPREAD: + { + INT16 *ptr = MapSL(in_data); + INT data = *ptr; + return Escape( hdc, escape, sizeof(data), (LPCSTR)&data, out_data ); + } + + /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */ + case ENABLEDUPLEX: + { + UINT16 *ptr = MapSL(in_data); + UINT data = *ptr; + return Escape( hdc, escape, sizeof(data), (LPCSTR)&data, NULL ); + } + + /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */ + /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */ + /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */ + case GETPHYSPAGESIZE: + case GETPRINTINGOFFSET: + case GETSCALINGFACTOR: + { + POINT16 *ptr = MapSL(in_data); + POINT pt32; + ret = Escape( hdc, escape, 0, NULL, &pt32 ); + ptr->x = pt32.x; + ptr->y = pt32.y; + return ret; + } + + /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */ + /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */ + /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */ + /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */ + /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */ + /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */ + /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */ + case ENABLEPAIRKERNING: + case ENABLERELATIVEWIDTHS: + case SETCOPYCOUNT: + case SETKERNTRACK: + case SETLINECAP: + case SETLINEJOIN: + case SETMITERLIMIT: + { + INT16 *new = MapSL(in_data); + INT16 *old = out_data; + INT out, in = *new; + ret = Escape( hdc, escape, sizeof(in), (LPCSTR)&in, &out ); + *old = out; + return ret; + } + + /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */ + case SETABORTPROC: + return SetAbortProc16( hdc, in_data ); + + /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16); + * lpvOutData is actually a pointer to the DocInfo structure and used as + * a second input parameter */ + case STARTDOC: + if (out_data) + { + ret = StartDoc16( hdc, out_data ); + if (ret > 0) ret = StartPage( hdc ); + return ret; + } + return Escape( hdc, escape, in_count, MapSL(in_data), NULL ); + + /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */ + /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */ + case SET_BOUNDS: + case SET_CLIP_BOX: + { + RECT16 *rc16 = MapSL(in_data); + RECT rc; + rc.left = rc16->left; + rc.top = rc16->top; + rc.right = rc16->right; + rc.bottom = rc16->bottom; + return Escape( hdc, escape, sizeof(rc), (LPCSTR)&rc, NULL ); + } + + /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */ + case NEXTBAND: + { + RECT rc; + RECT16 *rc16 = MapSL(in_data); + ret = Escape( hdc, escape, 0, NULL, &rc ); + rc16->left = rc.left; + rc16->top = rc.top; + rc16->right = rc.right; + rc16->bottom = rc.bottom; + return ret; + } + + /* Escape(hdc,ABORTDOC,NULL,NULL); */ + /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */ + /* Escape(hdc,BEGIN_PATH,NULL,NULL); */ + /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */ + /* Escape(hdc,ENDDOC,NULL,NULL); */ + /* Escape(hdc,END_PATH,PATHINFO,NULL); */ + /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */ + /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */ + /* Escape(hdc,GETFACENAME,NULL,LPSTR); */ + /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */ + /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */ + /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */ + /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */ + /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */ + /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */ + /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */ + /* Escape(hdc,NEWFRAME,NULL,NULL); */ + /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */ + /* Escape(hdc,RESTORE_CTM,NULL,NULL); */ + /* Escape(hdc,SAVE_CTM,NULL,NULL); */ + /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */ + /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */ + /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */ + /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */ + case ABORTDOC: + case BANDINFO: + case BEGIN_PATH: + case DRAWPATTERNRECT: + case ENDDOC: + case END_PATH: + case EXTTEXTOUT: + case FLUSHOUTPUT: + case GETFACENAME: + case GETPAIRKERNTABLE: + case GETSETPAPERBINS: + case GETSETPRINTORIENT: + case GETSETSCREENPARAMS: + case GETTECHNOLOGY: + case GETTRACKKERNTABLE: + case MFCOMMENT: + case NEWFRAME: + case PASSTHROUGH: + case RESTORE_CTM: + case SAVE_CTM: + case SETALLJUSTVALUES: + case SETCOLORTABLE: + case SET_BACKGROUND_COLOR: + case TRANSFORM_CTM: + /* pass it unmodified to the 32-bit function */ + return Escape( hdc, escape, in_count, MapSL(in_data), out_data ); + + /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */ + /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */ + /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */ + /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */ + /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */ + /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */ + case ENUMPAPERMETRICS: + case GETEXTENDEDTEXTMETRICS: + case GETEXTENTTABLE: + case GETSETPAPERMETRICS: + case GETVECTORBRUSHSIZE: + case GETVECTORPENSIZE: + default: + FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n", + escape, in_count, MapSL(in_data), out_data ); + return Escape( hdc, escape, in_count, MapSL(in_data), out_data ); } - return ret; } + /************************************************************************ * Escape [GDI32.@] */ -INT WINAPI Escape( HDC hdc, INT nEscape, INT cbInput, - LPCSTR lpszInData, LPVOID lpvOutData ) +INT WINAPI Escape( HDC hdc, INT escape, INT in_count, LPCSTR in_data, LPVOID out_data ) { - SEGPTR segin,segout; - INT ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (!dc) return 0; - if (!dc->funcs->pEscape) goto done; + INT ret; + POINT *pt; - segin = (SEGPTR)lpszInData; - segout = (SEGPTR)lpvOutData; - switch (nEscape) { - /* Escape(hdc,QUERYESCSUPPORT,LPINT,NULL) */ - /* Escape(hdc,CLIP_TO_PATH,LPINT,NULL) */ - /* Escape(hdc,EPSPRINTING,LPINT,NULL) */ - case QUERYESCSUPPORT: - case CLIP_TO_PATH: - case EPSPRINTING: - { - LPINT16 x = (LPINT16)SEGPTR_NEW(INT16); - *x = *(INT*)lpszInData; - segin = SEGPTR_GET(x); - cbInput = sizeof(INT16); - break; - } + switch (escape) + { + case ABORTDOC: + return AbortDoc( hdc ); - /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT32) */ - /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT32) */ - /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT32) */ + case ENDDOC: + return EndDoc( hdc ); + + case GETPHYSPAGESIZE: + pt = out_data; + pt->x = GetDeviceCaps( hdc, PHYSICALWIDTH ); + pt->y = GetDeviceCaps( hdc, PHYSICALHEIGHT ); + return 1; + + case GETPRINTINGOFFSET: + pt = out_data; + pt->x = GetDeviceCaps( hdc, PHYSICALOFFSETX ); + pt->y = GetDeviceCaps( hdc, PHYSICALOFFSETY ); + return 1; case GETSCALINGFACTOR: - case GETPHYSPAGESIZE: - case GETPRINTINGOFFSET: - segout = SEGPTR_GET(SEGPTR_NEW(POINT16)); - cbInput = sizeof(POINT16); - break; + pt = out_data; + pt->x = GetDeviceCaps( hdc, SCALINGFACTORX ); + pt->y = GetDeviceCaps( hdc, SCALINGFACTORY ); + return 1; - /* Escape(hdc,EXT_DEVICE_CAPS,LPINT,LPDWORD) */ - case EXT_DEVICE_CAPS: - { - LPINT16 lpIndex = (LPINT16)SEGPTR_NEW(INT16); - LPDWORD lpCaps = (LPDWORD)SEGPTR_NEW(DWORD); - *lpIndex = *(INT*)lpszInData; - - segin = SEGPTR_GET(lpIndex); - segout = SEGPTR_GET(lpCaps); - cbInput = sizeof(INT16); - break; - } - - /* Escape(hdc,SETLINECAP,LPINT,LPINT) */ - case SETLINECAP: - case SETLINEJOIN: - case SETMITERLIMIT: - { - LPINT16 new = (LPINT16)SEGPTR_NEW(INT16); - LPINT16 old = (LPINT16)SEGPTR_NEW(INT16); - *new = *(INT*)lpszInData; - segin = SEGPTR_GET(new); - segout = SEGPTR_GET(old); - cbInput = sizeof(INT16); - break; - } - /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */ - case GETTECHNOLOGY: { - segout = SEGPTR_GET(SEGPTR_ALLOC(200)); /* enough I hope */ - break; - - } - - /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */ - - case ENABLEPAIRKERNING: { - LPINT16 enab = SEGPTR_NEW(INT16); - segout = SEGPTR_GET(SEGPTR_NEW(INT16)); - segin = SEGPTR_GET(enab); - *enab = *(INT*)lpszInData; - cbInput = sizeof(INT16); - break; - } - - /* Escape(hdc,GETFACENAME,NULL,LPSTR); */ - - case GETFACENAME: { - segout = SEGPTR_GET(SEGPTR_ALLOC(200)); - break; - } - - /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFOA); - * lpvOutData is actually a pointer to the DocInfo structure and used as - * a second input parameter - */ - - case STARTDOC: /* string may not be \0 terminated */ - if(lpszInData) { - char *cp = SEGPTR_ALLOC(cbInput); - memcpy(cp, lpszInData, cbInput); - segin = SEGPTR_GET(cp); - } else - segin = 0; - - if(lpvOutData) { - DOCINFO16 *lpsegdoc = SEGPTR_NEW(DOCINFO16); - DOCINFOA *lpdoc = lpvOutData; - memset(lpsegdoc, 0, sizeof(*lpsegdoc)); - lpsegdoc->cbSize = sizeof(*lpsegdoc); - lpsegdoc->lpszDocName = SEGPTR_GET(SEGPTR_STRDUP(lpdoc->lpszDocName)); - lpsegdoc->lpszOutput = SEGPTR_GET(SEGPTR_STRDUP(lpdoc->lpszOutput)); - lpsegdoc->lpszDatatype = SEGPTR_GET(SEGPTR_STRDUP(lpdoc->lpszDatatype)); - lpsegdoc->fwType = lpdoc->fwType; - segout = SEGPTR_GET(lpsegdoc); - } - break; + case NEWFRAME: + return EndPage( hdc ); case SETABORTPROC: - SetAbortProc(hdc, (ABORTPROC)lpszInData); - break; + return SetAbortProc( hdc, (ABORTPROC)in_data ); - /* Escape(hdc,END_PATH,PATHINFO,NULL); */ - case END_PATH: - { - BYTE *p = SEGPTR_ALLOC(cbInput); - memcpy(p, lpszInData, cbInput); - segin = SEGPTR_GET(p); - break; - } + case STARTDOC: + { + DOCINFOA doc; + char *name = NULL; - default: - break; + /* in_data may not be 0 terminated so we must copy it */ + if (in_data) + { + name = HeapAlloc( GetProcessHeap(), 0, in_count+1 ); + memcpy( name, in_data, in_count ); + name[in_count] = 0; + } + /* out_data is actually a pointer to the DocInfo structure and used as + * a second input parameter */ + if (out_data) doc = *(DOCINFOA *)out_data; + else + { + doc.cbSize = sizeof(doc); + doc.lpszOutput = NULL; + doc.lpszDatatype = NULL; + doc.fwType = 0; + } + doc.lpszDocName = name; + ret = StartDocA( hdc, &doc ); + if (name) HeapFree( GetProcessHeap(), 0, name ); + if (ret > 0) ret = StartPage( hdc ); + return ret; + } - } - - ret = dc->funcs->pEscape( dc, nEscape, cbInput, segin, segout ); - - switch(nEscape) { case QUERYESCSUPPORT: - if (ret) - TRACE("target DC implements Escape %d\n",nEscape); - SEGPTR_FREE(MapSL(segin)); - break; - - case SETLINECAP: - case SETLINEJOIN: - case SETMITERLIMIT: - *(LPINT)lpvOutData = *(LPINT16)MapSL(segout); - SEGPTR_FREE(MapSL(segin)); - SEGPTR_FREE(MapSL(segout)); - break; - case GETSCALINGFACTOR: - case GETPRINTINGOFFSET: - case GETPHYSPAGESIZE: { - LPPOINT16 x = MapSL(segout); - CONV_POINT16TO32(x,(LPPOINT)lpvOutData); - SEGPTR_FREE(x); - break; - } - case EXT_DEVICE_CAPS: - *(LPDWORD)lpvOutData = *(LPDWORD)MapSL(segout); - SEGPTR_FREE(MapSL(segin)); - SEGPTR_FREE(MapSL(segout)); - break; - - case GETTECHNOLOGY: { - LPSTR x=MapSL(segout); - strcpy(lpvOutData,x); - SEGPTR_FREE(x); - break; - } - case ENABLEPAIRKERNING: { - LPINT16 enab = MapSL(segout); - - *(LPINT)lpvOutData = *enab; - SEGPTR_FREE(enab); - SEGPTR_FREE(MapSL(segin)); - break; - } - case GETFACENAME: { - LPSTR x = (LPSTR)MapSL(segout); - strcpy(lpvOutData,x); - SEGPTR_FREE(x); - break; - } - case STARTDOC: { - DOCINFO16 *doc = MapSL(segout); - SEGPTR_FREE(MapSL(doc->lpszDocName)); - SEGPTR_FREE(MapSL(doc->lpszOutput)); - SEGPTR_FREE(MapSL(doc->lpszDatatype)); - SEGPTR_FREE(doc); - SEGPTR_FREE(MapSL(segin)); - break; + { + INT *ptr = (INT *)in_data; + if (in_count < sizeof(INT)) return 0; + switch(*ptr) + { + case ABORTDOC: + case ENDDOC: + case GETPHYSPAGESIZE: + case GETPRINTINGOFFSET: + case GETSCALINGFACTOR: + case NEWFRAME: + case QUERYESCSUPPORT: + case SETABORTPROC: + case STARTDOC: + return TRUE; + } + break; + } } - case CLIP_TO_PATH: - case END_PATH: - SEGPTR_FREE(MapSL(segin)); - break; - - default: - break; - } - done: - GDI_ReleaseObj( hdc ); - return ret; + /* if not handled internally, pass it to the driver */ + return ExtEscape( hdc, escape, in_count, in_data, 0, out_data ); } + /****************************************************************************** * ExtEscape [GDI32.@] * @@ -257,25 +326,21 @@ INT WINAPI Escape( HDC hdc, INT nEscape, INT cbInput, * Not implemented: 0 * Failure: <0 */ -INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, - LPCSTR lpszInData, INT cbOutput, LPSTR lpszOutData ) +INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData, + INT cbOutput, LPSTR lpszOutData ) { - char *inBuf, *outBuf; - INT ret; - - inBuf = SEGPTR_ALLOC(cbInput); - memcpy(inBuf, lpszInData, cbInput); - outBuf = cbOutput ? SEGPTR_ALLOC(cbOutput) : NULL; - ret = Escape16( hdc, nEscape, cbInput, SEGPTR_GET(inBuf), - SEGPTR_GET(outBuf) ); - SEGPTR_FREE(inBuf); - if(outBuf) { - memcpy(lpszOutData, outBuf, cbOutput); - SEGPTR_FREE(outBuf); + INT ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + if (dc->funcs->pExtEscape) + ret = dc->funcs->pExtEscape( dc, nEscape, cbInput, lpszInData, cbOutput, lpszOutData ); + GDI_ReleaseObj( hdc ); } return ret; } + /******************************************************************* * DrawEscape [GDI32.@] * diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c index 3f2ffe38a39..bde28d9baa0 100644 --- a/graphics/metafiledrv/init.c +++ b/graphics/metafiledrv/init.c @@ -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 */ diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c index 935f2cc9b50..d711c8d6111 100644 --- a/graphics/win16drv/init.c +++ b/graphics/win16drv/init.c @@ -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; } diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c index 9d1ee22bb9d..aa3d12d24b0 100644 --- a/graphics/x11drv/init.c +++ b/graphics/x11drv/init.c @@ -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; } diff --git a/include/gdi.h b/include/gdi.h index 1b9fba34078..18a5ed36a4e 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -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*); diff --git a/include/wine/wingdi16.h b/include/wine/wingdi16.h index 7e883ba39b8..157801f2ad0 100644 --- a/include/wine/wingdi16.h +++ b/include/wine/wingdi16.h @@ -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*); diff --git a/include/x11drv.h b/include/x11drv.h index ff5642990f1..3aaa14f5db8 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -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