| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #define DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS false | 45 #define DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS false |
| 46 #else // !defined(SK_DEBUG) | 46 #else // !defined(SK_DEBUG) |
| 47 #define DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS true | 47 #define DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS true |
| 48 #endif // defined(SK_DEBUG) | 48 #endif // defined(SK_DEBUG) |
| 49 SK_CONF_DECLARE(bool, c_suppressPNGImageDecoderWarnings, | 49 SK_CONF_DECLARE(bool, c_suppressPNGImageDecoderWarnings, |
| 50 "images.png.suppressDecoderWarnings", | 50 "images.png.suppressDecoderWarnings", |
| 51 DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS, | 51 DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS, |
| 52 "Suppress most PNG warnings when calling image decode " | 52 "Suppress most PNG warnings when calling image decode " |
| 53 "functions."); | 53 "functions."); |
| 54 | 54 |
| 55 #if defined(SK_BUILD_FOR_ANDROID) && !defined(SK_PNG_NO_INDEX_SUPPORTED) | |
| 56 #define SK_PNG_INDEX_SUPPORTED | |
| 57 #endif | |
| 58 | |
| 59 class SkPNGImageIndex { | 55 class SkPNGImageIndex { |
| 60 public: | 56 public: |
| 61 // Takes ownership of stream. | 57 // Takes ownership of stream. |
| 62 SkPNGImageIndex(SkStreamRewindable* stream, png_structp png_ptr, png_infop i
nfo_ptr) | 58 SkPNGImageIndex(SkStreamRewindable* stream, png_structp png_ptr, png_infop i
nfo_ptr) |
| 63 : fStream(stream) | 59 : fStream(stream) |
| 64 , fPng_ptr(png_ptr) | 60 , fPng_ptr(png_ptr) |
| 65 , fInfo_ptr(info_ptr) | 61 , fInfo_ptr(info_ptr) |
| 66 , fColorType(kUnknown_SkColorType) { | 62 , fColorType(kUnknown_SkColorType) { |
| 67 SkASSERT(stream != nullptr); | 63 SkASSERT(stream != nullptr); |
| 68 } | 64 } |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 return SkImageDecoder::kUnknown_Format; | 1279 return SkImageDecoder::kUnknown_Format; |
| 1284 } | 1280 } |
| 1285 | 1281 |
| 1286 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) { | 1282 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) { |
| 1287 return (SkImageEncoder::kPNG_Type == t) ? new SkPNGImageEncoder : nullptr; | 1283 return (SkImageEncoder::kPNG_Type == t) ? new SkPNGImageEncoder : nullptr; |
| 1288 } | 1284 } |
| 1289 | 1285 |
| 1290 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory); | 1286 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory); |
| 1291 static SkImageDecoder_FormatReg gFormatReg(get_format_png); | 1287 static SkImageDecoder_FormatReg gFormatReg(get_format_png); |
| 1292 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory); | 1288 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory); |
| OLD | NEW |