Commit 5b166890 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

wineps: Use standard DEVMODEW structure instead of PSDRV_DEVMODE when possible.

parent 91939284
......@@ -325,7 +325,7 @@ static void PSDRV_UpdateDevCaps( print_ctx *ctx )
}
print_ctx *create_print_ctx( HDC hdc, const WCHAR *device,
const PSDRV_DEVMODE *devmode )
const DEVMODEW *devmode )
{
PRINTERINFO *pi = PSDRV_FindPrinterInfo( device );
print_ctx *ctx;
......@@ -347,21 +347,23 @@ print_ctx *create_print_ctx( HDC hdc, const WCHAR *device,
ctx = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ctx) );
if (!ctx) return NULL;
ctx->Devmode = HeapAlloc( GetProcessHeap(), 0, sizeof(PSDRV_DEVMODE) );
ctx->Devmode = HeapAlloc( GetProcessHeap(), 0,
pi->Devmode->dmPublic.dmSize + pi->Devmode->dmPublic.dmDriverExtra );
if (!ctx->Devmode)
{
HeapFree( GetProcessHeap(), 0, ctx );
return NULL;
}
*ctx->Devmode = *pi->Devmode;
memcpy( ctx->Devmode, pi->Devmode,
pi->Devmode->dmPublic.dmSize + pi->Devmode->dmPublic.dmDriverExtra );
ctx->pi = pi;
ctx->logPixelsX = pi->ppd->DefaultResolution;
ctx->logPixelsY = pi->ppd->DefaultResolution;
if (devmode)
{
dump_devmode( &devmode->dmPublic );
dump_devmode( devmode );
PSDRV_MergeDevmodes( ctx->Devmode, devmode, pi );
}
......@@ -378,7 +380,7 @@ BOOL CDECL PSDRV_ResetDC( print_ctx *ctx, const DEVMODEW *lpInitData )
{
if (lpInitData)
{
PSDRV_MergeDevmodes(ctx->Devmode, (const PSDRV_DEVMODE *)lpInitData, ctx->pi);
PSDRV_MergeDevmodes(ctx->Devmode, lpInitData, ctx->pi);
PSDRV_UpdateDevCaps(ctx);
}
return TRUE;
......@@ -545,19 +547,19 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCWSTR name)
if(GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IPAPERSIZE | LOCALE_RETURN_NUMBER,
(LPWSTR)&papersize, sizeof(papersize)/sizeof(WCHAR))) {
PSDRV_DEVMODE dm;
DEVMODEW dm;
memset(&dm, 0, sizeof(dm));
dm.dmPublic.dmFields = DM_PAPERSIZE;
dm.dmPublic.dmPaperSize = papersize;
dm.dmFields = DM_PAPERSIZE;
dm.dmPaperSize = papersize;
PSDRV_MergeDevmodes(pi->Devmode, &dm, pi);
}
}
if(pi->ppd->DefaultPageSize) { /* We'll let the ppd override the devmode */
PSDRV_DEVMODE dm;
DEVMODEW dm;
memset(&dm, 0, sizeof(dm));
dm.dmPublic.dmFields = DM_PAPERSIZE;
dm.dmPublic.dmPaperSize = pi->ppd->DefaultPageSize->WinPage;
dm.dmFields = DM_PAPERSIZE;
dm.dmPaperSize = pi->ppd->DefaultPageSize->WinPage;
PSDRV_MergeDevmodes(pi->Devmode, &dm, pi);
}
......
......@@ -2980,8 +2980,7 @@ HANDLE WINAPI OpenPrintProcessor(WCHAR *port, PRINTPROCESSOROPENDATA *open_data)
return NULL;
}
SetGraphicsMode(hdc, GM_ADVANCED);
data->ctx = create_print_ctx(hdc, open_data->pPrinterName,
(const PSDRV_DEVMODE *)open_data->pDevMode);
data->ctx = create_print_ctx(hdc, open_data->pPrinterName, open_data->pDevMode);
if (!data->ctx)
{
DeleteDC(hdc);
......
......@@ -397,9 +397,9 @@ static void write_cups_job_ticket( print_ctx *ctx, const struct ticket_info *inf
INT PSDRV_WriteHeader( print_ctx *ctx, LPCWSTR title )
{
char *buf, *escaped_title;
INPUTSLOT *slot = find_slot( ctx->pi->ppd, ctx->Devmode );
PAGESIZE *page = find_pagesize( ctx->pi->ppd, ctx->Devmode );
DUPLEX *duplex = find_duplex( ctx->pi->ppd, ctx->Devmode );
INPUTSLOT *slot = find_slot( ctx->pi->ppd, &ctx->Devmode->dmPublic );
PAGESIZE *page = find_pagesize( ctx->pi->ppd, &ctx->Devmode->dmPublic );
DUPLEX *duplex = find_duplex( ctx->pi->ppd, &ctx->Devmode->dmPublic );
int llx, lly, urx, ury;
int ret, len;
const char * dmOrientation;
......
......@@ -370,7 +370,7 @@ typedef struct
} print_ctx;
extern print_ctx *create_print_ctx( HDC hdc, const WCHAR *device,
const PSDRV_DEVMODE *devmode ) DECLSPEC_HIDDEN;
const DEVMODEW *devmode ) DECLSPEC_HIDDEN;
/*
* Every glyph name in the Adobe Glyph List and the 35 core PostScript fonts
......@@ -394,9 +394,9 @@ extern HINSTANCE PSDRV_hInstance DECLSPEC_HIDDEN;
extern HANDLE PSDRV_Heap DECLSPEC_HIDDEN;
extern char *PSDRV_ANSIVector[256] DECLSPEC_HIDDEN;
extern INPUTSLOT *find_slot( PPD *ppd, const PSDRV_DEVMODE *dm ) DECLSPEC_HIDDEN;
extern PAGESIZE *find_pagesize( PPD *ppd, const PSDRV_DEVMODE *dm ) DECLSPEC_HIDDEN;
extern DUPLEX *find_duplex( PPD *ppd, const PSDRV_DEVMODE *dm ) DECLSPEC_HIDDEN;
extern INPUTSLOT *find_slot( PPD *ppd, const DEVMODEW *dm ) DECLSPEC_HIDDEN;
extern PAGESIZE *find_pagesize( PPD *ppd, const DEVMODEW *dm ) DECLSPEC_HIDDEN;
extern DUPLEX *find_duplex( PPD *ppd, const DEVMODEW *dm ) DECLSPEC_HIDDEN;
/* GDI driver functions */
extern BOOL CDECL PSDRV_Arc( print_ctx *ctx, INT left, INT top, INT right, INT bottom,
......@@ -437,7 +437,7 @@ extern BOOL CDECL PSDRV_StrokeAndFillPath( print_ctx *ctx ) DECLSPEC_HIDDEN;
extern BOOL CDECL PSDRV_StrokePath( print_ctx *ctx ) DECLSPEC_HIDDEN;
extern BOOL CDECL PSDRV_ResetDC( print_ctx *ctx, const DEVMODEW *lpInitData ) DECLSPEC_HIDDEN;
extern void PSDRV_MergeDevmodes(PSDRV_DEVMODE *dm1, const PSDRV_DEVMODE *dm2,
extern void PSDRV_MergeDevmodes(PSDRV_DEVMODE *dm1, const DEVMODEW *dm2,
PRINTERINFO *pi) DECLSPEC_HIDDEN;
extern BOOL PSDRV_GetFontMetrics(void) DECLSPEC_HIDDEN;
extern PPD *PSDRV_ParsePPD(const WCHAR *fname, HANDLE printer) DECLSPEC_HIDDEN;
......
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