Huw Davies : wineps.drv: Many MacOSX generated ppd files don'
t include a *ColorDevice line. Treat these as if they were colour.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Mar 1 16:27:08 CST 2007
Module: wine
Branch: master
Commit: 9222ec3cced71bbef25876324ed207de1645e2e3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9222ec3cced71bbef25876324ed207de1645e2e3
Author: Huw Davies <huw at codeweavers.com>
Date: Thu Mar 1 14:29:47 2007 +0000
wineps.drv: Many MacOSX generated ppd files don't include a *ColorDevice line. Treat these as if they were colour.
---
dlls/wineps.drv/color.c | 4 ++--
dlls/wineps.drv/driver.c | 2 +-
dlls/wineps.drv/init.c | 4 ++--
dlls/wineps.drv/ppd.c | 8 ++++++--
dlls/wineps.drv/psdrv.h | 11 ++++++++++-
5 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/dlls/wineps.drv/color.c b/dlls/wineps.drv/color.c
index 9a7cdb7..3dbbe20 100644
--- a/dlls/wineps.drv/color.c
+++ b/dlls/wineps.drv/color.c
@@ -84,7 +84,7 @@ BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2)
* PSDRV_CreateColor
*
* Creates a PostScript colour from a COLORREF.
- * Result is grey scale if ColorDevice field of ppd is FALSE else an
+ * Result is grey scale if ColorDevice field of ppd is CD_False else an
* rgb colour is produced.
*/
void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
@@ -100,7 +100,7 @@ void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
g = ((wincolor >> 8) & 0xff) / 256.0;
b = ((wincolor >> 16) & 0xff) / 256.0;
- if(physDev->pi->ppd->ColorDevice) {
+ if(physDev->pi->ppd->ColorDevice != CD_False) {
pscolor->type = PSCOLOR_RGB;
pscolor->value.rgb.r = r;
pscolor->value.rgb.g = g;
diff --git a/dlls/wineps.drv/driver.c b/dlls/wineps.drv/driver.c
index fececd7..124070e 100644
--- a/dlls/wineps.drv/driver.c
+++ b/dlls/wineps.drv/driver.c
@@ -632,7 +632,7 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
/* Printer supports colour printing - 1 if yes, 0 if no (Win2k/XP only) */
case DC_COLORDEVICE:
- return pi->ppd->ColorDevice;
+ return (pi->ppd->ColorDevice != CD_False) ? TRUE : FALSE;
/* Identification number of the printer manufacturer for use with ICM (Win9x only) */
case DC_MANUFACTURER:
diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index 1bd56ca..bd9c16c 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -430,7 +430,7 @@ INT PSDRV_GetDeviceCaps( PSDRV_PDEVICE *physDev, INT cap )
case VERTRES:
return physDev->vertRes;
case BITSPIXEL:
- return physDev->pi->ppd->ColorDevice ? 8 : 1;
+ return (physDev->pi->ppd->ColorDevice != CD_False) ? 8 : 1;
case PLANES:
return 1;
case NUMBRUSHES:
@@ -442,7 +442,7 @@ INT PSDRV_GetDeviceCaps( PSDRV_PDEVICE *physDev, INT cap )
case NUMFONTS:
return 39;
case NUMCOLORS:
- return (physDev->pi->ppd->ColorDevice ? 256 : -1);
+ return (physDev->pi->ppd->ColorDevice != CD_False) ? 256 : -1;
case PDEVICESIZE:
return sizeof(PSDRV_PDEVICE);
case CURVECAPS:
diff --git a/dlls/wineps.drv/ppd.c b/dlls/wineps.drv/ppd.c
index 9b7169b..a5aea3b 100644
--- a/dlls/wineps.drv/ppd.c
+++ b/dlls/wineps.drv/ppd.c
@@ -572,6 +572,8 @@ PPD *PSDRV_ParsePPD(char *fname)
return NULL;
}
+ ppd->ColorDevice = CD_NotSpecified;
+
/*
* The Windows PostScript drivers create the following "virtual bin" for
* every PostScript printer
@@ -599,8 +601,10 @@ PPD *PSDRV_ParsePPD(char *fname)
else if(!strcmp("*ColorDevice", tuple.key)) {
if(!strcasecmp(tuple.value, "true"))
- ppd->ColorDevice = TRUE;
- TRACE("ColorDevice = %d\n", (int)ppd->ColorDevice);
+ ppd->ColorDevice = CD_True;
+ else
+ ppd->ColorDevice = CD_False;
+ TRACE("ColorDevice = %s\n", ppd->ColorDevice == CD_True ? "True" : "False");
}
else if((!strcmp("*DefaultResolution", tuple.key)) ||
diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h
index 74abe39..7794a89 100644
--- a/dlls/wineps.drv/psdrv.h
+++ b/dlls/wineps.drv/psdrv.h
@@ -191,10 +191,19 @@ typedef struct _tagDUPLEX {
struct _tagDUPLEX *next;
} DUPLEX;
+/* Many MacOSX based ppd files don't include a *ColorDevice line, so
+ we use a tristate here rather than a boolean. Code that
+ cares is expected to treat these as if they were colour. */
+typedef enum {
+ CD_NotSpecified,
+ CD_False,
+ CD_True
+} COLORDEVICE;
+
typedef struct {
char *NickName;
int LanguageLevel;
- BOOL ColorDevice;
+ COLORDEVICE ColorDevice;
int DefaultResolution;
signed int LandscapeOrientation;
char *JCLBegin;
More information about the wine-cvs
mailing list