Commit b88f7246 authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Implement ResetDC and PHYSICALOFFSET[X|Y] devcaps.

Fixes to MergeDevmodes.
parent 7526fc5f
......@@ -45,11 +45,17 @@ void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
{
/* some sanity checks here on dm2 */
if(dm2->dmPublic.dmFields & DM_ORIENTATION)
if(dm2->dmPublic.dmFields & DM_ORIENTATION) {
dm1->dmPublic.u1.s1.dmOrientation = dm2->dmPublic.u1.s1.dmOrientation;
TRACE("Changing orientation to %d (%s)\n",
dm1->dmPublic.u1.s1.dmOrientation,
dm1->dmPublic.u1.s1.dmOrientation == DMORIENT_PORTRAIT ?
"Portrait" :
(dm1->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE ?
"Landscape" : "unknown"));
}
/* NB PaperWidth is always < PaperLength */
if(dm2->dmPublic.dmFields & DM_PAPERSIZE) {
PAGESIZE *page;
......@@ -63,6 +69,8 @@ void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
254.0 / 72.0;
dm1->dmPublic.u1.s1.dmPaperLength = page->PaperDimension->y *
254.0 / 72.0;
dm1->dmPublic.dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH);
dm1->dmPublic.dmFields |= DM_PAPERSIZE;
TRACE("Changing page to %s %d x %d\n", page->FullName,
dm1->dmPublic.u1.s1.dmPaperWidth,
dm1->dmPublic.u1.s1.dmPaperLength );
......@@ -70,20 +78,22 @@ void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
TRACE("Trying to change to unsupported pagesize %d\n",
dm2->dmPublic.u1.s1.dmPaperSize);
}
}
if(dm2->dmPublic.dmFields & DM_PAPERLENGTH) {
} else if((dm2->dmPublic.dmFields & DM_PAPERLENGTH) &&
(dm2->dmPublic.dmFields & DM_PAPERWIDTH)) {
dm1->dmPublic.u1.s1.dmPaperLength = dm2->dmPublic.u1.s1.dmPaperLength;
TRACE("Changing PaperLength to %d\n",
dm2->dmPublic.u1.s1.dmPaperLength);
FIXME("Changing PaperLength. Do we adjust PaperSize?\n");
}
if(dm2->dmPublic.dmFields & DM_PAPERWIDTH) {
dm1->dmPublic.u1.s1.dmPaperWidth = dm2->dmPublic.u1.s1.dmPaperWidth;
TRACE("Changing PaperWidth to %d\n",
TRACE("Changing PaperLength|Width to %dx%d\n",
dm2->dmPublic.u1.s1.dmPaperLength,
dm2->dmPublic.u1.s1.dmPaperWidth);
FIXME("Changing PaperWidth. Do we adjust PaperSize?\n");
dm1->dmPublic.dmFields &= ~DM_PAPERSIZE;
dm1->dmPublic.dmFields |= (DM_PAPERLENGTH | DM_PAPERWIDTH);
} else if(dm2->dmPublic.dmFields & (DM_PAPERLENGTH | DM_PAPERWIDTH)) {
/* You might think that this would be allowed if dm1 is in custom size
mode, but apparently Windows reverts to standard paper mode even in
this case */
FIXME("Trying to change only paperlength or paperwidth\n");
dm1->dmPublic.dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH);
dm1->dmPublic.dmFields |= DM_PAPERSIZE;
}
if(dm2->dmPublic.dmFields & DM_SCALE) {
......
......@@ -237,10 +237,10 @@ INT PSDRV_WriteHeader( PSDRV_PDEVICE *physDev, LPCSTR title )
/* BBox co-ords are in default user co-ord system so urx < ury even in
landscape mode */
llx = physDev->PageSize.left * 72.0 / physDev->logPixelsX;
lly = physDev->PageSize.bottom * 72.0 / physDev->logPixelsY;
urx = physDev->PageSize.right * 72.0 / physDev->logPixelsX;
ury = physDev->PageSize.top * 72.0 / physDev->logPixelsY;
llx = physDev->ImageableArea.left * 72.0 / physDev->logPixelsX;
lly = physDev->ImageableArea.bottom * 72.0 / physDev->logPixelsY;
urx = physDev->ImageableArea.right * 72.0 / physDev->logPixelsX;
ury = physDev->ImageableArea.top * 72.0 / physDev->logPixelsY;
if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) {
orient = "Landscape";
......@@ -346,17 +346,17 @@ INT PSDRV_WriteNewPage( PSDRV_PDEVICE *physDev )
if(physDev->Devmode->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE) {
if(physDev->pi->ppd->LandscapeOrientation == -90) {
xtrans = physDev->PageSize.right;
ytrans = physDev->PageSize.top;
xtrans = physDev->ImageableArea.right;
ytrans = physDev->ImageableArea.top;
rotation = 90;
} else {
xtrans = physDev->PageSize.left;
ytrans = physDev->PageSize.bottom;
xtrans = physDev->ImageableArea.left;
ytrans = physDev->ImageableArea.bottom;
rotation = -90;
}
} else {
xtrans = physDev->PageSize.left;
ytrans = physDev->PageSize.top;
xtrans = physDev->ImageableArea.left;
ytrans = physDev->ImageableArea.top;
rotation = 0;
}
......
......@@ -277,7 +277,12 @@ typedef struct {
JOB job;
PSDRV_DEVMODEA *Devmode;
PRINTERINFO *pi;
RECT PageSize; /* Imageable area in device co-ords */
SIZE PageSize; /* Physical page size in device units */
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 horzRes; /* device caps */
int vertRes;
int horzSize;
......
......@@ -38,6 +38,7 @@ debug_channels (psdrv)
@ cdecl Polygon(ptr ptr long) PSDRV_Polygon
@ cdecl Polyline(ptr ptr long) PSDRV_Polyline
@ cdecl Rectangle(ptr long long long long) PSDRV_Rectangle
@ cdecl ResetDC(ptr ptr) PSDRV_ResetDC
@ cdecl RoundRect(ptr long long long long long long) PSDRV_RoundRect
@ cdecl SelectBitmap(ptr long) PSDRV_SelectBitmap
@ cdecl SelectBrush(ptr long) PSDRV_SelectBrush
......
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