diff options
author | Mike Reed <reed@google.com> | 2017-11-27 10:11:47 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-27 15:51:26 +0000 |
commit | 56536c42f561f6d8902703a33cf178deb91f9d4d (patch) | |
tree | c1d72b82aebb37a8f03a598e7b4a2c38939214bf | |
parent | dfaa057c15180a18f65d86317618a97d683e99c4 (diff) |
saturate when converting float to fixed
Bug:783205
Change-Id: I30997e413f03f6ce2f8a8998efd78e350bdb43e3
Reviewed-on: https://skia-review.googlesource.com/75982
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r-- | include/private/SkFixed.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/private/SkFixed.h b/include/private/SkFixed.h index 223df1185b..adb0343bc7 100644 --- a/include/private/SkFixed.h +++ b/include/private/SkFixed.h @@ -31,7 +31,7 @@ typedef int32_t SkFixed; #define SK_FixedRoot2Over2 (0xB505) #define SkFixedToFloat(x) ((x) * 1.52587890625e-5f) -#define SkFloatToFixed(x) ((SkFixed)((x) * SK_Fixed1)) +#define SkFloatToFixed(x) sk_float_saturate2int((x) * SK_Fixed1) #ifdef SK_DEBUG static inline SkFixed SkFloatToFixed_Check(float x) { |