OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |