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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 cinfo.image_height = bm.height(); | 951 cinfo.image_height = bm.height(); |
952 cinfo.input_components = 3; | 952 cinfo.input_components = 3; |
953 #ifdef WE_CONVERT_TO_YUV | 953 #ifdef WE_CONVERT_TO_YUV |
954 cinfo.in_color_space = JCS_YCbCr; | 954 cinfo.in_color_space = JCS_YCbCr; |
955 #else | 955 #else |
956 cinfo.in_color_space = JCS_RGB; | 956 cinfo.in_color_space = JCS_RGB; |
957 #endif | 957 #endif |
958 cinfo.input_gamma = 1; | 958 cinfo.input_gamma = 1; |
959 | 959 |
960 jpeg_set_defaults(&cinfo); | 960 jpeg_set_defaults(&cinfo); |
| 961 cinfo.optimize_coding = TRUE; |
961 jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values
*/); | 962 jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values
*/); |
962 #ifdef DCT_IFAST_SUPPORTED | 963 #ifdef DCT_IFAST_SUPPORTED |
963 cinfo.dct_method = JDCT_IFAST; | 964 cinfo.dct_method = JDCT_IFAST; |
964 #endif | 965 #endif |
965 | 966 |
966 jpeg_start_compress(&cinfo, TRUE); | 967 jpeg_start_compress(&cinfo, TRUE); |
967 | 968 |
968 const int width = bm.width(); | 969 const int width = bm.width(); |
969 uint8_t* oneRowP = oneRow.reset(width * 3); | 970 uint8_t* oneRowP = oneRow.reset(width * 3); |
970 | 971 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 return SkImageDecoder::kUnknown_Format; | 1024 return SkImageDecoder::kUnknown_Format; |
1024 } | 1025 } |
1025 | 1026 |
1026 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { | 1027 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { |
1027 return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : nullptr; | 1028 return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : nullptr; |
1028 } | 1029 } |
1029 | 1030 |
1030 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); | 1031 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); |
1031 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); | 1032 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); |
1032 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); | 1033 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); |
OLD | NEW |