Chromium Code Reviews| Index: include/core/SkMath.h |
| =================================================================== |
| --- include/core/SkMath.h (revision 8533) |
| +++ include/core/SkMath.h (working copy) |
| @@ -55,6 +55,14 @@ |
| return value & ~(value >> 31); |
| } |
| +/** Given an integer and an integer range, return the value |
| + * pinned against min and max, inclusive. |
| + * @return min if value < min, max if value > max, else value |
| + */ |
| +static inline int SkClampMinMax(int value, int min, int max) { |
|
reed1
2013/04/09 15:23:42
How is this different from SkPin32() ?
|
| + return (value < min ? min : (value > max ? max : value)); |
| +} |
| + |
| /** Given an integer and a positive (max) integer, return the value |
| * pinned against 0 and max, inclusive. |
| * @param value The value we want returned pinned between [0...max] |