File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -647,7 +647,8 @@ const char *getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type)
647
647
648
648
#ifndef __ANDROID__
649
649
#ifdef XORG_USED
650
- float getDisplayDensity ()
650
+
651
+ static float calcDisplayDensity ()
651
652
{
652
653
const char * current_display = getenv (" DISPLAY" );
653
654
@@ -665,14 +666,22 @@ float getDisplayDensity()
665
666
666
667
XCloseDisplay (x11display);
667
668
668
- return ( std::max (dpi_height,dpi_width) / 96.0 ) ;
669
+ return std::max (dpi_height,dpi_width) / 96.0 ;
669
670
}
670
671
}
671
672
672
673
/* return manually specified dpi */
673
674
return g_settings->getFloat (" screen_dpi" )/96.0 ;
674
675
}
675
676
677
+
678
+ float getDisplayDensity ()
679
+ {
680
+ static float cached_display_density = calcDisplayDensity ();
681
+ return cached_display_density;
682
+ }
683
+
684
+
676
685
#else
677
686
float getDisplayDensity ()
678
687
{
You can’t perform that action at this time.
0 commit comments