| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 png_structp fPng_ptr; | 71 png_structp fPng_ptr; |
| 72 png_infop fInfo_ptr; | 72 png_infop fInfo_ptr; |
| 73 SkColorType fColorType; | 73 SkColorType fColorType; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 class SkPNGImageDecoder : public SkImageDecoder { | 76 class SkPNGImageDecoder : public SkImageDecoder { |
| 77 public: | 77 public: |
| 78 SkPNGImageDecoder() { | 78 SkPNGImageDecoder() { |
| 79 fImageIndex = NULL; | 79 fImageIndex = NULL; |
| 80 } | 80 } |
| 81 Format getFormat() const SK_OVERRIDE { | 81 SkEncodedFormat getFormat() const SK_OVERRIDE { |
| 82 return kPNG_Format; | 82 return kPNG_SkEncodedFormat; |
| 83 } | 83 } |
| 84 | 84 |
| 85 virtual ~SkPNGImageDecoder() { | 85 virtual ~SkPNGImageDecoder() { |
| 86 SkDELETE(fImageIndex); | 86 SkDELETE(fImageIndex); |
| 87 } | 87 } |
| 88 | 88 |
| 89 protected: | 89 protected: |
| 90 #ifdef SK_BUILD_FOR_ANDROID | 90 #ifdef SK_BUILD_FOR_ANDROID |
| 91 bool onBuildTileIndex(SkStreamRewindable *stream, int *width, int *height) S
K_OVERRIDE; | 91 bool onBuildTileIndex(SkStreamRewindable *stream, int *width, int *height) S
K_OVERRIDE; |
| 92 bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& region) SK_OVERRIDE; | 92 bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& region) SK_OVERRIDE; |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 return false; | 1266 return false; |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 SkImageDecoder* sk_libpng_dfactory(SkStreamRewindable* stream) { | 1269 SkImageDecoder* sk_libpng_dfactory(SkStreamRewindable* stream) { |
| 1270 if (is_png(stream)) { | 1270 if (is_png(stream)) { |
| 1271 return SkNEW(SkPNGImageDecoder); | 1271 return SkNEW(SkPNGImageDecoder); |
| 1272 } | 1272 } |
| 1273 return NULL; | 1273 return NULL; |
| 1274 } | 1274 } |
| 1275 | 1275 |
| 1276 static SkImageDecoder::Format get_format_png(SkStreamRewindable* stream) { | 1276 static SkEncodedFormat get_format_png(SkStreamRewindable* stream) { |
| 1277 if (is_png(stream)) { | 1277 if (is_png(stream)) { |
| 1278 return SkImageDecoder::kPNG_Format; | 1278 return kPNG_SkEncodedFormat; |
| 1279 } | 1279 } |
| 1280 return SkImageDecoder::kUnknown_Format; | 1280 return kUnknown_SkEncodedFormat; |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) { | 1283 SkImageEncoder* sk_libpng_efactory(SkEncodedFormat t) { |
| 1284 return (SkImageEncoder::kPNG_Type == t) ? SkNEW(SkPNGImageEncoder) : NULL; | 1284 return (kPNG_SkEncodedFormat == t) ? SkNEW(SkPNGImageEncoder) : NULL; |
| 1285 } | 1285 } |
| 1286 | 1286 |
| 1287 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory); | 1287 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory); |
| 1288 static SkImageDecoder_FormatReg gFormatReg(get_format_png); | 1288 static SkImageDecoder_FormatReg gFormatReg(get_format_png); |
| 1289 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory); | 1289 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory); |
| OLD | NEW |