| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 350 |
| 351 if (level > fCount) { | 351 if (level > fCount) { |
| 352 level = fCount; | 352 level = fCount; |
| 353 } | 353 } |
| 354 if (levelPtr) { | 354 if (levelPtr) { |
| 355 *levelPtr = fLevels[level - 1]; | 355 *levelPtr = fLevels[level - 1]; |
| 356 } | 356 } |
| 357 return true; | 357 return true; |
| 358 } | 358 } |
| 359 | 359 |
| 360 // Helper which extacts a pixmap from the src bitmap | 360 // Helper which extracts a pixmap from the src bitmap |
| 361 // | 361 // |
| 362 SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) { | 362 SkMipMap* SkMipMap::Build(const SkBitmap& src, SkDiscardableFactoryProc fact) { |
| 363 SkAutoPixmapUnlock srcUnlocker; | 363 SkAutoPixmapUnlock srcUnlocker; |
| 364 if (!src.requestLock(&srcUnlocker)) { | 364 if (!src.requestLock(&srcUnlocker)) { |
| 365 return nullptr; | 365 return nullptr; |
| 366 } | 366 } |
| 367 const SkPixmap& srcPixmap = srcUnlocker.pixmap(); | 367 const SkPixmap& srcPixmap = srcUnlocker.pixmap(); |
| 368 // Try to catch where we might have returned nullptr for src crbug.com/49281
8 | 368 // Try to catch where we might have returned nullptr for src crbug.com/49281
8 |
| 369 if (nullptr == srcPixmap.addr()) { | 369 if (nullptr == srcPixmap.addr()) { |
| 370 sk_throw(); | 370 sk_throw(); |
| 371 } | 371 } |
| 372 return Build(srcPixmap, fact); | 372 return Build(srcPixmap, fact); |
| 373 } | 373 } |
| 374 | 374 |
| OLD | NEW |