Use std::min and std::max

This commit is contained in:
Romain Goyet
2020-04-12 15:43:39 -04:00
committed by Ecco
parent 77ee5126e1
commit 950862f8d0
79 changed files with 297 additions and 406 deletions

View File

@@ -1,4 +1,5 @@
#include "plot_view.h"
#include <algorithm>
namespace Matplotlib {
@@ -52,7 +53,6 @@ void PlotView::traceSegment(KDContext * ctx, KDRect r, PlotStore::Segment segmen
}
}
static inline KDCoordinate maxKDCoordinate(KDCoordinate x, KDCoordinate y) { return x > y ? x : y; }
void PlotView::traceRect(KDContext * ctx, KDRect r, PlotStore::Rect rect) const {
KDCoordinate left = std::round(floatToPixel(Axis::Horizontal, rect.left()));
KDCoordinate right = std::round(floatToPixel(Axis::Horizontal, rect.right()));
@@ -61,7 +61,7 @@ void PlotView::traceRect(KDContext * ctx, KDRect r, PlotStore::Rect rect) const
KDRect pixelRect(
left,
top,
maxKDCoordinate(right - left, 1), // Rectangle should at least be visible
std::max(right - left, 1), // Rectangle should at least be visible
bottom - top
);
ctx->fillRect(pixelRect, rect.color());