summaryrefslogtreecommitdiffstats
path: root/printing/units.h
diff options
context:
space:
mode:
authorhamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-28 09:46:00 +0000
committerhamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-28 09:46:00 +0000
commit4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4 (patch)
tree8709d2a1c9b6afcff614c4d58b774cb2ba89ff31 /printing/units.h
parentfae8f2508f0927d4099fa78be85f089bae55575c (diff)
downloadchromium_src-4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4.zip
chromium_src-4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4.tar.gz
chromium_src-4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4.tar.bz2
Create constant variables kPointsPerInch and kPixelsPerInch and conversion functions.
BUG=47277 TEST=units_unittest.cc Review URL: http://codereview.chromium.org/2877001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50968 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/units.h')
-rw-r--r--printing/units.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/printing/units.h b/printing/units.h
index d23e268..cc61241 100644
--- a/printing/units.h
+++ b/printing/units.h
@@ -10,6 +10,14 @@ namespace printing {
// Length of a thousanth of inches in 0.01mm unit.
const int kHundrethsMMPerInch = 2540;
+// Length of an inch in CSS's 1pt unit.
+// http://dev.w3.org/csswg/css3-values/#absolute-length-units-cm-mm.-in-pt-pc
+const int kPointsPerInch = 72;
+
+// Length of an inch in CSS's 1px unit.
+// http://dev.w3.org/csswg/css3-values/#the-px-unit
+const int kPixelsPerInch = 96;
+
// Converts from one unit system to another using integer arithmetics.
int ConvertUnit(int value, int old_unit, int new_unit);
@@ -22,6 +30,12 @@ int ConvertMilliInchToHundredThousanthMeter(int milli_inch);
// Converts from 0.00001 meter unit to 0.001 inch.
int ConvertHundredThousanthMeterToMilliInch(int cmm);
+// Converts from 1 pixel to 1 point using integers.
+int ConvertPixelsToPoint(int pixels);
+
+// Converts from 1 pixel to 1 point using doubles.
+double ConvertPixelsToPointDouble(double pixels);
+
} // namespace printing
#endif // PRINTING_UNITS_H_