diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkAutoPixmapStorage.cpp | 2 | ||||
-rw-r--r-- | src/core/SkBitmapCache.cpp | 2 | ||||
-rw-r--r-- | src/core/SkImageInfo.cpp | 4 | ||||
-rw-r--r-- | src/core/SkMallocPixelRef.cpp | 5 |
4 files changed, 6 insertions, 7 deletions
diff --git a/src/core/SkAutoPixmapStorage.cpp b/src/core/SkAutoPixmapStorage.cpp index fb8ad00246..df0c0fa878 100644 --- a/src/core/SkAutoPixmapStorage.cpp +++ b/src/core/SkAutoPixmapStorage.cpp @@ -37,7 +37,7 @@ bool SkAutoPixmapStorage::tryAlloc(const SkImageInfo& info) { size_t rb; size_t size = AllocSize(info, &rb); - if (SK_MaxSizeT == size) { + if (0 == size) { return false; } void* pixels = sk_malloc_flags(size, 0); diff --git a/src/core/SkBitmapCache.cpp b/src/core/SkBitmapCache.cpp index 2f163183db..8d3991a9d5 100644 --- a/src/core/SkBitmapCache.cpp +++ b/src/core/SkBitmapCache.cpp @@ -290,7 +290,7 @@ SkBitmapCache::RecPtr SkBitmapCache::Alloc(const SkBitmapCacheDesc& desc, const const size_t rb = info.minRowBytes(); size_t size = info.computeByteSize(rb); - if (SK_MaxSizeT == size) { + if (0 == size) { return nullptr; } diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp index 9e08768d7b..c610b82bdc 100644 --- a/src/core/SkImageInfo.cpp +++ b/src/core/SkImageInfo.cpp @@ -78,11 +78,7 @@ size_t SkImageInfo::computeByteSize(size_t rowBytes) const { SkSafeMath safe; size_t bytes = safe.add(safe.mul(fHeight - 1, rowBytes), safe.mul(fWidth, this->bytesPerPixel())); -#ifdef SK_SUPPORT_LEGACY_COMPUTEBYTESIZE_RET_0 return safe ? bytes : 0; -#else - return safe ? bytes : SK_MaxSizeT; -#endif } static bool alpha_type_is_valid(SkAlphaType alphaType) { diff --git a/src/core/SkMallocPixelRef.cpp b/src/core/SkMallocPixelRef.cpp index 531d9f8fdf..10861028b1 100644 --- a/src/core/SkMallocPixelRef.cpp +++ b/src/core/SkMallocPixelRef.cpp @@ -80,7 +80,7 @@ sk_sp<SkPixelRef> SkMallocPixelRef::MakeUsing(void*(*allocProc)(size_t), size_t size = 0; if (!info.isEmpty() && rowBytes) { size = info.computeByteSize(rowBytes); - if (size == SK_MaxSizeT) { + if (!size) { return nullptr; // overflow } } @@ -131,6 +131,9 @@ sk_sp<SkPixelRef> SkMallocPixelRef::MakeWithData(const SkImageInfo& info, if (!is_valid(info)) { return nullptr; } + // TODO: what should we return if computeByteSize returns 0? + // - the info was empty? + // - we overflowed computing the size? if ((rowBytes < info.minRowBytes()) || (data->size() < info.computeByteSize(rowBytes))) { return nullptr; } |