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 SkCodec_DEFINED | 8 #ifndef SkCodec_DEFINED |
9 #define SkCodec_DEFINED | 9 #define SkCodec_DEFINED |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 * If the image is not a PNG, the SkPngChunkReader will be ignored. | 88 * If the image is not a PNG, the SkPngChunkReader will be ignored. |
89 * If the image is a PNG, the SkPngChunkReader will be reffed. | 89 * If the image is a PNG, the SkPngChunkReader will be reffed. |
90 * If the PNG has unknown chunks, the SkPngChunkReader will be used | 90 * If the PNG has unknown chunks, the SkPngChunkReader will be used |
91 * to handle these chunks. SkPngChunkReader will be called to read | 91 * to handle these chunks. SkPngChunkReader will be called to read |
92 * any unknown chunk at any point during the creation of the codec | 92 * any unknown chunk at any point during the creation of the codec |
93 * or the decode. Note that if SkPngChunkReader fails to read a | 93 * or the decode. Note that if SkPngChunkReader fails to read a |
94 * chunk, this could result in a failure to create the codec or a | 94 * chunk, this could result in a failure to create the codec or a |
95 * failure to decode the image. | 95 * failure to decode the image. |
96 * If the PNG does not contain unknown chunks, the SkPngChunkReader | 96 * If the PNG does not contain unknown chunks, the SkPngChunkReader |
97 * will not be used or modified. | 97 * will not be used or modified. |
98 * | |
99 * Will take a ref if it returns a codec, else will not affect the data. | |
100 */ | 98 */ |
101 static SkCodec* NewFromData(SkData*, SkPngChunkReader* = NULL); | 99 static SkCodec* NewFromData(sk_sp<SkData>, SkPngChunkReader* = NULL); |
| 100 static SkCodec* NewFromData(SkData* data, SkPngChunkReader* reader) { |
| 101 return NewFromData(sk_ref_sp(data), reader); |
| 102 } |
102 | 103 |
103 virtual ~SkCodec(); | 104 virtual ~SkCodec(); |
104 | 105 |
105 /** | 106 /** |
106 * Return the ImageInfo associated with this codec. | 107 * Return the ImageInfo associated with this codec. |
107 */ | 108 */ |
108 const SkImageInfo& getInfo() const { return fSrcInfo; } | 109 const SkImageInfo& getInfo() const { return fSrcInfo; } |
109 | 110 |
110 const SkEncodedInfo& getEncodedInfo() const { return fEncodedInfo; } | 111 const SkEncodedInfo& getEncodedInfo() const { return fEncodedInfo; } |
111 | 112 |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 730 |
730 // For testing with qcms | 731 // For testing with qcms |
731 // FIXME: Remove these when we are done comparing with qcms. | 732 // FIXME: Remove these when we are done comparing with qcms. |
732 friend class DM::ColorCodecSrc; | 733 friend class DM::ColorCodecSrc; |
733 friend class ColorCodecBench; | 734 friend class ColorCodecBench; |
734 | 735 |
735 friend class SkSampledCodec; | 736 friend class SkSampledCodec; |
736 friend class SkIcoCodec; | 737 friend class SkIcoCodec; |
737 }; | 738 }; |
738 #endif // SkCodec_DEFINED | 739 #endif // SkCodec_DEFINED |
OLD | NEW |