Flutter Engine
The Flutter Engine
Functions
SkTPin.h File Reference
#include <algorithm>

Go to the source code of this file.

Functions

template<typename T >
static constexpr const TSkTPin (const T &x, const T &lo, const T &hi)
 

Function Documentation

◆ SkTPin()

template<typename T >
static constexpr const T & SkTPin ( const T x,
const T lo,
const T hi 
)
staticconstexpr
Returns
x pinned (clamped) between lo and hi, inclusively.

Unlike std::clamp(), SkTPin() always returns a value between lo and hi. If x is NaN, SkTPin() returns lo but std::clamp() returns NaN.

Definition at line 19 of file SkTPin.h.

19 {
20 return std::max(lo, std::min(x, hi));
21}
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48
double x