Changed printer page setup units to be in device co-ordinates (this is pixels on Windows and points on the Mac). Also fixed a bug with Mac dpi calculation.
BUG=None.
TEST=Test printing on Windows and Mac.
Review URL: http://codereview.chromium.org/2351003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48558 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/printing/printed_document.cc b/printing/printed_document.cc
index 7850073b..f49e1e6 100644
--- a/printing/printed_document.cc
+++ b/printing/printed_document.cc
@@ -75,7 +75,8 @@
// be shown. Users dislike 0-based counting.
scoped_refptr<PrintedPage> page(
new PrintedPage(page_number + 1,
- metafile, immutable_.settings_.page_setup_pixels().physical_size()));
+ metafile,
+ immutable_.settings_.page_setup_device_units().physical_size()));
{
AutoLock lock(lock_);
mutable_.pages_[page_number] = page;
@@ -195,10 +196,12 @@
const gfx::Size string_size(font.GetStringWidth(output), font.height());
gfx::Rect bounding;
bounding.set_height(string_size.height());
- const gfx::Rect& overlay_area(settings.page_setup_pixels().overlay_area());
+ const gfx::Rect& overlay_area(
+ settings.page_setup_device_units().overlay_area());
// Hard code .25 cm interstice between overlays. Make sure that some space is
// kept between each headers.
- const int interstice = ConvertUnit(250, kHundrethsMMPerInch, settings.dpi());
+ const int interstice = ConvertUnit(250, kHundrethsMMPerInch,
+ settings.device_units_per_inch());
const int max_width = overlay_area.width() / 3 - interstice;
const int actual_width = std::min(string_size.width(), max_width);
switch (x) {