#ifndef __ANDROID__
#ifdef XORG_USED
-float getDisplayDensity()
+
+static float calcDisplayDensity()
{
const char* current_display = getenv("DISPLAY");
XCloseDisplay(x11display);
- return (std::max(dpi_height,dpi_width) / 96.0);
+ return std::max(dpi_height,dpi_width) / 96.0;
}
}
return g_settings->getFloat("screen_dpi")/96.0;
}
+
+float getDisplayDensity()
+{
+ static float cached_display_density = calcDisplayDensity();
+ return cached_display_density;
+}
+
+
#else
float getDisplayDensity()
{