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 19 matching lines...) Expand all Loading... |
30 // These enable timing code that report milliseconds for an encoding/decoding | 30 // These enable timing code that report milliseconds for an encoding/decoding |
31 //#define TIME_ENCODE | 31 //#define TIME_ENCODE |
32 //#define TIME_DECODE | 32 //#define TIME_DECODE |
33 | 33 |
34 // this enables our rgb->yuv code, which is faster than libjpeg on ARM | 34 // this enables our rgb->yuv code, which is faster than libjpeg on ARM |
35 #define WE_CONVERT_TO_YUV | 35 #define WE_CONVERT_TO_YUV |
36 | 36 |
37 // If ANDROID_RGB is defined by in the jpeg headers it indicates that jpeg offer
s | 37 // If ANDROID_RGB is defined by in the jpeg headers it indicates that jpeg offer
s |
38 // support for two additional formats (1) JCS_RGBA_8888 and (2) JCS_RGB_565. | 38 // support for two additional formats (1) JCS_RGBA_8888 and (2) JCS_RGB_565. |
39 | 39 |
40 #if defined(SK_DEBUG) | |
41 #define DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_WARNINGS false | |
42 #define DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_ERRORS false | |
43 #else // !defined(SK_DEBUG) | |
44 #define DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_WARNINGS true | 40 #define DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_WARNINGS true |
45 #define DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_ERRORS true | 41 #define DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_ERRORS true |
46 #endif // defined(SK_DEBUG) | |
47 SK_CONF_DECLARE(bool, c_suppressJPEGImageDecoderWarnings, | 42 SK_CONF_DECLARE(bool, c_suppressJPEGImageDecoderWarnings, |
48 "images.jpeg.suppressDecoderWarnings", | 43 "images.jpeg.suppressDecoderWarnings", |
49 DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_WARNINGS, | 44 DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_WARNINGS, |
50 "Suppress most JPG warnings when calling decode functions."); | 45 "Suppress most JPG warnings when calling decode functions."); |
51 SK_CONF_DECLARE(bool, c_suppressJPEGImageDecoderErrors, | 46 SK_CONF_DECLARE(bool, c_suppressJPEGImageDecoderErrors, |
52 "images.jpeg.suppressDecoderErrors", | 47 "images.jpeg.suppressDecoderErrors", |
53 DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_ERRORS, | 48 DEFAULT_FOR_SUPPRESS_JPEG_IMAGE_DECODER_ERRORS, |
54 "Suppress most JPG error messages when decode " | 49 "Suppress most JPG error messages when decode " |
55 "function fails."); | 50 "function fails."); |
56 | 51 |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 return SkImageDecoder::kUnknown_Format; | 1023 return SkImageDecoder::kUnknown_Format; |
1029 } | 1024 } |
1030 | 1025 |
1031 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { | 1026 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { |
1032 return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : nullptr; | 1027 return (SkImageEncoder::kJPEG_Type == t) ? new SkJPEGImageEncoder : nullptr; |
1033 } | 1028 } |
1034 | 1029 |
1035 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); | 1030 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); |
1036 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); | 1031 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); |
1037 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); | 1032 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); |
OLD | NEW |