Commit f7c15b9f authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineps: Use a tri-state to describe the passthrough state.

parent 0e35782f
......@@ -269,11 +269,12 @@ 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.in_passthrough) {
write_spool(dev, psbegindocument, sizeof(psbegindocument)-1);
physDev->job.in_passthrough = TRUE;
if (physDev->job.passthrough_state == passthrough_none)
{
write_spool(dev, psbegindocument, sizeof(psbegindocument) - 1);
physDev->job.passthrough_state = passthrough_active;
}
return write_spool(dev,((char*)in_data)+2,*(const WORD*)in_data);
return write_spool(dev, ((char*)in_data) + 2, *(const WORD*)in_data);
}
case POSTSCRIPT_IGNORE:
......@@ -451,8 +452,7 @@ INT PSDRV_StartDoc( PHYSDEV dev, const DOCINFOW *doc )
physDev->job.OutOfPage = TRUE;
physDev->job.PageNo = 0;
physDev->job.quiet = FALSE;
physDev->job.in_passthrough = FALSE;
physDev->job.had_passthrough_rect = FALSE;
physDev->job.passthrough_state = passthrough_none;
physDev->job.doc_name = strdupW( doc->lpszDocName );
return physDev->job.id;
......
......@@ -113,12 +113,14 @@ BOOL PSDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
/* Windows does something truly hacky here. If we're in passthrough mode
and our rop is R2_NOP, then we output the string below. This is used in
Office 2k when inserting eps files */
if(physDev->job.in_passthrough && !physDev->job.had_passthrough_rect && GetROP2(dev->hdc) == R2_NOP) {
char buf[256];
sprintf(buf, "N %d %d %d %d B\n", rect.right - rect.left, rect.bottom - rect.top, rect.left, rect.top);
write_spool(dev, buf, strlen(buf));
physDev->job.had_passthrough_rect = TRUE;
return TRUE;
if (physDev->job.passthrough_state == passthrough_active && GetROP2(dev->hdc) == R2_NOP)
{
char buf[256];
sprintf(buf, "N %d %d %d %d B\n", rect.right - rect.left, rect.bottom - rect.top, rect.left, rect.top);
write_spool(dev, buf, strlen(buf));
physDev->job.passthrough_state = passthrough_had_rect;
return TRUE;
}
PSDRV_SetPen(dev);
......
......@@ -226,9 +226,9 @@ DWORD PSDRV_WriteSpool(PHYSDEV dev, LPCSTR lpData, DWORD cch)
return 0;
}
if(physDev->job.in_passthrough) { /* Was in PASSTHROUGH mode */
if(physDev->job.passthrough_state != passthrough_none) { /* Was in PASSTHROUGH mode */
write_spool( dev, psenddocument, sizeof(psenddocument)-1 );
physDev->job.in_passthrough = physDev->job.had_passthrough_rect = FALSE;
physDev->job.passthrough_state = passthrough_none;
}
if(physDev->job.OutOfPage) { /* Will get here after NEWFRAME Escape */
......
......@@ -343,6 +343,13 @@ typedef struct {
BOOL set;
} PSPEN;
enum passthrough
{
passthrough_none,
passthrough_active,
passthrough_had_rect, /* See the comment in PSDRV_Rectangle */
};
typedef struct {
DWORD id; /* Job id */
HANDLE hprinter; /* Printer handle */
......@@ -352,8 +359,7 @@ typedef struct {
BOOL OutOfPage; /* Page header not sent yet */
INT PageNo;
BOOL quiet; /* Don't actually output anything */
BOOL in_passthrough; /* In PASSTHROUGH mode */
BOOL had_passthrough_rect; /* See the comment in PSDRV_Rectangle */
enum passthrough passthrough_state;
} JOB;
typedef struct
......
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