Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/libdocument/ev-document-misc.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2010-02-21 11:29:24 (GMT)
committer Carlos Garcia Campos <carlosgc@gnome.org>2010-02-21 11:29:24 (GMT)
commit8ee88d8e916cb126a0a12e4816b9d1043cbd6472 (patch)
tree2232d5b36f4c451f6e18ee72c06b034b2e9c5478 /libdocument/ev-document-misc.c
parentdb8a118298552769e835c67d29dfe1fa41de698a (diff)
Move get_screen_dpi to libdocument
Diffstat (limited to 'libdocument/ev-document-misc.c')
-rw-r--r--libdocument/ev-document-misc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c
index 14bc3a3..0a23394 100644
--- a/libdocument/ev-document-misc.c
+++ b/libdocument/ev-document-misc.c
@@ -21,6 +21,7 @@
#include <config.h>
#include <string.h>
+#include <math.h>
#include <gtk/gtk.h>
@@ -363,3 +364,17 @@ ev_document_misc_invert_pixbuf (GdkPixbuf *pixbuf)
}
}
}
+
+gdouble
+ev_document_misc_get_screen_dpi (GdkScreen *screen)
+{
+ gdouble dp, di;
+
+ /*diagonal in pixels*/
+ dp = hypot (gdk_screen_get_width (screen), gdk_screen_get_height (screen));
+
+ /*diagonal in inches*/
+ di = hypot (gdk_screen_get_width_mm(screen), gdk_screen_get_height_mm (screen)) / 25.4;
+
+ return (dp / di);
+}