| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 break; | 412 break; |
| 413 default: | 413 default: |
| 414 // We cannot decode a non-opaque image to opaque (or unknown) | 414 // We cannot decode a non-opaque image to opaque (or unknown) |
| 415 return false; | 415 return false; |
| 416 } | 416 } |
| 417 } | 417 } |
| 418 // Check for supported color types | 418 // Check for supported color types |
| 419 switch (dst.colorType()) { | 419 switch (dst.colorType()) { |
| 420 case kN32_SkColorType: | 420 case kN32_SkColorType: |
| 421 return true; | 421 return true; |
| 422 case kRGB_565_SkColorType: |
| 423 return src.alphaType() == kOpaque_SkAlphaType; |
| 422 default: | 424 default: |
| 423 return dst.colorType() == src.colorType(); | 425 return dst.colorType() == src.colorType(); |
| 424 } | 426 } |
| 425 } | 427 } |
| 426 | 428 |
| 427 SkCodec::Result SkPngCodec::initializeSwizzler(const SkImageInfo& requestedInfo, | 429 SkCodec::Result SkPngCodec::initializeSwizzler(const SkImageInfo& requestedInfo, |
| 428 const Options& options, | 430 const Options& options, |
| 429 SkPMColor ctable[], | 431 SkPMColor ctable[], |
| 430 int* ctableCount) { | 432 int* ctableCount) { |
| 431 // FIXME: Could we use the return value of setjmp to specify the type of | 433 // FIXME: Could we use the return value of setjmp to specify the type of |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 | 807 |
| 806 const SkImageInfo& srcInfo = codec->getInfo(); | 808 const SkImageInfo& srcInfo = codec->getInfo(); |
| 807 if (codec->fNumberPasses > 1) { | 809 if (codec->fNumberPasses > 1) { |
| 808 // interlaced image | 810 // interlaced image |
| 809 return SkNEW_ARGS(SkPngInterlacedScanlineDecoder, (srcInfo, codec.detach
())); | 811 return SkNEW_ARGS(SkPngInterlacedScanlineDecoder, (srcInfo, codec.detach
())); |
| 810 } | 812 } |
| 811 | 813 |
| 812 return SkNEW_ARGS(SkPngScanlineDecoder, (srcInfo, codec.detach())); | 814 return SkNEW_ARGS(SkPngScanlineDecoder, (srcInfo, codec.detach())); |
| 813 } | 815 } |
| 814 | 816 |
| OLD | NEW |