summaryrefslogtreecommitdiffstats
path: root/printing/units.cc
diff options
context:
space:
mode:
Diffstat (limited to 'printing/units.cc')
-rw-r--r--printing/units.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/printing/units.cc b/printing/units.cc
index 976fa80..84d78bb 100644
--- a/printing/units.cc
+++ b/printing/units.cc
@@ -5,6 +5,7 @@
#include "printing/units.h"
#include "base/logging.h"
+#include "printing/print_job_constants.h"
namespace printing {
@@ -47,4 +48,18 @@ double ConvertPixelsToPointDouble(double pixels) {
return ConvertUnitDouble(pixels, kPixelsPerInch, kPointsPerInch);
}
+double ConvertPointsToPixelDouble(double points) {
+ return ConvertUnitDouble(points, kPointsPerInch, kPixelsPerInch);
+}
+
+double GetHeaderFooterSegmentWidth(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;
+}
+
} // namespace printing