Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: src/codec/SkCodec_libgif.h

Issue 1332053002: Fill incomplete images in SkCodec parent class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use aligned memory in swizzler test Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | src/codec/SkCodec_libgif.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
73 int onOutputScanline(int inputScanline) const;
74
71 private: 75 private:
72 76
73 /* 77 /*
74 * A gif can contain multiple image frames. We will only decode the first 78 * 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 79 * frame. This function reads up to the first image frame, processing
76 * transparency and/or animation information that comes before the image 80 * transparency and/or animation information that comes before the image
77 * data. 81 * data.
78 * 82 *
79 * @param gif Pointer to the library type that manages the gif decode 83 * @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 84 * @param transIndex This call will set the transparent index based on the
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 /* 126 /*
123 * Initializes the swizzler. 127 * Initializes the swizzler.
124 * 128 *
125 * @param dstInfo Output image information. Dimensions may have been 129 * @param dstInfo Output image information. Dimensions may have been
126 * adjusted if the image frame size does not match the size 130 * adjusted if the image frame size does not match the size
127 * indicated in the header. 131 * indicated in the header.
128 * @param zeroInit Indicates if destination memory is zero initialized. 132 * @param zeroInit Indicates if destination memory is zero initialized.
129 */ 133 */
130 Result initializeSwizzler(const SkImageInfo& dstInfo, ZeroInitialized zeroIn it); 134 Result initializeSwizzler(const SkImageInfo& dstInfo, ZeroInitialized zeroIn it);
131 135
132 SkSampler* getSampler() override { return fSwizzler; } 136 SkSampler* getSampler(bool createIfNecessary) override {
137 SkASSERT(fSwizzler);
138 return fSwizzler;
139 }
133 140
134 /* 141 /*
135 * @return kSuccess if the read is successful and kIncompleteInput if the 142 * @return true if the read is successful and false if the read fails.
136 * read fails.
137 */ 143 */
138 Result readRow(); 144 bool readRow();
139 145
140 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opts , 146 Result onStartScanlineDecode(const SkImageInfo& dstInfo, const Options& opts ,
141 SkPMColor inputColorPtr[], int* inputColorCount) override; 147 SkPMColor inputColorPtr[], int* inputColorCount) override;
142 148
143 Result onGetScanlines(void* dst, int count, size_t rowBytes) override; 149 int onGetScanlines(void* dst, int count, size_t rowBytes) override;
144 150
145 SkScanlineOrder onGetScanlineOrder() const override; 151 SkScanlineOrder onGetScanlineOrder() const override;
146 152
147 int onNextScanline() const override;
148
149 /* 153 /*
150 * This function cleans up the gif object after the decode completes 154 * This function cleans up the gif object after the decode completes
151 * It is used in a SkAutoTCallIProc template 155 * It is used in a SkAutoTCallIProc template
152 */ 156 */
153 static void CloseGif(GifFileType* gif); 157 static void CloseGif(GifFileType* gif);
154 158
155 /* 159 /*
156 * Frees any extension data used in the decode 160 * Frees any extension data used in the decode
157 * Used in a SkAutoTCallVProc 161 * Used in a SkAutoTCallVProc
158 */ 162 */
(...skipping 17 matching lines...) Expand all
176 SkAutoTDeleteArray<uint8_t> fSrcBuffer; 180 SkAutoTDeleteArray<uint8_t> fSrcBuffer;
177 const SkIRect fFrameRect; 181 const SkIRect fFrameRect;
178 const uint32_t fTransIndex; 182 const uint32_t fTransIndex;
179 uint32_t fFillIndex; 183 uint32_t fFillIndex;
180 const bool fFrameIsSubset; 184 const bool fFrameIsSubset;
181 SkAutoTDelete<SkSwizzler> fSwizzler; 185 SkAutoTDelete<SkSwizzler> fSwizzler;
182 SkAutoTUnref<SkColorTable> fColorTable; 186 SkAutoTUnref<SkColorTable> fColorTable;
183 187
184 typedef SkCodec INHERITED; 188 typedef SkCodec INHERITED;
185 }; 189 };
OLDNEW
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | src/codec/SkCodec_libgif.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698