| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 if (NULL == srcPixmap.addr()) { | 243 if (NULL == srcPixmap.addr()) { |
| 244 sk_throw(); | 244 sk_throw(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 SkMipMap* mipmap; | 247 SkMipMap* mipmap; |
| 248 if (fact) { | 248 if (fact) { |
| 249 SkDiscardableMemory* dm = fact(storageSize); | 249 SkDiscardableMemory* dm = fact(storageSize); |
| 250 if (NULL == dm) { | 250 if (NULL == dm) { |
| 251 return NULL; | 251 return NULL; |
| 252 } | 252 } |
| 253 mipmap = SkNEW_ARGS(SkMipMap, (storageSize, dm)); | 253 mipmap = new SkMipMap(storageSize, dm); |
| 254 } else { | 254 } else { |
| 255 mipmap = SkNEW_ARGS(SkMipMap, (sk_malloc_throw(storageSize), storageSize
)); | 255 mipmap = new SkMipMap(sk_malloc_throw(storageSize), storageSize); |
| 256 } | 256 } |
| 257 | 257 |
| 258 // init | 258 // init |
| 259 mipmap->fCount = countLevels; | 259 mipmap->fCount = countLevels; |
| 260 mipmap->fLevels = (Level*)mipmap->writable_data(); | 260 mipmap->fLevels = (Level*)mipmap->writable_data(); |
| 261 | 261 |
| 262 Level* levels = mipmap->fLevels; | 262 Level* levels = mipmap->fLevels; |
| 263 uint8_t* baseAddr = (uint8_t*)&levels[countLevels]; | 263 uint8_t* baseAddr = (uint8_t*)&levels[countLevels]; |
| 264 uint8_t* addr = baseAddr; | 264 uint8_t* addr = baseAddr; |
| 265 int width = src.width(); | 265 int width = src.width(); |
| (...skipping 78 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 } |
| OLD | NEW |