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.h" | 8 #include "SkCodec.h" |
9 #include "SkMSAN.h" | 9 #include "SkMSAN.h" |
10 #include "SkJpegCodec.h" | 10 #include "SkJpegCodec.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } | 519 } |
520 | 520 |
521 void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options&
options) { | 521 void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options&
options) { |
522 // libjpeg-turbo may have already performed color conversion. We must indic
ate the | 522 // libjpeg-turbo may have already performed color conversion. We must indic
ate the |
523 // appropriate format to the swizzler. | 523 // appropriate format to the swizzler. |
524 SkEncodedInfo swizzlerInfo = this->getEncodedInfo(); | 524 SkEncodedInfo swizzlerInfo = this->getEncodedInfo(); |
525 bool preSwizzled = true; | 525 bool preSwizzled = true; |
526 switch (fDecoderMgr->dinfo()->out_color_space) { | 526 switch (fDecoderMgr->dinfo()->out_color_space) { |
527 case JCS_RGB: | 527 case JCS_RGB: |
528 preSwizzled = false; | 528 preSwizzled = false; |
529 swizzlerInfo.setColor(SkEncodedInfo::kRGB_Color); | 529 swizzlerInfo = SkEncodedInfo::Make(SkEncodedInfo::kRGB_Color, |
| 530 swizzlerInfo.alpha(), |
| 531 swizzlerInfo.bitsPerComponent()); |
530 break; | 532 break; |
531 case JCS_CMYK: | 533 case JCS_CMYK: |
532 preSwizzled = false; | 534 preSwizzled = false; |
533 swizzlerInfo.setColor(SkEncodedInfo::kInvertedCMYK_Color); | 535 swizzlerInfo = SkEncodedInfo::Make( |
| 536 SkEncodedInfo::kInvertedCMYK_Color, swizzlerInfo.alpha(), |
| 537 swizzlerInfo.bitsPerComponent()); |
534 break; | 538 break; |
535 default: | 539 default: |
536 break; | 540 break; |
537 } | 541 } |
538 | 542 |
539 Options swizzlerOptions = options; | 543 Options swizzlerOptions = options; |
540 if (options.fSubset) { | 544 if (options.fSubset) { |
541 // Use fSwizzlerSubset if this is a subset decode. This is necessary in
the case | 545 // Use fSwizzlerSubset if this is a subset decode. This is necessary in
the case |
542 // where libjpeg-turbo provides a subset and then we need to subset it f
urther. | 546 // where libjpeg-turbo provides a subset and then we need to subset it f
urther. |
543 // Also, verify that fSwizzlerSubset is initialized and valid. | 547 // Also, verify that fSwizzlerSubset is initialized and valid. |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 | 898 |
895 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); | 899 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); |
896 if (linesRead < remainingRows) { | 900 if (linesRead < remainingRows) { |
897 // FIXME: Handle incomplete YUV decodes without signalling an error. | 901 // FIXME: Handle incomplete YUV decodes without signalling an error. |
898 return kInvalidInput; | 902 return kInvalidInput; |
899 } | 903 } |
900 } | 904 } |
901 | 905 |
902 return kSuccess; | 906 return kSuccess; |
903 } | 907 } |
OLD | NEW |