Index: src/core/SkMipMap.cpp |
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp |
index 4888b574e4a687c63e400374b99d4c973686535b..ff62f4d59d53b154340d69a611621fec49edc1c7 100644 |
--- a/src/core/SkMipMap.cpp |
+++ b/src/core/SkMipMap.cpp |
@@ -109,21 +109,15 @@ static void downsampleby2_proc4444(SkBitmap* dst, int x, int y, |
*dst->getAddr16(x >> 1, y >> 1) = (uint16_t)collaps4444(c >> 2); |
} |
-static bool isPos32Bits(const Sk64& value) { |
- return !value.isNeg() && value.is32(); |
-} |
- |
SkMipMap::Level* SkMipMap::AllocLevels(int levelCount, size_t pixelSize) { |
if (levelCount < 0) { |
return NULL; |
} |
- Sk64 size; |
- size.setMul(levelCount + 1, sizeof(Level)); |
- size.add(SkToS32(pixelSize)); |
- if (!isPos32Bits(size)) { |
+ int64_t size = sk_64_mul(levelCount + 1, sizeof(Level)) + pixelSize; |
+ if (!sk_64_isS32(size)) { |
return NULL; |
} |
- return (Level*)sk_malloc_throw(size.get32()); |
+ return (Level*)sk_malloc_throw(sk_64_asS32(size)); |
} |
SkMipMap* SkMipMap::Build(const SkBitmap& src) { |