summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--qfunctionconfigurator/functionconfig.cpp4
-rw-r--r--qfunctionconfigurator/functionconfig.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp
index 69522da9..6db3b55f 100644
--- a/qfunctionconfigurator/functionconfig.cpp
+++ b/qfunctionconfigurator/functionconfig.cpp
@@ -34,7 +34,7 @@ Map::Map() :
float Map::getValue(float x) {
QMutexLocker foo(&_mutex);
- int x2 = (int) (std::min<float>(std::max<float>(x, -360), 360) * MEMOIZE_PRECISION);
+ int x2 = x * (double) MEMOIZE_PRECISION;
float ret = getValueInternal(x2);
last_input_value.setX(x);
last_input_value.setY(ret);
@@ -55,7 +55,7 @@ float Map::getValueInternal(int x) {
if (sz == 0)
ret = 0;
else
- ret = std::max(std::min(x, sz-1), 0);
+ ret = data[std::max(std::min(x, sz-1), 0)];
return ret * sign;
}
diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h
index ccfd1ba3..7d21fd63 100644
--- a/qfunctionconfigurator/functionconfig.h
+++ b/qfunctionconfigurator/functionconfig.h
@@ -17,10 +17,10 @@
#include "../facetracknoir/plugin-api.hpp"
#include "../facetracknoir/qcopyable-mutex.hpp"
-#define MEMOIZE_PRECISION 100
class OPENTRACK_EXPORT Map {
private:
+ static constexpr long MEMOIZE_PRECISION = 25;
void reload();
float getValueInternal(int x);