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 "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkColorTable.h" | 10 #include "SkColorTable.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // component will always be 0xFF or the entire 32-bit pixel will be set
to zero. | 209 // component will always be 0xFF or the entire 32-bit pixel will be set
to zero. |
210 // We prefer kPremul because we support kPremul, and it is more efficien
t to use | 210 // We prefer kPremul because we support kPremul, and it is more efficien
t to use |
211 // kPremul directly even when kUnpremul is supported. | 211 // kPremul directly even when kUnpremul is supported. |
212 SkAlphaType alphaType = (transIndex < 256) ? kPremul_SkAlphaType : kOpaq
ue_SkAlphaType; | 212 SkAlphaType alphaType = (transIndex < 256) ? kPremul_SkAlphaType : kOpaq
ue_SkAlphaType; |
213 | 213 |
214 // Return the codec | 214 // Return the codec |
215 // kIndex is the most natural color type for gifs, so we set this as | 215 // kIndex is the most natural color type for gifs, so we set this as |
216 // the default. | 216 // the default. |
217 SkImageInfo imageInfo = SkImageInfo::Make(size.width(), size.height(), k
Index_8_SkColorType, | 217 SkImageInfo imageInfo = SkImageInfo::Make(size.width(), size.height(), k
Index_8_SkColorType, |
218 alphaType); | 218 alphaType); |
219 *codecOut = new SkGifCodec(imageInfo, streamDeleter.detach(), gif.detach
(), transIndex, | 219 *codecOut = new SkGifCodec(imageInfo, streamDeleter.release(), gif.relea
se(), transIndex, |
220 frameRect, frameIsSubset); | 220 frameRect, frameIsSubset); |
221 } else { | 221 } else { |
222 SkASSERT(nullptr != gifOut); | 222 SkASSERT(nullptr != gifOut); |
223 streamDeleter.detach(); | 223 streamDeleter.release(); |
224 *gifOut = gif.detach(); | 224 *gifOut = gif.release(); |
225 } | 225 } |
226 return true; | 226 return true; |
227 } | 227 } |
228 | 228 |
229 /* | 229 /* |
230 * Assumes IsGif was called and returned true | 230 * Assumes IsGif was called and returned true |
231 * Creates a gif decoder | 231 * Creates a gif decoder |
232 * Reads enough of the stream to determine the image format | 232 * Reads enough of the stream to determine the image format |
233 */ | 233 */ |
234 SkCodec* SkGifCodec::NewFromStream(SkStream* stream) { | 234 SkCodec* SkGifCodec::NewFromStream(SkStream* stream) { |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 int SkGifCodec::onOutputScanline(int inputScanline) const { | 599 int SkGifCodec::onOutputScanline(int inputScanline) const { |
600 if (fGif->Image.Interlace) { | 600 if (fGif->Image.Interlace) { |
601 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { | 601 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { |
602 return inputScanline; | 602 return inputScanline; |
603 } | 603 } |
604 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()) + | 604 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()) + |
605 fFrameRect.top(); | 605 fFrameRect.top(); |
606 } | 606 } |
607 return inputScanline; | 607 return inputScanline; |
608 } | 608 } |
OLD | NEW |