| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 proc = proc_3_2; | 290 proc = proc_3_2; |
| 291 } else { // src-width is 2 | 291 } else { // src-width is 2 |
| 292 proc = proc_2_2; | 292 proc = proc_2_2; |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 width >>= 1; | 295 width >>= 1; |
| 296 height >>= 1; | 296 height >>= 1; |
| 297 rowBytes = SkToU32(SkColorTypeMinRowBytes(ct, width)); | 297 rowBytes = SkToU32(SkColorTypeMinRowBytes(ct, width)); |
| 298 | 298 |
| 299 levels[i].fPixmap = SkPixmap(SkImageInfo::Make(width, height, ct, at), a
ddr, rowBytes); | 299 levels[i].fPixmap = SkPixmap(SkImageInfo::Make(width, height, ct, at), a
ddr, rowBytes); |
| 300 #ifdef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAPS | |
| 301 levels[i].fScale = SkSize::Make(SkIntToScalar(width) / src.width(), | |
| 302 SkIntToScalar(width) / src.width()); | |
| 303 #else | |
| 304 levels[i].fScale = SkSize::Make(SkIntToScalar(width) / src.width(), | 300 levels[i].fScale = SkSize::Make(SkIntToScalar(width) / src.width(), |
| 305 SkIntToScalar(height) / src.height()); | 301 SkIntToScalar(height) / src.height()); |
| 306 #endif | |
| 307 | 302 |
| 308 const SkPixmap& dstPM = levels[i].fPixmap; | 303 const SkPixmap& dstPM = levels[i].fPixmap; |
| 309 const void* srcBasePtr = srcPM.addr(); | 304 const void* srcBasePtr = srcPM.addr(); |
| 310 void* dstBasePtr = dstPM.writable_addr(); | 305 void* dstBasePtr = dstPM.writable_addr(); |
| 311 | 306 |
| 312 const size_t srcRB = srcPM.rowBytes(); | 307 const size_t srcRB = srcPM.rowBytes(); |
| 313 for (int y = 0; y < height; y++) { | 308 for (int y = 0; y < height; y++) { |
| 314 proc(dstBasePtr, srcBasePtr, srcRB, width); | 309 proc(dstBasePtr, srcBasePtr, srcRB, width); |
| 315 srcBasePtr = (char*)srcBasePtr + srcRB * 2; // jump two rows | 310 srcBasePtr = (char*)srcBasePtr + srcRB * 2; // jump two rows |
| 316 dstBasePtr = (char*)dstBasePtr + dstPM.rowBytes(); | 311 dstBasePtr = (char*)dstBasePtr + dstPM.rowBytes(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 return nullptr; | 360 return nullptr; |
| 366 } | 361 } |
| 367 const SkPixmap& srcPixmap = srcUnlocker.pixmap(); | 362 const SkPixmap& srcPixmap = srcUnlocker.pixmap(); |
| 368 // Try to catch where we might have returned nullptr for src crbug.com/49281
8 | 363 // Try to catch where we might have returned nullptr for src crbug.com/49281
8 |
| 369 if (nullptr == srcPixmap.addr()) { | 364 if (nullptr == srcPixmap.addr()) { |
| 370 sk_throw(); | 365 sk_throw(); |
| 371 } | 366 } |
| 372 return Build(srcPixmap, fact); | 367 return Build(srcPixmap, fact); |
| 373 } | 368 } |
| 374 | 369 |
| OLD | NEW |