summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-06-22 16:55:02 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-06-26 23:01:53 +0200
commitc26eeb45c905d985aba199e631651e69fcc10083 (patch)
tree9a8afb96fdf9fcad280385f40e92e6d31a60cc18
parentdcbddbb42acc86963bfe754e8be9f3e74a094b99 (diff)
spline: replace open-coded clamp()
-rw-r--r--spline/spline-widget.cpp11
1 files 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 };
}