wineps.drv: Many MacOSX generated ppd files don't include a *ColorDevice line. Treat these as if they were colour.

This commit is contained in:
Huw Davies 2007-03-01 14:29:47 +00:00 committed by Alexandre Julliard
parent beff84c1d3
commit 9222ec3cce
5 changed files with 21 additions and 8 deletions

View File

@ -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;

View File

@ -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:

View File

@ -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:

View File

@ -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)) ||

View File

@ -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;