summaryrefslogtreecommitdiffhomepage
path: root/spline
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-08-01 14:07:00 +0200
committerStanislaw Halik <sthalik@misaki.pl>2019-08-01 14:07:00 +0200
commit7d898e638abad8267420f8c0d827d21f716b8977 (patch)
tree897a31950ba0a345f05162e4e8616f26e1b69446 /spline
parentb930dd608bf95ecc3f89007313ba8ab8b1935ee5 (diff)
fix clang warnings
Diffstat (limited to 'spline')
-rw-r--r--spline/spline.cpp7
-rw-r--r--spline/spline.hpp16
2 files changed, 20 insertions, 3 deletions
diff --git a/spline/spline.cpp b/spline/spline.cpp
index 98a82711..eacf4feb 100644
--- a/spline/spline.cpp
+++ b/spline/spline.cpp
@@ -101,7 +101,7 @@ double spline::get_value_internal(int x) const
const float sign = signum(x);
x = std::abs(x);
const float ret_ = data[std::min(unsigned(x), value_count - 1)];
- return sign * clamp(ret_, 0, 1000);
+ return (double)(sign * clamp(ret_, 0, 1000));
}
void spline::ensure_in_bounds(const QList<QPointF>& points, int i, f& x, f& y)
@@ -155,6 +155,7 @@ void spline::update_interp_data() const
const double c = bucket_size_coefficient(list);
const double c_ = c * c_interp;
+ const float cf = (float)c, c_f = (float)c_;
for (unsigned i = 0; i < value_count; i++)
data[i] = magic_fill_value;
@@ -200,7 +201,7 @@ void spline::update_interp_data() const
};
// multiplier helps fill in all the x's needed
- const unsigned end = (unsigned)(c_ * (p2_x - p1_x)) + 1;
+ const unsigned end = (unsigned)(c_f * (p2_x - p1_x)) + 1;
const f end_(end);
for (unsigned k = 0; k <= end; k++)
@@ -209,7 +210,7 @@ void spline::update_interp_data() const
const f t2 = t*t;
const f t3 = t*t*t;
- const unsigned x = unsigned(f(.5) * c * (cx[0] + cx[1] * t + cx[2] * t2 + cx[3] * t3));
+ const unsigned x = unsigned(f(.5) * cf * (cx[0] + cx[1] * t + cx[2] * t2 + cx[3] * t3));
const float y = (float)(f(.5) * (cy[0] + cy[1] * t + cy[2] * t2 + cy[3] * t3));
if (x < value_count)
diff --git a/spline/spline.hpp b/spline/spline.hpp
index 85f1c969..e4f64069 100644
--- a/spline/spline.hpp
+++ b/spline/spline.hpp
@@ -48,6 +48,7 @@ public:
struct OTR_SPLINE_EXPORT base_spline_
{
+ base_spline_() = default;
virtual ~base_spline_();
virtual double get_value(double x) const = 0;
@@ -61,6 +62,9 @@ struct OTR_SPLINE_EXPORT base_spline_
virtual const points_t& get_points() const = 0;
virtual int get_point_count() const = 0;
+
+ base_spline_(const base_spline_&) = default;
+ base_spline_& operator=(const base_spline_&) = default;
};
struct OTR_SPLINE_EXPORT spline_settings_mixin
@@ -68,6 +72,10 @@ struct OTR_SPLINE_EXPORT spline_settings_mixin
virtual std::shared_ptr<base_settings> get_settings() = 0;
virtual std::shared_ptr<const base_settings> get_settings() const = 0;
+ spline_settings_mixin(const spline_settings_mixin&) = default;
+ spline_settings_mixin& operator=(const spline_settings_mixin&) = default;
+
+ spline_settings_mixin() = default;
virtual ~spline_settings_mixin();
};
@@ -79,11 +87,19 @@ struct OTR_SPLINE_EXPORT spline_modify_mixin
virtual void remove_point(int i) = 0;
virtual void clear() = 0;
+ spline_modify_mixin(const spline_modify_mixin&) = default;
+ spline_modify_mixin& operator=(const spline_modify_mixin&) = default;
+
+ spline_modify_mixin() = default;
virtual ~spline_modify_mixin();
};
struct OTR_SPLINE_EXPORT base_spline : base_spline_, spline_modify_mixin, spline_settings_mixin
{
+ base_spline(const base_spline&) = default;
+ base_spline& operator=(const base_spline&) = default;
+
+ base_spline() = default;
~base_spline() override;
};