Index: include/core/SkMath.h |
=================================================================== |
--- include/core/SkMath.h (revision 8533) |
+++ include/core/SkMath.h (working copy) |
@@ -55,6 +55,17 @@ |
return value & ~(value >> 31); |
} |
+/** Given an integer and an integer range, return the value |
+ * pinned against min and max, inclusive. |
+ * @param value The value we want returned pinned between [min...max] |
Tom Hudson
2013/04/09 10:10:50
Nit: Skia doesn't usually use @param when it's com
|
+ * @param min The min value |
+ * @param max The max value |
+ * @return min if value < min, max if value > max, else value |
+ */ |
+static inline int SkClampMinMax(int value, int min, int max) { |
Tom Hudson
2013/04/09 10:10:50
Given that SkClampMax doesn't use the trinary oper
Justin Novosad
2013/04/09 14:47:50
Ternary operators are actually more likely to trig
|
+ 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] |