| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 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 #ifndef SkAndroidCodec_DEFINED | 8 #ifndef SkAndroidCodec_DEFINED |
| 9 #define SkAndroidCodec_DEFINED | 9 #define SkAndroidCodec_DEFINED |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 * SkCodec takes ownership of it, and will delete it when done with it. | 30 * SkCodec takes ownership of it, and will delete it when done with it. |
| 31 */ | 31 */ |
| 32 static SkAndroidCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL); | 32 static SkAndroidCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL); |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * If this data represents an encoded image that we know how to decode, | 35 * If this data represents an encoded image that we know how to decode, |
| 36 * return an SkAndroidCodec that can decode it. Otherwise return NULL. | 36 * return an SkAndroidCodec that can decode it. Otherwise return NULL. |
| 37 * | 37 * |
| 38 * The SkPngChunkReader handles unknown chunks in PNGs. | 38 * The SkPngChunkReader handles unknown chunks in PNGs. |
| 39 * See SkCodec.h for more details. | 39 * See SkCodec.h for more details. |
| 40 * | |
| 41 * Will take a ref if it returns a codec, else will not affect the data. | |
| 42 */ | 40 */ |
| 43 static SkAndroidCodec* NewFromData(SkData*, SkPngChunkReader* = NULL); | 41 static SkAndroidCodec* NewFromData(sk_sp<SkData>, SkPngChunkReader* = NULL); |
| 42 static SkAndroidCodec* NewFromData(SkData* data, SkPngChunkReader* reader) { |
| 43 return NewFromData(sk_ref_sp(data), reader); |
| 44 } |
| 44 | 45 |
| 45 virtual ~SkAndroidCodec() {} | 46 virtual ~SkAndroidCodec() {} |
| 46 | 47 |
| 47 | 48 |
| 48 const SkImageInfo& getInfo() const { return fInfo; } | 49 const SkImageInfo& getInfo() const { return fInfo; } |
| 49 | 50 |
| 50 /** | 51 /** |
| 51 * Format of the encoded data. | 52 * Format of the encoded data. |
| 52 */ | 53 */ |
| 53 SkEncodedFormat getEncodedFormat() const { return fCodec->getEncodedFormat()
; } | 54 SkEncodedFormat getEncodedFormat() const { return fCodec->getEncodedFormat()
; } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 256 |
| 256 private: | 257 private: |
| 257 | 258 |
| 258 // This will always be a reference to the info that is contained by the | 259 // This will always be a reference to the info that is contained by the |
| 259 // embedded SkCodec. | 260 // embedded SkCodec. |
| 260 const SkImageInfo& fInfo; | 261 const SkImageInfo& fInfo; |
| 261 | 262 |
| 262 SkAutoTDelete<SkCodec> fCodec; | 263 SkAutoTDelete<SkCodec> fCodec; |
| 263 }; | 264 }; |
| 264 #endif // SkAndroidCodec_DEFINED | 265 #endif // SkAndroidCodec_DEFINED |
| OLD | NEW |