Commit 187f90d8 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineps: Add helpers to enter and leave passthrough.

parent f7c15b9f
......@@ -44,10 +44,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
static const char psbegindocument[] =
"%%BeginDocument: Wine passthrough\n";
DWORD write_spool( PHYSDEV dev, const void *data, DWORD num )
{
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
......@@ -269,11 +265,7 @@ INT PSDRV_ExtEscape( PHYSDEV dev, INT nEscape, INT cbInput, LPCVOID in_data,
* length of the string, rather than 2 more. So we'll use the WORD at
* in_data[0] instead.
*/
if (physDev->job.passthrough_state == passthrough_none)
{
write_spool(dev, psbegindocument, sizeof(psbegindocument) - 1);
physDev->job.passthrough_state = passthrough_active;
}
passthrough_enter(dev);
return write_spool(dev, ((char*)in_data) + 2, *(const WORD*)in_data);
}
......
......@@ -213,9 +213,31 @@ static const char psarrayput[] =
static const char psarraydef[] =
"/%s %d array def\n";
static const char psbegindocument[] =
"%%BeginDocument: Wine passthrough\n";
static const char psenddocument[] =
"\n%%EndDocument\n";
void passthrough_enter(PHYSDEV dev)
{
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
if (physDev->job.passthrough_state != passthrough_none) return;
write_spool(dev, psbegindocument, sizeof(psbegindocument) - 1);
physDev->job.passthrough_state = passthrough_active;
}
void passthrough_leave(PHYSDEV dev)
{
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
if (physDev->job.passthrough_state == passthrough_none) return;
write_spool(dev, psenddocument, sizeof(psenddocument) - 1);
physDev->job.passthrough_state = passthrough_none;
}
DWORD PSDRV_WriteSpool(PHYSDEV dev, LPCSTR lpData, DWORD cch)
{
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
......@@ -226,10 +248,7 @@ DWORD PSDRV_WriteSpool(PHYSDEV dev, LPCSTR lpData, DWORD cch)
return 0;
}
if(physDev->job.passthrough_state != passthrough_none) { /* Was in PASSTHROUGH mode */
write_spool( dev, psenddocument, sizeof(psenddocument)-1 );
physDev->job.passthrough_state = passthrough_none;
}
passthrough_leave(dev);
if(physDev->job.OutOfPage) { /* Will get here after NEWFRAME Escape */
if( !PSDRV_StartPage(dev) )
......
......@@ -578,6 +578,9 @@ extern void T42_free(TYPE42 *t42) DECLSPEC_HIDDEN;
extern DWORD RLE_encode(BYTE *in_buf, DWORD len, BYTE *out_buf) DECLSPEC_HIDDEN;
extern DWORD ASCII85_encode(BYTE *in_buf, DWORD len, BYTE *out_buf) DECLSPEC_HIDDEN;
extern void passthrough_enter(PHYSDEV dev) DECLSPEC_HIDDEN;
extern void passthrough_leave(PHYSDEV dev) DECLSPEC_HIDDEN;
#define push_lc_numeric(x) do { \
const char *tmplocale = setlocale(LC_NUMERIC,NULL); \
setlocale(LC_NUMERIC,x);
......
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