OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
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 | 8 |
9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
10 #include "SkImageEncoder.h" | 10 #include "SkImageEncoder.h" |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 // now loop through scanlines until y == bm->height() - 1 | 717 // now loop through scanlines until y == bm->height() - 1 |
718 for (int y = 0;; y++) { | 718 for (int y = 0;; y++) { |
719 JSAMPLE* rowptr = (JSAMPLE*)srcRow; | 719 JSAMPLE* rowptr = (JSAMPLE*)srcRow; |
720 int row_count = jpeg_read_scanlines(&cinfo, &rowptr, 1); | 720 int row_count = jpeg_read_scanlines(&cinfo, &rowptr, 1); |
721 if (0 == row_count) { | 721 if (0 == row_count) { |
722 // if row_count == 0, then we didn't get a scanline, | 722 // if row_count == 0, then we didn't get a scanline, |
723 // so return early. We will return a partial image. | 723 // so return early. We will return a partial image. |
724 fill_below_level(y, bm); | 724 fill_below_level(y, bm); |
725 cinfo.output_scanline = cinfo.output_height; | 725 cinfo.output_scanline = cinfo.output_height; |
726 jpeg_finish_decompress(&cinfo); | 726 jpeg_finish_decompress(&cinfo); |
727 return kSuccess; | 727 return kPartialSuccess; |
728 } | 728 } |
729 if (this->shouldCancelDecode()) { | 729 if (this->shouldCancelDecode()) { |
730 return return_failure(cinfo, *bm, "shouldCancelDecode"); | 730 return return_failure(cinfo, *bm, "shouldCancelDecode"); |
731 } | 731 } |
732 | 732 |
733 if (JCS_CMYK == cinfo.out_color_space) { | 733 if (JCS_CMYK == cinfo.out_color_space) { |
734 convert_CMYK_to_RGB(srcRow, cinfo.output_width); | 734 convert_CMYK_to_RGB(srcRow, cinfo.output_width); |
735 } | 735 } |
736 | 736 |
737 sampler.next(srcRow); | 737 sampler.next(srcRow); |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 return SkImageDecoder::kUnknown_Format; | 1446 return SkImageDecoder::kUnknown_Format; |
1447 } | 1447 } |
1448 | 1448 |
1449 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { | 1449 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { |
1450 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; | 1450 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; |
1451 } | 1451 } |
1452 | 1452 |
1453 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); | 1453 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); |
1454 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); | 1454 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); |
1455 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); | 1455 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); |
OLD | NEW |