Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Unified Diff: src/core/SkMipMap.cpp

Issue 113823003: remove Sk64 from public API, and start to remove usage internally (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkMallocPixelRef.cpp ('k') | src/core/SkRegion_path.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/core/SkMallocPixelRef.cpp ('k') | src/core/SkRegion_path.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698