summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--spline/spline.cpp9
-rw-r--r--spline/spline.hpp2
2 files changed, 6 insertions, 5 deletions
diff --git a/spline/spline.cpp b/spline/spline.cpp
index 76a6190f..3c1c3eba 100644
--- a/spline/spline.cpp
+++ b/spline/spline.cpp
@@ -134,7 +134,6 @@ float spline::get_value_internal(int x)
{
if (!validp)
{
- recompute();
update_interp_data();
validp = true;
}
@@ -191,6 +190,8 @@ void spline::update_interp_data()
{
points_t points = s->points;
+ ensure_valid(points);
+
int sz = element_count(points, max_x);
if (sz == 0)
@@ -384,11 +385,11 @@ void spline::set_bundle(bundle b)
}
}
-void spline::recompute()
+void spline::ensure_valid(const QList<QPointF>& the_points)
{
QMutexLocker foo(&_mutex);
- QList<QPointF> list = s->points;
+ QList<QPointF> list = the_points;
// storing to s->points fires bundle::changed and that leads to an infinite loop
// thus, only store if we can't help it
@@ -419,7 +420,7 @@ void spline::recompute()
ret_list.push_back(pt);
}
- if (ret_list != s->points)
+ if (ret_list != the_points)
s->points = ret_list;
last_input_value = QPointF(0, 0);
diff --git a/spline/spline.hpp b/spline/spline.hpp
index 85287e38..328d1ece 100644
--- a/spline/spline.hpp
+++ b/spline/spline.hpp
@@ -97,7 +97,7 @@ public:
void set_tracking_active(bool value);
bundle get_bundle();
- void recompute();
+ void ensure_valid(const QList<QPointF>& the_points);
std::shared_ptr<settings> get_settings();
std::shared_ptr<const settings> get_settings() const;