| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 344 } |
| 345 | 345 |
| 346 if (level > fCount) { | 346 if (level > fCount) { |
| 347 level = fCount; | 347 level = fCount; |
| 348 } | 348 } |
| 349 if (levelPtr) { | 349 if (levelPtr) { |
| 350 *levelPtr = fLevels[level - 1]; | 350 *levelPtr = fLevels[level - 1]; |
| 351 } | 351 } |
| 352 return true; | 352 return true; |
| 353 } | 353 } |
| 354 |
| 355 int SkMipMap::getLevelsCount() const { |
| 356 return fCount; |
| 357 } |
| 358 |
| 359 bool SkMipMap::getLevel(int levelIndex, Level* levelPtr) const { |
| 360 if (NULL == fLevels) { |
| 361 return false; |
| 362 } |
| 363 if (levelIndex <= 0) { |
| 364 return false; |
| 365 } |
| 366 if (levelIndex > fCount) { |
| 367 levelIndex = fCount; |
| 368 } |
| 369 if (levelPtr) { |
| 370 *levelPtr = fLevels[levelIndex - 1]; |
| 371 } |
| 372 return true; |
| 373 } |
| OLD | NEW |