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

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

Issue 1159953006: check (runtime) for null-pixels even when lock succeeds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | src/core/SkPixelRef.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "SkMipMap.h" 8 #include "SkMipMap.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 size_t storageSize = SkMipMap::AllocLevelsSize(countLevels, size); 232 size_t storageSize = SkMipMap::AllocLevelsSize(countLevels, size);
233 if (0 == storageSize) { 233 if (0 == storageSize) {
234 return NULL; 234 return NULL;
235 } 235 }
236 236
237 SkAutoPixmapUnlock srcUnlocker; 237 SkAutoPixmapUnlock srcUnlocker;
238 if (!src.requestLock(&srcUnlocker)) { 238 if (!src.requestLock(&srcUnlocker)) {
239 return NULL; 239 return NULL;
240 } 240 }
241 const SkPixmap& srcPixmap = srcUnlocker.pixmap(); 241 const SkPixmap& srcPixmap = srcUnlocker.pixmap();
242 // Try to catch where we might have returned NULL for src crbug.com/492818
243 if (NULL == srcPixmap.addr()) {
244 sk_throw();
245 }
242 246
243 SkMipMap* mipmap; 247 SkMipMap* mipmap;
244 if (fact) { 248 if (fact) {
245 SkDiscardableMemory* dm = fact(storageSize); 249 SkDiscardableMemory* dm = fact(storageSize);
246 if (NULL == dm) { 250 if (NULL == dm) {
247 return NULL; 251 return NULL;
248 } 252 }
249 mipmap = SkNEW_ARGS(SkMipMap, (storageSize, dm)); 253 mipmap = SkNEW_ARGS(SkMipMap, (storageSize, dm));
250 } else { 254 } else {
251 mipmap = SkNEW_ARGS(SkMipMap, (sk_malloc_throw(storageSize), storageSize )); 255 mipmap = SkNEW_ARGS(SkMipMap, (sk_malloc_throw(storageSize), storageSize ));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 344 }
341 345
342 if (level > fCount) { 346 if (level > fCount) {
343 level = fCount; 347 level = fCount;
344 } 348 }
345 if (levelPtr) { 349 if (levelPtr) {
346 *levelPtr = fLevels[level - 1]; 350 *levelPtr = fLevels[level - 1];
347 } 351 }
348 return true; 352 return true;
349 } 353 }
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698