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

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

Issue 1386973002: Fix SkGifCodec to handle gifs where frameSize != imageSize (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 * data. 77 * data.
78 * 78 *
79 * @param gif Pointer to the library type that manages the gif decode 79 * @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 80 * @param transIndex This call will set the transparent index based on the
81 * extension data. 81 * extension data.
82 */ 82 */
83 static Result ReadUpToFirstImage(GifFileType* gif, uint32_t* transIndex); 83 static Result ReadUpToFirstImage(GifFileType* gif, uint32_t* transIndex);
84 84
85 /* 85 /*
86 * A gif may contain many image frames, all of different sizes. 86 * A gif may contain many image frames, all of different sizes.
87 * This function checks if the frame dimensions are valid and corrects 87 * This function checks if the gif dimensions are valid, based on the frame
88 * them if necessary. It then sets fFrameDims to the corrected 88 * dimensions, and corrects the gif dimensions if necessary.
89 * dimensions.
90 * 89 *
91 * @param desc The image frame descriptor 90 * @param gif Pointer to the library type that manages the gif decode
91 * @param size Size of the image that we will decode.
92 * Will be set by this function if the return value is tru e.
93 * @param frameRect Contains the dimenions and offset of the first image fr ame.
94 * Will be set by this function if the return value is tru e.
95 *
96 * @return true on success, false otherwise
92 */ 97 */
93 bool setFrameDimensions(const GifImageDesc& desc); 98 static bool GetDimensions(GifFileType* gif, SkISize* size, SkIRect* frameRe ct);
94 99
95 /* 100 /*
96 * Initializes the color table that we will use for decoding. 101 * Initializes the color table that we will use for decoding.
97 * 102 *
98 * @param dstInfo Contains the requested dst color type. 103 * @param dstInfo Contains the requested dst color type.
99 * @param inputColorPtr Copies the encoded color table to the client's 104 * @param inputColorPtr Copies the encoded color table to the client's
100 * input color table if the client requests kIndex8. 105 * input color table if the client requests kIndex8.
101 * @param inputColorCount If the client requests kIndex8, sets 106 * @param inputColorCount If the client requests kIndex8, sets
102 * inputColorCount to 256. Since gifs always 107 * inputColorCount to 256. Since gifs always
103 * contain 8-bit indices, we need a 256 entry color 108 * contain 8-bit indices, we need a 256 entry color
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 * Creates an instance of the decoder 162 * Creates an instance of the decoder
158 * Called only by NewFromStream 163 * Called only by NewFromStream
159 * 164 *
160 * @param srcInfo contains the source width and height 165 * @param srcInfo contains the source width and height
161 * @param stream the stream of image data 166 * @param stream the stream of image data
162 * @param gif pointer to library type that manages gif decode 167 * @param gif pointer to library type that manages gif decode
163 * takes ownership 168 * takes ownership
164 * @param transIndex The transparent index. An invalid value 169 * @param transIndex The transparent index. An invalid value
165 * indicates that there is no transparent index. 170 * indicates that there is no transparent index.
166 */ 171 */
167 SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType* gif, u int32_t transIndex); 172 SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType* gif, u int32_t transIndex,
173 const SkIRect& frameRect, bool frameIsSubset);
168 174
169 SkAutoTCallVProc<GifFileType, CloseGif> fGif; // owned 175 SkAutoTCallVProc<GifFileType, CloseGif> fGif; // owned
170 SkAutoTDeleteArray<uint8_t> fSrcBuffer; 176 SkAutoTDeleteArray<uint8_t> fSrcBuffer;
171 SkIRect fFrameDims; 177 const SkIRect fFrameRect;
172 const uint32_t fTransIndex; 178 const uint32_t fTransIndex;
173 uint32_t fFillIndex; 179 uint32_t fFillIndex;
174 bool fFrameIsSubset; 180 const bool fFrameIsSubset;
175 SkAutoTDelete<SkSwizzler> fSwizzler; 181 SkAutoTDelete<SkSwizzler> fSwizzler;
176 SkAutoTUnref<SkColorTable> fColorTable; 182 SkAutoTUnref<SkColorTable> fColorTable;
177 183
178 typedef SkCodec INHERITED; 184 typedef SkCodec INHERITED;
179 }; 185 };
OLDNEW
« no previous file with comments | « no previous file | src/codec/SkCodec_libgif.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698