| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 * Ownership is unchanged when we returned a gifOut. | 53 * Ownership is unchanged when we returned a gifOut. |
| 54 * | 54 * |
| 55 */ | 55 */ |
| 56 static bool ReadHeader(SkStream* stream, SkCodec** codecOut, | 56 static bool ReadHeader(SkStream* stream, SkCodec** codecOut, |
| 57 GifFileType** gifOut); | 57 GifFileType** gifOut); |
| 58 | 58 |
| 59 /* | 59 /* |
| 60 * Performs the full gif decode | 60 * Performs the full gif decode |
| 61 */ | 61 */ |
| 62 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, | 62 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, |
| 63 SkPMColor*, int32_t*) override; | 63 SkPMColor*, int*, int*) override; |
| 64 | 64 |
| 65 SkEncodedFormat onGetEncodedFormat() const override { | 65 SkEncodedFormat onGetEncodedFormat() const override { |
| 66 return kGIF_SkEncodedFormat; | 66 return kGIF_SkEncodedFormat; |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool onRewind() override; | 69 bool onRewind() override; |
| 70 | 70 |
| 71 uint32_t onGetFillValue(SkColorType colorType, SkAlphaType alphaType) const
override; |
| 72 |
| 71 private: | 73 private: |
| 72 | 74 |
| 73 /* | 75 /* |
| 74 * A gif can contain multiple image frames. We will only decode the first | 76 * A gif can contain multiple image frames. We will only decode the first |
| 75 * frame. This function reads up to the first image frame, processing | 77 * frame. This function reads up to the first image frame, processing |
| 76 * transparency and/or animation information that comes before the image | 78 * transparency and/or animation information that comes before the image |
| 77 * data. | 79 * data. |
| 78 * | 80 * |
| 79 * @param gif Pointer to the library type that manages the gif decode | 81 * @param gif Pointer to the library type that manages the gif decode |
| 80 * @param transIndex This call will set the transparent index based on the | 82 * @param transIndex This call will set the transparent index based on the |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 * Initializes the swizzler. | 120 * Initializes the swizzler. |
| 119 * | 121 * |
| 120 * @param dstInfo Output image information. Dimensions may have been | 122 * @param dstInfo Output image information. Dimensions may have been |
| 121 * adjusted if the image frame size does not match the size | 123 * adjusted if the image frame size does not match the size |
| 122 * indicated in the header. | 124 * indicated in the header. |
| 123 * @param zeroInit Indicates if destination memory is zero initialized. | 125 * @param zeroInit Indicates if destination memory is zero initialized. |
| 124 */ | 126 */ |
| 125 Result initializeSwizzler(const SkImageInfo& dstInfo, ZeroInitialized zeroIn
it); | 127 Result initializeSwizzler(const SkImageInfo& dstInfo, ZeroInitialized zeroIn
it); |
| 126 | 128 |
| 127 /* | 129 /* |
| 128 * @return kSuccess if the read is successful and kIncompleteInput if the | 130 * @return true if the read is successful and false if the read fails. |
| 129 * read fails. | |
| 130 */ | 131 */ |
| 131 Result readRow(); | 132 bool readRow(); |
| 132 | 133 |
| 133 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opts
, | 134 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opts
, |
| 134 SkPMColor inputColorPtr[], int* inputColorCount) override; | 135 SkPMColor inputColorPtr[], int* inputColorCount) override; |
| 135 | 136 |
| 136 Result onGetScanlines(void* dst, int count, size_t rowBytes) override; | 137 uint32_t onGetScanlines(void* dst, int count, size_t rowBytes) override; |
| 137 | 138 |
| 138 SkScanlineOrder onGetScanlineOrder() const override; | 139 SkScanlineOrder onGetScanlineOrder() const override; |
| 139 | 140 |
| 140 int onNextScanline() const override; | |
| 141 | |
| 142 /* | 141 /* |
| 143 * This function cleans up the gif object after the decode completes | 142 * This function cleans up the gif object after the decode completes |
| 144 * It is used in a SkAutoTCallIProc template | 143 * It is used in a SkAutoTCallIProc template |
| 145 */ | 144 */ |
| 146 static void CloseGif(GifFileType* gif); | 145 static void CloseGif(GifFileType* gif); |
| 147 | 146 |
| 148 /* | 147 /* |
| 149 * Frees any extension data used in the decode | 148 * Frees any extension data used in the decode |
| 150 * Used in a SkAutoTCallVProc | 149 * Used in a SkAutoTCallVProc |
| 151 */ | 150 */ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 168 SkAutoTDeleteArray<uint8_t> fSrcBuffer; | 167 SkAutoTDeleteArray<uint8_t> fSrcBuffer; |
| 169 SkIRect fFrameDims; | 168 SkIRect fFrameDims; |
| 170 const uint32_t fTransIndex; | 169 const uint32_t fTransIndex; |
| 171 uint32_t fFillIndex; | 170 uint32_t fFillIndex; |
| 172 bool fFrameIsSubset; | 171 bool fFrameIsSubset; |
| 173 SkAutoTDelete<SkSwizzler> fSwizzler; | 172 SkAutoTDelete<SkSwizzler> fSwizzler; |
| 174 SkAutoTUnref<SkColorTable> fColorTable; | 173 SkAutoTUnref<SkColorTable> fColorTable; |
| 175 | 174 |
| 176 typedef SkCodec INHERITED; | 175 typedef SkCodec INHERITED; |
| 177 }; | 176 }; |
| OLD | NEW |