aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkScalar.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/core/SkScalar.h')
-rw-r--r--include/core/SkScalar.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/core/SkScalar.h b/include/core/SkScalar.h
index b775472139..a699fe9a99 100644
--- a/include/core/SkScalar.h
+++ b/include/core/SkScalar.h
@@ -132,6 +132,7 @@
#define SkScalarFloorToInt(x) sk_float_floor2int(x)
#define SkScalarCeilToInt(x) sk_float_ceil2int(x)
#define SkScalarRoundToInt(x) sk_float_round2int(x)
+ #define SkScalarTruncToInt(x) static_cast<int>(x)
/** Returns the absolute value of the specified SkScalar
*/
@@ -248,6 +249,7 @@
#define SkScalarFloorToInt(x) SkFixedFloorToInt(x)
#define SkScalarCeilToInt(x) SkFixedCeilToInt(x)
#define SkScalarRoundToInt(x) SkFixedRoundToInt(x)
+ #define SkScalarTruncToInt(x) (((x) < 0) ? SkScalarCeilToInt(x) : SkScalarFloorToInt(x))
#define SkScalarAbs(x) SkFixedAbs(x)
#define SkScalarCopySign(x, y) SkCopySign32(x, y)