diff options
author | Herb Derby <herb@google.com> | 2017-09-20 11:56:00 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-21 20:29:24 +0000 |
commit | c402b778d5707ac2f66c9f38d5bbc20fb79321b5 (patch) | |
tree | a44c07179a8bef6fda66177acc14d18ec5e4cd0b /include/core | |
parent | 0e42586036c3fbd3c3092680df853a0c2e2e82fa (diff) |
Remove sk_64_isS32 and sk_64_asS32
This is an API change. I assume that only Skia uses these routines.
Change-Id: Iefc98fa5c0b83eb4f52c478e345fd99121ecb254
Reviewed-on: https://skia-review.googlesource.com/129440
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkImageInfo.h | 5 | ||||
-rw-r--r-- | include/core/SkMath.h | 19 | ||||
-rw-r--r-- | include/core/SkRect.h | 3 |
3 files changed, 6 insertions, 21 deletions
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h index 48edcd2181..eb96f19723 100644 --- a/include/core/SkImageInfo.h +++ b/include/core/SkImageInfo.h @@ -12,6 +12,7 @@ #include "SkMath.h" #include "SkRect.h" #include "SkSize.h" +#include "../private/SkTFitsIn.h" class SkReadBuffer; class SkWriteBuffer; @@ -551,10 +552,10 @@ public: */ size_t minRowBytes() const { uint64_t minRowBytes = this->minRowBytes64(); - if (!sk_64_isS32(minRowBytes)) { + if (!SkTFitsIn<int32_t>(minRowBytes)) { return 0; } - return sk_64_asS32(minRowBytes); + return SkTo<int32_t>(minRowBytes); } /** Returns byte offset of pixel from pixel base address. diff --git a/include/core/SkMath.h b/include/core/SkMath.h index 6e252306df..fb551abb40 100644 --- a/include/core/SkMath.h +++ b/include/core/SkMath.h @@ -14,23 +14,6 @@ // 64bit -> 32bit utilities -/** - * Return true iff the 64bit value can exactly be represented in signed 32bits - */ -static inline bool sk_64_isS32(int64_t value) { - return (int32_t)value == value; -} - -/** - * Return the 64bit argument as signed 32bits, asserting in debug that the arg - * exactly fits in signed 32bits. In the release build, no checks are preformed - * and the return value if the arg does not fit is undefined. - */ -static inline int32_t sk_64_asS32(int64_t value) { - SkASSERT(sk_64_isS32(value)); - return (int32_t)value; -} - // Handy util that can be passed two ints, and will automatically promote to // 64bits before the multiply, so the caller doesn't have to remember to cast // e.g. (int64_t)a * b; @@ -49,7 +32,7 @@ static inline int32_t SkMulDiv(int32_t numer1, int32_t numer2, int32_t denom) { SkASSERT(denom); int64_t tmp = sk_64_mul(numer1, numer2) / denom; - return sk_64_asS32(tmp); + return SkTo<int32_t>(tmp); } /** diff --git a/include/core/SkRect.h b/include/core/SkRect.h index 7b8e0032e5..2a46da68c6 100644 --- a/include/core/SkRect.h +++ b/include/core/SkRect.h @@ -11,6 +11,7 @@ #include "SkPoint.h" #include "SkSize.h" #include "../private/SkSafe32.h" +#include "../private/SkTFitsIn.h" struct SkRect; @@ -209,7 +210,7 @@ struct SK_API SkIRect { return true; } // Return true if either exceeds int32_t - return !sk_64_isS32(w | h); + return !SkTFitsIn<int32_t>(w | h); } /** Returns true if all members in a: fLeft, fTop, fRight, and fBottom; are |