From 3e913cdf543d5d4b2fd297eb27f3536be692100c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 7 May 2017 11:31:12 +0200 Subject: spline: rename, change call site --- spline/spline.cpp | 9 +++++---- spline/spline.hpp | 2 +- 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& the_points) { QMutexLocker foo(&_mutex); - QList list = s->points; + QList 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& the_points); std::shared_ptr get_settings(); std::shared_ptr get_settings() const; -- cgit v1.2.3