Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix performance regression
  • Loading branch information
Zeno- committed Feb 5, 2015
1 parent 929e0b0 commit 9a0dd47
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/porting.cpp
Expand Up @@ -647,7 +647,8 @@ const char *getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type)

#ifndef __ANDROID__
#ifdef XORG_USED
float getDisplayDensity()

static float calcDisplayDensity()
{
const char* current_display = getenv("DISPLAY");

Expand All @@ -665,14 +666,22 @@ float getDisplayDensity()

XCloseDisplay(x11display);

return (std::max(dpi_height,dpi_width) / 96.0);
return std::max(dpi_height,dpi_width) / 96.0;
}
}

/* return manually specified dpi */
return g_settings->getFloat("screen_dpi")/96.0;
}


float getDisplayDensity()
{
static float cached_display_density = calcDisplayDensity();
return cached_display_density;
}


#else
float getDisplayDensity()
{
Expand Down

0 comments on commit 9a0dd47

Please sign in to comment.