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 "SkColorTable.h" | 9 #include "SkColorTable.h" |
10 #include "SkImageInfo.h" | 10 #include "SkImageInfo.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 * Ownership is unchanged when we returned a gifOut. | 56 * Ownership is unchanged when we returned a gifOut. |
57 * | 57 * |
58 */ | 58 */ |
59 static bool ReadHeader(SkStream* stream, SkCodec** codecOut, | 59 static bool ReadHeader(SkStream* stream, SkCodec** codecOut, |
60 GifFileType** gifOut); | 60 GifFileType** gifOut); |
61 | 61 |
62 /* | 62 /* |
63 * Performs the full gif decode | 63 * Performs the full gif decode |
64 */ | 64 */ |
65 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, | 65 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, |
66 SkPMColor*, int32_t*) override; | 66 SkPMColor*, int*, int*) override; |
67 | 67 |
68 SkEncodedFormat onGetEncodedFormat() const override { | 68 SkEncodedFormat onGetEncodedFormat() const override { |
69 return kGIF_SkEncodedFormat; | 69 return kGIF_SkEncodedFormat; |
70 } | 70 } |
71 | 71 |
72 bool onRewind() override; | 72 bool onRewind() override; |
73 | 73 |
| 74 uint32_t onGetFillValue(const SkImageInfo& dstInfo) const override; |
| 75 |
74 private: | 76 private: |
75 | 77 |
76 /* | 78 /* |
77 * A gif can contain multiple image frames. We will only decode the first | 79 * A gif can contain multiple image frames. We will only decode the first |
78 * frame. This function reads up to the first image frame, processing | 80 * frame. This function reads up to the first image frame, processing |
79 * transparency and/or animation information that comes before the image | 81 * transparency and/or animation information that comes before the image |
80 * data. | 82 * data. |
81 * | 83 * |
82 * @param gif Pointer to the library type that manages the gif decode | 84 * @param gif Pointer to the library type that manages the gif decode |
83 * @param transIndex This call will set the transparent index based on the | 85 * @param transIndex This call will set the transparent index based on the |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 * | 124 * |
123 * @param dstInfo Output image information. Dimensions may have been | 125 * @param dstInfo Output image information. Dimensions may have been |
124 * adjusted if the image frame size does not match the size | 126 * adjusted if the image frame size does not match the size |
125 * indicated in the header. | 127 * indicated in the header. |
126 * @param zeroInit Indicates if destination memory is zero initialized. | 128 * @param zeroInit Indicates if destination memory is zero initialized. |
127 */ | 129 */ |
128 SkCodec::Result initializeSwizzler(const SkImageInfo& dstInfo, | 130 SkCodec::Result initializeSwizzler(const SkImageInfo& dstInfo, |
129 ZeroInitialized zeroInit); | 131 ZeroInitialized zeroInit); |
130 | 132 |
131 /* | 133 /* |
132 * @return kSuccess if the read is successful and kIncompleteInput if the | 134 * @return true if the read is successful and false if the read fails. |
133 * read fails. | |
134 */ | 135 */ |
135 SkCodec::Result readRow(); | 136 bool readRow(); |
136 | 137 |
137 /* | 138 /* |
138 * This function cleans up the gif object after the decode completes | 139 * This function cleans up the gif object after the decode completes |
139 * It is used in a SkAutoTCallIProc template | 140 * It is used in a SkAutoTCallIProc template |
140 */ | 141 */ |
141 static void CloseGif(GifFileType* gif); | 142 static void CloseGif(GifFileType* gif); |
142 | 143 |
143 /* | 144 /* |
144 * Frees any extension data used in the decode | 145 * Frees any extension data used in the decode |
145 * Used in a SkAutoTCallVProc | 146 * Used in a SkAutoTCallVProc |
(...skipping 19 matching lines...) Expand all Loading... |
165 const uint32_t fTransIndex; | 166 const uint32_t fTransIndex; |
166 uint32_t fFillIndex; | 167 uint32_t fFillIndex; |
167 bool fFrameIsSubset; | 168 bool fFrameIsSubset; |
168 SkAutoTDelete<SkSwizzler> fSwizzler; | 169 SkAutoTDelete<SkSwizzler> fSwizzler; |
169 SkAutoTUnref<SkColorTable> fColorTable; | 170 SkAutoTUnref<SkColorTable> fColorTable; |
170 | 171 |
171 friend class SkGifScanlineDecoder; | 172 friend class SkGifScanlineDecoder; |
172 | 173 |
173 typedef SkCodec INHERITED; | 174 typedef SkCodec INHERITED; |
174 }; | 175 }; |
OLD | NEW |