Commit 410b0f4d authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

wineps: Don't store ImageableArea in print_ctx.

parent cdb57c52
......@@ -408,50 +408,6 @@ static void dump_devmode(const DEVMODEW *dm)
TRACE("dmPelsHeight %lu\n", dm->dmPelsHeight);
}
static void PSDRV_UpdateDevCaps( print_ctx *ctx )
{
int log_pixels_x = GetDeviceCaps(ctx->hdc, ASPECTX);
int log_pixels_y = GetDeviceCaps(ctx->hdc, ASPECTY);
PAGESIZE *page;
dump_devmode(&ctx->Devmode->dmPublic);
if(ctx->Devmode->dmPublic.dmFields & DM_PAPERSIZE) {
LIST_FOR_EACH_ENTRY(page, &ctx->pi->ppd->PageSizes, PAGESIZE, entry) {
if(page->WinPage == ctx->Devmode->dmPublic.dmPaperSize)
break;
}
if(&page->entry == &ctx->pi->ppd->PageSizes) {
FIXME("Can't find page\n");
SetRectEmpty(&ctx->ImageableArea);
} else if(page->ImageableArea) {
/* ctx sizes in device units; ppd sizes in 1/72" */
SetRect(&ctx->ImageableArea, page->ImageableArea->llx * log_pixels_x / 72,
page->ImageableArea->ury * log_pixels_y / 72,
page->ImageableArea->urx * log_pixels_x / 72,
page->ImageableArea->lly * log_pixels_y / 72);
} else {
ctx->ImageableArea.left = ctx->ImageableArea.bottom = 0;
ctx->ImageableArea.right = page->PaperDimension->x * log_pixels_x / 72;
ctx->ImageableArea.top = page->PaperDimension->y * log_pixels_y / 72;
}
} else if((ctx->Devmode->dmPublic.dmFields & DM_PAPERLENGTH) &&
(ctx->Devmode->dmPublic.dmFields & DM_PAPERWIDTH)) {
/* ctx sizes in device units; Devmode sizes in 1/10 mm */
ctx->ImageableArea.left = ctx->ImageableArea.bottom = 0;
ctx->ImageableArea.right =
ctx->Devmode->dmPublic.dmPaperWidth * log_pixels_x / 254;
ctx->ImageableArea.top =
ctx->Devmode->dmPublic.dmPaperLength * log_pixels_y / 254;
} else {
FIXME("Odd dmFields %lx\n", ctx->Devmode->dmPublic.dmFields);
SetRectEmpty(&ctx->ImageableArea);
}
TRACE("ImageableArea = %s\n", wine_dbgstr_rect(&ctx->ImageableArea));
}
print_ctx *create_print_ctx( HDC hdc, const WCHAR *device,
const DEVMODEW *devmode )
{
......@@ -494,7 +450,6 @@ print_ctx *create_print_ctx( HDC hdc, const WCHAR *device,
PSDRV_MergeDevmodes( ctx->Devmode, devmode, pi );
}
PSDRV_UpdateDevCaps( ctx );
SelectObject( hdc, GetStockObject( DEVICE_DEFAULT_FONT ));
return ctx;
}
......@@ -502,12 +457,12 @@ print_ctx *create_print_ctx( HDC hdc, const WCHAR *device,
/**********************************************************************
* ResetDC (WINEPS.@)
*/
BOOL CDECL PSDRV_ResetDC( print_ctx *ctx, const DEVMODEW *lpInitData )
BOOL CDECL PSDRV_ResetDC( print_ctx *ctx, const DEVMODEW *devmode )
{
if (lpInitData)
if (devmode)
{
PSDRV_MergeDevmodes(ctx->Devmode, lpInitData, ctx->pi);
PSDRV_UpdateDevCaps(ctx);
dump_devmode( devmode );
PSDRV_MergeDevmodes( ctx->Devmode, devmode, ctx->pi );
}
return TRUE;
}
......
......@@ -400,7 +400,7 @@ INT PSDRV_WriteHeader( print_ctx *ctx, LPCWSTR title )
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, log_pixels_x, log_pixels_y;
int llx, lly, urx, ury;
int ret, len;
const char * dmOrientation;
......@@ -429,12 +429,34 @@ INT PSDRV_WriteHeader( print_ctx *ctx, LPCWSTR title )
/* BBox co-ords are in default user co-ord system so urx < ury even in
landscape mode */
log_pixels_x = GetDeviceCaps(ctx->hdc, ASPECTX);
log_pixels_y = GetDeviceCaps(ctx->hdc, ASPECTY);
llx = ctx->ImageableArea.left * 72.0 / log_pixels_x;
lly = ctx->ImageableArea.bottom * 72.0 / log_pixels_y;
urx = ctx->ImageableArea.right * 72.0 / log_pixels_x;
ury = ctx->ImageableArea.top * 72.0 / log_pixels_y;
if ((ctx->Devmode->dmPublic.dmFields & DM_PAPERSIZE) && page)
{
if (page->ImageableArea)
{
llx = page->ImageableArea->llx;
lly = page->ImageableArea->lly;
urx = page->ImageableArea->urx;
ury = page->ImageableArea->ury;
}
else
{
llx = lly = 0;
urx = page->PaperDimension->x;
ury = page->PaperDimension->y;
}
}
else if ((ctx->Devmode->dmPublic.dmFields & DM_PAPERLENGTH) &&
(ctx->Devmode->dmPublic.dmFields & DM_PAPERWIDTH))
{
/* Devmode sizes in 1/10 mm */
llx = lly = 0;
urx = ctx->Devmode->dmPublic.dmPaperWidth * 72.0 / 254.0;
ury = ctx->Devmode->dmPublic.dmPaperLength * 72.0 / 254.0;
}
else
{
llx = lly = urx = ury = 0;
}
/* FIXME should do something better with BBox */
dmOrientation = (ctx->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE ? "Landscape" : "Portrait");
......@@ -519,18 +541,21 @@ INT PSDRV_WriteNewPage( print_ctx *ctx )
if(ctx->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE) {
if(ctx->pi->ppd->LandscapeOrientation == -90) {
xtrans = ctx->ImageableArea.right;
ytrans = ctx->ImageableArea.top;
rotation = 90;
} else {
xtrans = ctx->ImageableArea.left;
ytrans = ctx->ImageableArea.bottom;
rotation = -90;
}
xtrans = GetDeviceCaps(ctx->hdc, PHYSICALHEIGHT) -
GetDeviceCaps(ctx->hdc, PHYSICALOFFSETY);
ytrans = GetDeviceCaps(ctx->hdc, PHYSICALWIDTH) -
GetDeviceCaps(ctx->hdc, PHYSICALOFFSETX);
rotation = 90;
} else {
xtrans = GetDeviceCaps(ctx->hdc, PHYSICALOFFSETY);
ytrans = GetDeviceCaps(ctx->hdc, PHYSICALOFFSETX);
rotation = -90;
}
} else {
xtrans = ctx->ImageableArea.left;
ytrans = ctx->ImageableArea.top;
rotation = 0;
xtrans = GetDeviceCaps(ctx->hdc, PHYSICALOFFSETX);
ytrans = GetDeviceCaps(ctx->hdc, PHYSICALHEIGHT) -
GetDeviceCaps(ctx->hdc, PHYSICALOFFSETY);
rotation = 0;
}
sprintf(buf, psnewpage, name, ctx->job.PageNo,
......
......@@ -341,11 +341,6 @@ typedef struct
JOB job;
PSDRV_DEVMODE *Devmode;
PRINTERINFO *pi;
RECT ImageableArea; /* Imageable area in device units */
/* NB both PageSize and ImageableArea
are not rotated in landscape mode,
so PageSize.cx is generally
< PageSize.cy */
int pathdepth;
} print_ctx;
......
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