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,11 +1,9 @@
#include "function_title_cell.h"
#include <assert.h>
#include <algorithm>
namespace Shared {
static inline float minFloat(float x, float y) { return x < y ? x : y; }
static inline float maxFloat(float x, float y) { return x > y ? x : y; }
void FunctionTitleCell::setOrientation(Orientation orientation) {
m_orientation = orientation;
reloadCell();
@@ -51,9 +49,9 @@ KDRect FunctionTitleCell::subviewFrame() const {
float FunctionTitleCell::verticalAlignment() const {
assert(m_orientation == Orientation::VerticalIndicator);
return maxFloat(
return std::max(
0.0f,
minFloat(
std::min(
1.0f,
m_baseline < 0 ? 0.5f : verticalAlignmentGivenExpressionBaselineAndRowHeight(m_baseline, subviewFrame().height())));
}