Created
January 17, 2015 04:19
-
-
Save kahrl/ae1213d791014d4afffb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/porting.cpp b/src/porting.cpp | |
index 885b36e..286b4e1 100644 | |
--- a/src/porting.cpp | |
+++ b/src/porting.cpp | |
@@ -602,7 +602,16 @@ float getDisplayDensity() | |
/* return manually specified dpi */ | |
return g_settings->getFloat("screen_dpi")/96.0; | |
} | |
- | |
+#elif defined(_WIN32) | |
+float getDisplayDensity() | |
+{ | |
+ SetProcessDPIAware(); | |
+ HDC screen = GetDC(NULL); | |
+ float dpi_x = GetDeviceCaps(screen, LOGPIXELSX); | |
+ float dpi_y = GetDeviceCaps(screen, LOGPIXELSY); | |
+ ReleaseDC(NULL, screen); | |
+ return (dpi_x + dpi_y) * 0.5; | |
+} | |
#else | |
float getDisplayDensity() | |
{ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment