Chromium Code Reviews| 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 #include "SkCodec.h" | 8 #include "SkCodec.h" |
| 9 #include "SkImageInfo.h" | 9 #include "SkImageInfo.h" |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 * Assumes IsGif was called and returned true | 27 * Assumes IsGif was called and returned true |
| 28 * Creates a gif decoder | 28 * Creates a gif decoder |
| 29 * Reads enough of the stream to determine the image format | 29 * Reads enough of the stream to determine the image format |
| 30 */ | 30 */ |
| 31 static SkCodec* NewFromStream(SkStream*); | 31 static SkCodec* NewFromStream(SkStream*); |
| 32 | 32 |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 | 35 |
| 36 /* | 36 /* |
| 37 * Read enough of the stream to initialize the SkGifCodec. | |
|
scroggo
2015/04/09 17:37:17
Please add comments regarding ownership of SkStrea
msarett
2015/04/09 19:21:31
Done.
| |
| 38 * Returns a bool representing success or failure. | |
| 39 * | |
| 40 * If it returned true, and codecOut was not NULL, | |
| 41 * codecOut will be set to a new SkGifCodec. | |
| 42 * | |
| 43 * If it returned true, and codecOut was NULL, | |
| 44 * gifOut must be non-NULL and gifOut will be set to a new | |
| 45 * GifFileType pointer. | |
| 46 */ | |
| 47 static bool ReadHeader(SkStream*, SkCodec** codecOut, GifFileType** gifOut); | |
| 48 | |
| 49 /* | |
| 37 * Initiates the gif decode | 50 * Initiates the gif decode |
| 38 */ | 51 */ |
| 39 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, | 52 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, |
| 40 SkPMColor*, int32_t*) override; | 53 SkPMColor*, int32_t*) override; |
| 41 | 54 |
| 42 SkEncodedFormat onGetEncodedFormat() const override { | 55 SkEncodedFormat onGetEncodedFormat() const override { |
| 43 return kGIF_SkEncodedFormat; | 56 return kGIF_SkEncodedFormat; |
| 44 } | 57 } |
| 45 | 58 |
| 46 private: | 59 private: |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 65 * @param stream the stream of image data | 78 * @param stream the stream of image data |
| 66 * @param gif pointer to library type that manages gif decode | 79 * @param gif pointer to library type that manages gif decode |
| 67 * takes ownership | 80 * takes ownership |
| 68 */ | 81 */ |
| 69 SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType* gif); | 82 SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType* gif); |
| 70 | 83 |
| 71 SkAutoTCallIProc<GifFileType, CloseGif> fGif; // owned | 84 SkAutoTCallIProc<GifFileType, CloseGif> fGif; // owned |
| 72 | 85 |
| 73 typedef SkCodec INHERITED; | 86 typedef SkCodec INHERITED; |
| 74 }; | 87 }; |
| OLD | NEW |