OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 #include "SkImageDecoder.h" | 8 #include "SkImageDecoder.h" |
9 #include "SkImageEncoder.h" | 9 #include "SkImageEncoder.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #endif | 30 #endif |
31 | 31 |
32 #ifndef int_p_NULL | 32 #ifndef int_p_NULL |
33 #define int_p_NULL nullptr | 33 #define int_p_NULL nullptr |
34 #endif | 34 #endif |
35 | 35 |
36 #ifndef png_flush_ptr_NULL | 36 #ifndef png_flush_ptr_NULL |
37 #define png_flush_ptr_NULL nullptr | 37 #define png_flush_ptr_NULL nullptr |
38 #endif | 38 #endif |
39 | 39 |
40 #if defined(SK_DEBUG) | |
41 #define DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS false | |
42 #else // !defined(SK_DEBUG) | |
43 #define DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS true | 40 #define DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS true |
44 #endif // defined(SK_DEBUG) | |
45 SK_CONF_DECLARE(bool, c_suppressPNGImageDecoderWarnings, | 41 SK_CONF_DECLARE(bool, c_suppressPNGImageDecoderWarnings, |
46 "images.png.suppressDecoderWarnings", | 42 "images.png.suppressDecoderWarnings", |
47 DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS, | 43 DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS, |
48 "Suppress most PNG warnings when calling image decode " | 44 "Suppress most PNG warnings when calling image decode " |
49 "functions."); | 45 "functions."); |
50 | 46 |
51 class SkPNGImageIndex { | 47 class SkPNGImageIndex { |
52 public: | 48 public: |
53 // Takes ownership of stream. | 49 // Takes ownership of stream. |
54 SkPNGImageIndex(SkStreamRewindable* stream, png_structp png_ptr, png_infop i
nfo_ptr) | 50 SkPNGImageIndex(SkStreamRewindable* stream, png_structp png_ptr, png_infop i
nfo_ptr) |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 return SkImageDecoder::kUnknown_Format; | 1010 return SkImageDecoder::kUnknown_Format; |
1015 } | 1011 } |
1016 | 1012 |
1017 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) { | 1013 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) { |
1018 return (SkImageEncoder::kPNG_Type == t) ? new SkPNGImageEncoder : nullptr; | 1014 return (SkImageEncoder::kPNG_Type == t) ? new SkPNGImageEncoder : nullptr; |
1019 } | 1015 } |
1020 | 1016 |
1021 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory); | 1017 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory); |
1022 static SkImageDecoder_FormatReg gFormatReg(get_format_png); | 1018 static SkImageDecoder_FormatReg gFormatReg(get_format_png); |
1023 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory); | 1019 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory); |
OLD | NEW |