diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-01-18 16:17:21 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-01-18 16:17:21 +0100 |
commit | 61988218606c52684c8121a8274245bde4d3dcf5 (patch) | |
tree | 99f633997916005ef3d457d220f36835a484aedf /src | |
parent | 7c3b29bde40fa215f35de1197c1ef0fc51f9c113 (diff) |
use std::min() std::max()
Diffstat (limited to 'src')
-rw-r--r-- | src/GipfelWidget.cxx | 15 | ||||
-rw-r--r-- | src/Stitch.cxx | 9 |
2 files changed, 10 insertions, 14 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index eefefc4..cb0b3dc 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -15,6 +15,7 @@ #include <fcntl.h> #include <errno.h> #include <math.h> +#include <algorithm> #include <FL/Fl.H> #include <FL/Fl_Menu_Item.H> @@ -29,10 +30,6 @@ #define CROSS_SIZE 2 - -#define MAX(A,B) ((A)>(B)?(A):(B)) -#define MIN(A,B) ((A)<(B)?(A):(B)) - static double pi_d, deg2rad; static void center_cb(Fl_Widget *o, void *f); @@ -464,13 +461,13 @@ GipfelWidget::set_mountain(int m_x, int m_y) { damage(4, center_x + x() + old_x - 2*CROSS_SIZE - 1, center_y + y() + old_y + old_label_y - 2*CROSS_SIZE - 20, - MAX(20, cur_mountain->label_x) + 2*CROSS_SIZE + 2, - MAX(20, old_label_y) + 22 ); + std::max(20, cur_mountain->label_x) + 2*CROSS_SIZE + 2, + std::max(20, old_label_y) + 22 ); damage(4, (int) rint(center_x + x() + cur_mountain->x - 2*CROSS_SIZE - 1), (int) rint(center_y + y() + cur_mountain->y + cur_mountain->label_y - 2*CROSS_SIZE - 20), - MAX(20, cur_mountain->label_x) + 2*CROSS_SIZE + 2, - MAX(20, cur_mountain->label_y) + 22 ); + std::max(20, cur_mountain->label_x) + 2*CROSS_SIZE + 2, + std::max(20, cur_mountain->label_y) + 22 ); return 0; } @@ -660,7 +657,7 @@ int GipfelWidget::get_rel_track_width(Hill *m) { double dist = pan->get_real_distance(m); - return (int) rint(MAX((pan->get_scale()*track_width)/(dist*10.0), 1.0)); + return (int) rint(std::max((pan->get_scale()*track_width)/(dist*10.0), 1.0)); } void diff --git a/src/Stitch.cxx b/src/Stitch.cxx index 0038b28..ae06cde 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -8,6 +8,7 @@ #include <stdio.h> #include <string.h> #include <math.h> +#include <algorithm> #include <gsl/gsl_multifit.h> @@ -16,8 +17,6 @@ #include "OutputImage.H" #include "Stitch.H" -#define MIN(A,B) ((A)<(B)?(A):(B)) -#define MAX(A,B) ((A)>(B)?(A):(B)) #define MAX_VALUE 65025 static double pi_d = asin(1.0) * 2.0; @@ -122,9 +121,9 @@ Stitch::resample(GipfelWidget::sample_mode_t m, if (gipf[i]->get_pixel(m, a_view, a_nick, &r, &g, &b) == 0) { - r = MAX(MIN(r, MAX_VALUE), 0); - g = MAX(MIN(g, MAX_VALUE), 0); - b = MAX(MIN(b, MAX_VALUE), 0); + r = std::max(std::min(r, MAX_VALUE), 0); + g = std::max(std::min(g, MAX_VALUE), 0); + b = std::max(std::min(b, MAX_VALUE), 0); if (single_images[i]) { single_images[i]->set_pixel(x, r, g, b); |