| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 * rewound. | 161 * rewound. |
| 162 * kCouldNotRewind if the stream needed to be rewound, and | 162 * kCouldNotRewind if the stream needed to be rewound, and |
| 163 * rewind failed. | 163 * rewind failed. |
| 164 * | 164 * |
| 165 * Subclasses MUST call this function before reading the stream (e.g. in | 165 * Subclasses MUST call this function before reading the stream (e.g. in |
| 166 * onGetPixels). If it returns false, onGetPixels should return | 166 * onGetPixels). If it returns false, onGetPixels should return |
| 167 * kCouldNotRewind. | 167 * kCouldNotRewind. |
| 168 */ | 168 */ |
| 169 RewindState SK_WARN_UNUSED_RESULT rewindIfNeeded(); | 169 RewindState SK_WARN_UNUSED_RESULT rewindIfNeeded(); |
| 170 | 170 |
| 171 /* | 171 /** |
| 172 * | |
| 173 * Get method for the input stream | 172 * Get method for the input stream |
| 174 * | |
| 175 */ | 173 */ |
| 176 SkStream* stream() { | 174 SkStream* stream() { |
| 177 return fStream.get(); | 175 return fStream.get(); |
| 178 } | 176 } |
| 179 | 177 |
| 178 /** |
| 179 * If the codec has a scanline decoder, return it (no ownership change occur
s) |
| 180 * else return NULL. |
| 181 * The returned decoder is valid while the codec exists and the client has n
ot |
| 182 * created a new scanline decoder. |
| 183 */ |
| 184 SkScanlineDecoder* scanlineDecoder() { |
| 185 return fScanlineDecoder.get(); |
| 186 } |
| 187 |
| 188 /** |
| 189 * Allow the codec subclass to detach and take ownership of the scanline dec
oder. |
| 190 * This will likely be used when the scanline decoder needs to be destroyed |
| 191 * in the destructor of the subclass. |
| 192 */ |
| 193 SkScanlineDecoder* detachScanlineDecoder() { |
| 194 return fScanlineDecoder.detach(); |
| 195 } |
| 196 |
| 180 private: | 197 private: |
| 181 SkAutoTDelete<SkStream> fStream; | 198 SkAutoTDelete<SkStream> fStream; |
| 182 bool fNeedsRewind; | 199 bool fNeedsRewind; |
| 183 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; | 200 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; |
| 184 | 201 |
| 185 typedef SkImageGenerator INHERITED; | 202 typedef SkImageGenerator INHERITED; |
| 186 }; | 203 }; |
| 187 #endif // SkCodec_DEFINED | 204 #endif // SkCodec_DEFINED |
| OLD | NEW |