mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-04 09:52:01 +00:00
- use the standard library's 'clamp' function instead of our homegrown variant.
This commit is contained in:
parent
1d0aed219e
commit
75c8e0af7c
4 changed files with 4 additions and 16 deletions
|
@ -32,7 +32,7 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include "templates.h"
|
||||
#include "basics.h"
|
||||
#include "renderstyle.h"
|
||||
#include "c_cvars.h"
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include "hw_ihwtexture.h"
|
||||
#include "templates.h"
|
||||
#include "basics.h"
|
||||
#include "tarray.h"
|
||||
#include "xs_Float.h"
|
||||
|
||||
|
@ -68,7 +68,7 @@ static void ResampleBoxPrecalc(TArray<BoxPrecalc>& boxes, int oldDim)
|
|||
|
||||
BoxPrecalc& precalc = boxes[dst];
|
||||
precalc.boxStart = clamp<int>(int(src_p - scale_factor_1 / 2.0 + 1), 0, oldDim - 1);
|
||||
precalc.boxEnd = clamp<int>(MAX<int>(precalc.boxStart + 1, int(src_p + scale_factor_2)), 0, oldDim - 1);
|
||||
precalc.boxEnd = clamp<int>(max<int>(precalc.boxStart + 1, int(src_p + scale_factor_2)), 0, oldDim - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,3 +105,4 @@ enum EStateUseFlags
|
|||
|
||||
using std::min;
|
||||
using std::max;
|
||||
using std::clamp;
|
||||
|
|
|
@ -129,18 +129,5 @@ const T MAX (const T a, const T b)
|
|||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// clamp
|
||||
//
|
||||
// Clamps in to the range [min,max].
|
||||
//==========================================================================
|
||||
|
||||
template<typename T, typename X, typename Y>
|
||||
inline constexpr
|
||||
T clamp (const T in, const X min, const Y max)
|
||||
{
|
||||
return in <= (T) min ? (T) min : in >= (T) max ? (T) max : in;
|
||||
}
|
||||
|
||||
#endif //__TEMPLATES_H__
|
||||
|
|
Loading…
Reference in a new issue