aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2017-09-20 11:56:00 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-21 20:29:24 +0000
commitc402b778d5707ac2f66c9f38d5bbc20fb79321b5 (patch)
treea44c07179a8bef6fda66177acc14d18ec5e4cd0b /src
parent0e42586036c3fbd3c3092680df853a0c2e2e82fa (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 'src')
-rw-r--r--src/codec/SkWebpCodec.cpp2
-rw-r--r--src/core/SkBitmapProcState_utils.h2
-rw-r--r--src/core/SkMask.cpp4
-rw-r--r--src/core/SkMipMap.cpp4
-rw-r--r--src/core/SkPicture.cpp2
-rw-r--r--src/core/SkRegionPriv.h2
-rw-r--r--src/core/SkWriteBuffer.cpp4
7 files changed, 10 insertions, 10 deletions
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index 95ae9b9593..757cde5699 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -81,7 +81,7 @@ std::unique_ptr<SkCodec> SkWebpCodec::MakeFromStream(std::unique_ptr<SkStream> s
{
const int64_t size = sk_64_mul(width, height);
// now check that if we are 4-bytes per pixel, we also don't overflow
- if (!sk_64_isS32(size) || sk_64_asS32(size) > (0x7FFFFFFF >> 2)) {
+ if (!SkTFitsIn<int32_t>(size) || SkTo<int32_t>(size) > (0x7FFFFFFF >> 2)) {
*result = kInvalidInput;
return nullptr;
}
diff --git a/src/core/SkBitmapProcState_utils.h b/src/core/SkBitmapProcState_utils.h
index 4609ff34e7..ec35ca108d 100644
--- a/src/core/SkBitmapProcState_utils.h
+++ b/src/core/SkBitmapProcState_utils.h
@@ -50,7 +50,7 @@ static inline bool can_truncate_to_fixed_for_decal(SkFixed fx,
// Promote to 64bit (48.16) to avoid overflow.
const uint64_t lastFx = fx + sk_64_mul(dx, count - 1);
- return sk_64_isS32(lastFx) && (unsigned)SkFixedFloorToInt(sk_64_asS32(lastFx)) < max;
+ return SkTFitsIn<int32_t>(lastFx) && (unsigned)SkFixedFloorToInt(SkTo<int32_t>(lastFx)) < max;
}
#endif /* #ifndef SkBitmapProcState_utils_DEFINED */
diff --git a/src/core/SkMask.cpp b/src/core/SkMask.cpp
index 7dd0f6d6dd..b3a6543706 100644
--- a/src/core/SkMask.cpp
+++ b/src/core/SkMask.cpp
@@ -14,8 +14,8 @@
*/
static int32_t safeMul32(int32_t a, int32_t b) {
int64_t size = sk_64_mul(a, b);
- if (size > 0 && sk_64_isS32(size)) {
- return sk_64_asS32(size);
+ if (size > 0 && SkTFitsIn<int32_t>(size)) {
+ return size;
}
return 0;
}
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index f9cb3f1cf5..1b5d84bf39 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -477,10 +477,10 @@ size_t SkMipMap::AllocLevelsSize(int levelCount, size_t pixelSize) {
return 0;
}
int64_t size = sk_64_mul(levelCount + 1, sizeof(Level)) + pixelSize;
- if (!sk_64_isS32(size)) {
+ if (!SkTFitsIn<int32_t>(size)) {
return 0;
}
- return sk_64_asS32(size);
+ return SkTo<int32_t>(size);
}
SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDestinationSurfaceColorMode colorMode,
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 5993e49972..2325fde864 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -245,7 +245,7 @@ static sk_sp<SkData> custom_serialize(const SkPicture* picture, const SkSerialPr
auto data = procs.fPictureProc(const_cast<SkPicture*>(picture), procs.fPictureCtx);
if (data) {
size_t size = data->size();
- if (!sk_64_isS32(size) || size <= 1) {
+ if (!SkTFitsIn<int32_t>(size) || size <= 1) {
return SkData::MakeEmpty();
}
return data;
diff --git a/src/core/SkRegionPriv.h b/src/core/SkRegionPriv.h
index d9d472a1d2..08db564174 100644
--- a/src/core/SkRegionPriv.h
+++ b/src/core/SkRegionPriv.h
@@ -73,7 +73,7 @@ public:
}
const int64_t size = sk_64_mul(count, sizeof(RunType)) + sizeof(RunHead);
- if (count < 0 || !sk_64_isS32(size)) { SK_ABORT("Invalid Size"); }
+ if (count < 0 || !SkTFitsIn<int32_t>(size)) { SK_ABORT("Invalid Size"); }
RunHead* head = (RunHead*)sk_malloc_throw(size);
head->fRefCnt = 1;
diff --git a/src/core/SkWriteBuffer.cpp b/src/core/SkWriteBuffer.cpp
index de0b613996..cb752c491f 100644
--- a/src/core/SkWriteBuffer.cpp
+++ b/src/core/SkWriteBuffer.cpp
@@ -151,7 +151,7 @@ void SkBinaryWriteBuffer::writeImage(const SkImage* image) {
}
size_t size = data ? data->size() : 0;
- if (!sk_64_isS32(size)) {
+ if (!SkTFitsIn<int32_t>(size)) {
size = 0; // too big to store
}
this->write32(SkToS32(size)); // writing 0 signals failure
@@ -177,7 +177,7 @@ void SkBinaryWriteBuffer::writeTypeface(SkTypeface* obj) {
auto data = fProcs.fTypefaceProc(obj, fProcs.fTypefaceCtx);
if (data) {
size_t size = data->size();
- if (!sk_64_isS32(size)) {
+ if (!SkTFitsIn<int32_t>(size)) {
size = 0; // fall back to default font
}
int32_t ssize = SkToS32(size);