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

Side by Side Diff: src/core/SkScaledImageCache.cpp

Issue 361403006: Adding 64 bit checks (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkScaledImageCache.h" 8 #include "SkScaledImageCache.h"
9 #include "SkMipMap.h" 9 #include "SkMipMap.h"
10 #include "SkPixelRef.h" 10 #include "SkPixelRef.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 virtual bool allocPixelRef(SkBitmap*, SkColorTable*) SK_OVERRIDE; 260 virtual bool allocPixelRef(SkBitmap*, SkColorTable*) SK_OVERRIDE;
261 261
262 private: 262 private:
263 SkScaledImageCache::DiscardableFactory fFactory; 263 SkScaledImageCache::DiscardableFactory fFactory;
264 }; 264 };
265 265
266 bool SkScaledImageCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap, 266 bool SkScaledImageCacheDiscardableAllocator::allocPixelRef(SkBitmap* bitmap,
267 SkColorTable* ctable) { 267 SkColorTable* ctable) {
268 size_t size = bitmap->getSize(); 268 size_t size = bitmap->getSize();
269 if (0 == size) { 269 uint64_t size64 = bitmap->computeSize64();
270 if (0 == size || size64 > (uint64_t)size) {
270 return false; 271 return false;
271 } 272 }
272 273
273 SkDiscardableMemory* dm = fFactory(size); 274 SkDiscardableMemory* dm = fFactory(size);
274 if (NULL == dm) { 275 if (NULL == dm) {
275 return false; 276 return false;
276 } 277 }
277 278
278 // can we relax this? 279 // can we relax this?
279 if (kN32_SkColorType != bitmap->colorType()) { 280 if (kN32_SkColorType != bitmap->colorType()) {
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 return SkScaledImageCache::GetBytesUsed(); 784 return SkScaledImageCache::GetBytesUsed();
784 } 785 }
785 786
786 size_t SkGraphics::GetImageCacheByteLimit() { 787 size_t SkGraphics::GetImageCacheByteLimit() {
787 return SkScaledImageCache::GetByteLimit(); 788 return SkScaledImageCache::GetByteLimit();
788 } 789 }
789 790
790 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { 791 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) {
791 return SkScaledImageCache::SetByteLimit(newLimit); 792 return SkScaledImageCache::SetByteLimit(newLimit);
792 } 793 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698