Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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}
double x