| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkCodec_libpng.h" | 8 #include "SkCodec_libpng.h" |
| 9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 break; | 464 break; |
| 465 default: | 465 default: |
| 466 //would have exited before now if the colorType was supported by png | 466 //would have exited before now if the colorType was supported by png |
| 467 SkASSERT(false); | 467 SkASSERT(false); |
| 468 } | 468 } |
| 469 | 469 |
| 470 // Copy the color table to the client if they request kIndex8 mode | 470 // Copy the color table to the client if they request kIndex8 mode |
| 471 copy_color_table(requestedInfo, fColorTable, ctable, ctableCount); | 471 copy_color_table(requestedInfo, fColorTable, ctable, ctableCount); |
| 472 | 472 |
| 473 // Create the swizzler. SkPngCodec retains ownership of the color table. | 473 // Create the swizzler. SkPngCodec retains ownership of the color table. |
| 474 const SkPMColor* colors = fColorTable ? fColorTable->readColors() : NULL; | 474 const SkPMColor* colors = get_color_ptr(fColorTable.get()); |
| 475 fSwizzler.reset(SkSwizzler::CreateSwizzler(fSrcConfig, colors, requestedInfo
, | 475 fSwizzler.reset(SkSwizzler::CreateSwizzler(fSrcConfig, colors, requestedInfo
, |
| 476 options.fZeroInitialized)); | 476 options.fZeroInitialized)); |
| 477 if (!fSwizzler) { | 477 if (!fSwizzler) { |
| 478 // FIXME: CreateSwizzler could fail for another reason. | 478 // FIXME: CreateSwizzler could fail for another reason. |
| 479 return kUnimplemented; | 479 return kUnimplemented; |
| 480 } | 480 } |
| 481 return kSuccess; | 481 return kSuccess; |
| 482 } | 482 } |
| 483 | 483 |
| 484 | 484 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 | 805 |
| 806 const SkImageInfo& srcInfo = codec->getInfo(); | 806 const SkImageInfo& srcInfo = codec->getInfo(); |
| 807 if (codec->fNumberPasses > 1) { | 807 if (codec->fNumberPasses > 1) { |
| 808 // interlaced image | 808 // interlaced image |
| 809 return SkNEW_ARGS(SkPngInterlacedScanlineDecoder, (srcInfo, codec.detach
())); | 809 return SkNEW_ARGS(SkPngInterlacedScanlineDecoder, (srcInfo, codec.detach
())); |
| 810 } | 810 } |
| 811 | 811 |
| 812 return SkNEW_ARGS(SkPngScanlineDecoder, (srcInfo, codec.detach())); | 812 return SkNEW_ARGS(SkPngScanlineDecoder, (srcInfo, codec.detach())); |
| 813 } | 813 } |
| 814 | 814 |
| OLD | NEW |