summaryrefslogtreecommitdiffhomepage
path: root/qfunctionconfigurator
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-10-05 20:47:32 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-10-05 20:50:22 +0200
commit7581608afa596e3ab64fa312361fccf5cc409450 (patch)
tree1cdc01fd43eb0093166089ed2beb0234ba5f9549 /qfunctionconfigurator
parent1e10164eb7b66988e0404890239af7b7c1543395 (diff)
cleanup some useless logic
Diffstat (limited to 'qfunctionconfigurator')
-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);