Chromium Code Reviews| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 if (nullptr == dm) { | 399 if (nullptr == dm) { |
| 400 return nullptr; | 400 return nullptr; |
| 401 } | 401 } |
| 402 mipmap = new SkMipMap(storageSize, dm); | 402 mipmap = new SkMipMap(storageSize, dm); |
| 403 } else { | 403 } else { |
| 404 mipmap = new SkMipMap(sk_malloc_throw(storageSize), storageSize); | 404 mipmap = new SkMipMap(sk_malloc_throw(storageSize), storageSize); |
| 405 } | 405 } |
| 406 | 406 |
| 407 // init | 407 // init |
| 408 mipmap->fCount = countLevels; | 408 mipmap->fCount = countLevels; |
| 409 memset(mipmap->writable_data(), 0, mipmap->size()); | |
|
msarett
2016/05/26 13:43:05
Not sure if this ok... I can also make it more fi
| |
| 409 mipmap->fLevels = (Level*)mipmap->writable_data(); | 410 mipmap->fLevels = (Level*)mipmap->writable_data(); |
| 410 | 411 |
| 411 Level* levels = mipmap->fLevels; | 412 Level* levels = mipmap->fLevels; |
| 412 uint8_t* baseAddr = (uint8_t*)&levels[countLevels]; | 413 uint8_t* baseAddr = (uint8_t*)&levels[countLevels]; |
| 413 uint8_t* addr = baseAddr; | 414 uint8_t* addr = baseAddr; |
| 414 int width = src.width(); | 415 int width = src.width(); |
| 415 int height = src.height(); | 416 int height = src.height(); |
| 416 uint32_t rowBytes; | 417 uint32_t rowBytes; |
| 417 SkPixmap srcPM(src); | 418 SkPixmap srcPM(src); |
| 418 | 419 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 return false; | 581 return false; |
| 581 } | 582 } |
| 582 if (index > fCount - 1) { | 583 if (index > fCount - 1) { |
| 583 return false; | 584 return false; |
| 584 } | 585 } |
| 585 if (levelPtr) { | 586 if (levelPtr) { |
| 586 *levelPtr = fLevels[index]; | 587 *levelPtr = fLevels[index]; |
| 587 } | 588 } |
| 588 return true; | 589 return true; |
| 589 } | 590 } |
| OLD | NEW |