summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorgene@chromium.org <gene@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-13 23:12:01 +0000
committergene@chromium.org <gene@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-13 23:12:01 +0000
commit6999b82325159ea1650f837a62428bd4fa7a33d1 (patch)
treef76beeb2f604fe14a7ee19ae010c61698b026cae /chrome
parent25763b17f3e3ab2c5a89b05a5f272258954c6fd5 (diff)
downloadchromium_src-6999b82325159ea1650f837a62428bd4fa7a33d1.zip
chromium_src-6999b82325159ea1650f837a62428bd4fa7a33d1.tar.gz
chromium_src-6999b82325159ea1650f837a62428bd4fa7a33d1.tar.bz2
Fix issue where printing output got trunkated on the right and bottom sides.
BUG=96108 TEST=Verify Cloud Print connector printing PDFs correctly Review URL: http://codereview.chromium.org/7780017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100987 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/service/cloud_print/print_system_win.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc
index 18b1bbb..a78aff0 100644
--- a/chrome/service/cloud_print/print_system_win.cc
+++ b/chrome/service/cloud_print/print_system_win.cc
@@ -421,9 +421,18 @@ class PrintSystemWin : public PrintSystem {
printer_dc_.Set(dc);
int printer_dpi = ::GetDeviceCaps(printer_dc_.Get(), LOGPIXELSX);
+ int offset_x = ::GetDeviceCaps(printer_dc_.Get(), PHYSICALOFFSETX);
+ int offset_y = ::GetDeviceCaps(printer_dc_.Get(), PHYSICALOFFSETY);
saved_dc_ = SaveDC(printer_dc_.Get());
SetGraphicsMode(printer_dc_.Get(), GM_ADVANCED);
+
+ // Setup the matrix to translate and scale to the right place. Take in
+ // account the actual shrinking factor.
+ // Note that the printing output is relative to printable area of
+ // the page. That is 0,0 is offset by PHYSICALOFFSETX/Y from the page.
XFORM xform = {0};
+ xform.eDx = static_cast<float>(-offset_x);
+ xform.eDy = static_cast<float>(-offset_y);
xform.eM11 = xform.eM22 = static_cast<float>(printer_dpi) /
static_cast<float>(GetDeviceCaps(GetDC(NULL), LOGPIXELSX));
ModifyWorldTransform(printer_dc_.Get(), &xform, MWT_LEFTMULTIPLY);