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_libgif.h" | 8 #include "SkCodec_libgif.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 return codec; | 230 return codec; |
231 } | 231 } |
232 return nullptr; | 232 return nullptr; |
233 } | 233 } |
234 | 234 |
235 SkGifCodec::SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType
* gif, | 235 SkGifCodec::SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType
* gif, |
236 uint32_t transIndex, const SkIRect& frameRect, bool frameIsSubset) | 236 uint32_t transIndex, const SkIRect& frameRect, bool frameIsSubset) |
237 : INHERITED(srcInfo, stream) | 237 : INHERITED(srcInfo, stream) |
238 , fGif(gif) | 238 , fGif(gif) |
239 , fSrcBuffer(new uint8_t[this->getInfo().width()]) | 239 , fSrcBuffer(new uint8_t[this->getInfo().width()]) |
| 240 , fFrameRect(frameRect) |
240 // If it is valid, fTransIndex will be used to set fFillIndex. We don't kno
w if | 241 // If it is valid, fTransIndex will be used to set fFillIndex. We don't kno
w if |
241 // fTransIndex is valid until we process the color table, since fTransIndex
may | 242 // fTransIndex is valid until we process the color table, since fTransIndex
may |
242 // be greater than the size of the color table. | 243 // be greater than the size of the color table. |
243 , fTransIndex(transIndex) | 244 , fTransIndex(transIndex) |
244 // Default fFillIndex is 0. We will overwrite this if fTransIndex is valid,
or if | 245 // Default fFillIndex is 0. We will overwrite this if fTransIndex is valid,
or if |
245 // there is a valid background color. | 246 // there is a valid background color. |
246 , fFillIndex(0) | 247 , fFillIndex(0) |
247 , fFrameRect(frameRect) | |
248 , fFrameIsSubset(frameIsSubset) | 248 , fFrameIsSubset(frameIsSubset) |
| 249 , fSwizzler(NULL) |
249 , fColorTable(NULL) | 250 , fColorTable(NULL) |
250 , fSwizzler(NULL) | |
251 {} | 251 {} |
252 | 252 |
253 bool SkGifCodec::onRewind() { | 253 bool SkGifCodec::onRewind() { |
254 GifFileType* gifOut = nullptr; | 254 GifFileType* gifOut = nullptr; |
255 if (!ReadHeader(this->stream(), nullptr, &gifOut)) { | 255 if (!ReadHeader(this->stream(), nullptr, &gifOut)) { |
256 return false; | 256 return false; |
257 } | 257 } |
258 | 258 |
259 SkASSERT(nullptr != gifOut); | 259 SkASSERT(nullptr != gifOut); |
260 fGif.reset(gifOut); | 260 fGif.reset(gifOut); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 587 |
588 int SkGifCodec::onOutputScanline(int inputScanline) const { | 588 int SkGifCodec::onOutputScanline(int inputScanline) const { |
589 if (fGif->Image.Interlace) { | 589 if (fGif->Image.Interlace) { |
590 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { | 590 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { |
591 return inputScanline; | 591 return inputScanline; |
592 } | 592 } |
593 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()); | 593 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()); |
594 } | 594 } |
595 return inputScanline; | 595 return inputScanline; |
596 } | 596 } |
OLD | NEW |