From c26eeb45c905d985aba199e631651e69fcc10083 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 22 Jun 2018 16:55:02 +0200 Subject: spline: replace open-coded clamp() --- spline/spline-widget.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp index fdfe8ec7..b0300b1a 100644 --- a/spline/spline-widget.cpp +++ b/spline/spline-widget.cpp @@ -610,15 +610,8 @@ QPointF spline_widget::pixel_to_point(const QPointF& point) y = int(y * c + .5/c) / double(c); } - if (x < 0) - x = 0; - if (x > _config->max_input()) - x = _config->max_input(); - - if (y < 0) - y = 0; - if (y > _config->max_output()) - y = _config->max_output(); + x = clamp(x, 0, _config->max_input()); + y = clamp(y, 0, _config->max_output()); return { x, y }; } -- cgit v1.2.3