Huw Davies : wineps: Add helpers to enter and leave passthrough.
Alexandre Julliard
julliard at winehq.org
Wed Oct 3 18:23:29 CDT 2018
Module: wine
Branch: master
Commit: 187f90d89912959cefdfb55c015d81704d26b31a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=187f90d89912959cefdfb55c015d81704d26b31a
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Oct 3 11:39:20 2018 +0100
wineps: Add helpers to enter and leave passthrough.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wineps.drv/escape.c | 10 +---------
dlls/wineps.drv/ps.c | 27 +++++++++++++++++++++++----
dlls/wineps.drv/psdrv.h | 3 +++
3 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/dlls/wineps.drv/escape.c b/dlls/wineps.drv/escape.c
index f9616bc..7b90116 100644
--- a/dlls/wineps.drv/escape.c
+++ b/dlls/wineps.drv/escape.c
@@ -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);
}
diff --git a/dlls/wineps.drv/ps.c b/dlls/wineps.drv/ps.c
index 663cc23..4fd3c76 100644
--- a/dlls/wineps.drv/ps.c
+++ b/dlls/wineps.drv/ps.c
@@ -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) )
diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h
index d92fbb3..9cbee65 100644
--- a/dlls/wineps.drv/psdrv.h
+++ b/dlls/wineps.drv/psdrv.h
@@ -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);
More information about the wine-cvs
mailing list