mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Use std::min and std::max
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user