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:
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);
+}