Bladeren bron

Require exact multiple match to be more exact.

Graham Booker 6 jaren geleden
bovenliggende
commit
8505327a56
1 gewijzigde bestanden met toevoegingen van 3 en 2 verwijderingen
  1. 3 2
      src/display/DisplayManager.cpp

+ 3 - 2
src/display/DisplayManager.cpp

@@ -85,11 +85,12 @@ bool DisplayManager::isRateMultipleOf(float refresh, float multiple, bool exact)
   if (roundedRefresh == 0)
       return false;
 
-  float newRate = roundedMultiple / roundedRefresh * refresh;
+  long factor = roundedMultiple / roundedRefresh;
+  float newRate = factor * refresh;
   if (newRate < 1)
     return false;
 
-  float tolerance = exact ? 0.1 : 1;
+  float tolerance = exact ? 0.01 * factor : 1;
 
   return fabs(newRate - multiple) < tolerance;
 }