summaryrefslogtreecommitdiffhomepage
path: root/spline-widget
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-05-26 17:11:39 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-05-26 17:19:20 +0200
commitd7f71f721449853efa88479035c7139898a2a6a5 (patch)
treee5716dd10ef2ce8f95a046383dcd38c69d41c367 /spline-widget
parentb008aefee41a21b24f1d2f1f23cd6c78b888ede5 (diff)
spline-widget: don't use `double' when not needed
Diffstat (limited to 'spline-widget')
-rw-r--r--spline-widget/functionconfig.cpp10
-rw-r--r--spline-widget/functionconfig.h14
-rw-r--r--spline-widget/qfunctionconfigurator.cpp6
3 files changed, 15 insertions, 15 deletions
diff --git a/spline-widget/functionconfig.cpp b/spline-widget/functionconfig.cpp
index 5c5740d2..9b4ba1b6 100644
--- a/spline-widget/functionconfig.cpp
+++ b/spline-widget/functionconfig.cpp
@@ -34,31 +34,31 @@ void Map::removeAllPoints()
reload();
}
-void Map::setMaxInput(double max_input)
+void Map::setMaxInput(float max_input)
{
QMutexLocker l(&_mutex);
max_x = max_input;
}
-void Map::setMaxOutput(double max_output)
+void Map::setMaxOutput(float max_output)
{
QMutexLocker l(&_mutex);
max_y = max_output;
}
-double Map::maxInput() const
+float Map::maxInput() const
{
QMutexLocker l(&_mutex);
return max_x;
}
-double Map::maxOutput() const
+float Map::maxOutput() const
{
QMutexLocker l(&_mutex);
return max_y;
}
-Map::Map(double maxx, double maxy) :
+Map::Map(float maxx, float maxy) :
_mutex(QMutex::Recursive),
max_x(0),
max_y(0),
diff --git a/spline-widget/functionconfig.h b/spline-widget/functionconfig.h
index 4db24b84..9bf1671b 100644
--- a/spline-widget/functionconfig.h
+++ b/spline-widget/functionconfig.h
@@ -39,15 +39,15 @@ private:
MyMutex _mutex;
QPointF last_input_value;
- double max_x;
- double max_y;
+ float max_x;
+ float max_y;
volatile bool activep;
State cur, saved;
public:
- double maxInput() const;
- double maxOutput() const;
+ float maxInput() const;
+ float maxOutput() const;
Map();
- Map(double maxx, double maxy);
+ Map(float maxx, float maxy);
float getValue(float x);
bool getLastPoint(QPointF& point);
@@ -57,8 +57,8 @@ public:
void addPoint(QPointF pt);
void movePoint(int idx, QPointF pt);
const QList<QPointF> getPoints();
- void setMaxInput(double MaxInput);
- void setMaxOutput(double MaxOutput);
+ void setMaxInput(float MaxInput);
+ void setMaxOutput(float MaxOutput);
void saveSettings(QSettings& settings, const QString& title);
void loadSettings(QSettings& settings, const QString& title);
diff --git a/spline-widget/qfunctionconfigurator.cpp b/spline-widget/qfunctionconfigurator.cpp
index 086d3703..8a3eef85 100644
--- a/spline-widget/qfunctionconfigurator.cpp
+++ b/spline-widget/qfunctionconfigurator.cpp
@@ -386,9 +386,9 @@ void QFunctionConfigurator::update_range()
if (!_config)
return;
- const double w = width(), h = height();
- const double mwl = 40, mhl = 20;
- const double mwr = 15, mhr = 35;
+ const int w = width(), h = height();
+ const int mwl = 40, mhl = 20;
+ const int mwr = 15, mhr = 35;
pixel_bounds = QRectF(mwl, mhl, (w - mwl - mwr), (h - mhl - mhr));
c = QPointF(pixel_bounds.width() / _config->maxInput(), pixel_bounds.height() / _config->maxOutput());