| Index: printing/units.cc
|
| diff --git a/printing/units.cc b/printing/units.cc
|
| index 976fa802c97e0f1a69c261be4e238214f6b7d104..7ad52cdddc974e32f76c846ff0a788c239305d9e 100644
|
| --- a/printing/units.cc
|
| +++ b/printing/units.cc
|
| @@ -5,6 +5,8 @@
|
| #include "printing/units.h"
|
|
|
| #include "base/logging.h"
|
| +#include "chrome/common/print_messages.h"
|
| +#include "printing/print_job_constants.h"
|
|
|
| namespace printing {
|
|
|
| @@ -47,4 +49,28 @@ double ConvertPixelsToPointDouble(double pixels) {
|
| return ConvertUnitDouble(pixels, kPixelsPerInch, kPointsPerInch);
|
| }
|
|
|
| +double ConvertPointsToPixelDouble(double points) {
|
| + return ConvertUnitDouble(points, kPointsPerInch, kPixelsPerInch);
|
| +}
|
| +
|
| +double GetSegmentWidth(double page_width) {
|
| + // Interstice is left at both ends of the page as well as between
|
| + // each region, so 1 is added.
|
| + double total_interstice_width =
|
| + (printing::kSettingHeaderFooterHorizontalRegions + 1) *
|
| + printing::kSettingHeaderFooterInterstice;
|
| + return (page_width - total_interstice_width) /
|
| + printing::kSettingHeaderFooterHorizontalRegions;
|
| +}
|
| +
|
| +int GetDPI(const PrintMsg_Print_Params* print_params) {
|
| +#if defined(OS_MACOSX)
|
| + // On the Mac, the printable area is in points, don't do any scaling based
|
| + // on dpi.
|
| + return printing::kPointsPerInch;
|
| +#else
|
| + return static_cast<int>(print_params->dpi);
|
| +#endif // defined(OS_MACOSX)
|
| +}
|
| +
|
| } // namespace printing
|
|
|