summaryrefslogtreecommitdiffhomepage
path: root/spline-widget
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-03-27 00:26:00 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-03-27 00:26:00 +0200
commit324e943f39ad90bac4d66d23b75e43ca42ac84a7 (patch)
tree0d2f4f8a36658ab0238c783c12584ef8c866b619 /spline-widget
parent93baa1ae8e1045bb4b7834fe90b8c21b6fb9bd76 (diff)
spline: make get_value_no_save() const
Diffstat (limited to 'spline-widget')
-rw-r--r--spline-widget/spline.cpp9
-rw-r--r--spline-widget/spline.hpp3
2 files changed, 9 insertions, 3 deletions
diff --git a/spline-widget/spline.cpp b/spline-widget/spline.cpp
index 1f457715..2db23c14 100644
--- a/spline-widget/spline.cpp
+++ b/spline-widget/spline.cpp
@@ -101,14 +101,19 @@ float spline::get_value(double x)
return ret;
}
-float spline::get_value_no_save(double x)
+float spline::get_value_no_save(double x) const
+{
+ return const_cast<spline&>(*this).get_value_no_save_internal(x);
+}
+
+float spline::get_value_no_save_internal(double x)
{
QMutexLocker foo(&_mutex);
if (max_x > 0)
x = std::min(max_x, x);
- float q = float(x * precision(s->points));
+ float q = float(x * precision(s->points));
int xi = (int)q;
float yi = get_value_internal(xi);
float yiplus1 = get_value_internal(xi+1);
diff --git a/spline-widget/spline.hpp b/spline-widget/spline.hpp
index d9635397..77b2bdf9 100644
--- a/spline-widget/spline.hpp
+++ b/spline-widget/spline.hpp
@@ -46,6 +46,7 @@ class OPENTRACK_SPLINE_EXPORT spline final
void update_interp_data();
float get_value_internal(int x);
void add_lone_point();
+ float get_value_no_save_internal(double x);
static bool sort_fn(const QPointF& one, const QPointF& two);
static QPointF ensure_in_bounds(const QList<QPointF>& points, double max_x, int i);
@@ -83,7 +84,7 @@ public:
spline(const spline&) = default;
float get_value(double x);
- float get_value_no_save(double x);
+ float get_value_no_save(double x) const;
DEFUN_WARN_UNUSED bool get_last_value(QPointF& point);
void remove_point(int i);
void clear();