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 /* | 8 /* |
9 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 9 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
10 * | 10 * |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 , fCurrColorTableIsReal(false) | 119 , fCurrColorTableIsReal(false) |
120 , fFilledBackground(false) | 120 , fFilledBackground(false) |
121 , fFirstCallToIncrementalDecode(false) | 121 , fFirstCallToIncrementalDecode(false) |
122 , fDst(nullptr) | 122 , fDst(nullptr) |
123 , fDstRowBytes(0) | 123 , fDstRowBytes(0) |
124 , fRowsDecoded(0) | 124 , fRowsDecoded(0) |
125 { | 125 { |
126 reader->setClient(this); | 126 reader->setClient(this); |
127 } | 127 } |
128 | 128 |
129 std::vector<SkCodec::FrameInfo> SkGifCodec::onGetFrameInfo() { | 129 std::vector<SkCodec::FrameInfo> SkGifCodec::onGetFrameInfo(int* repetitionCount)
{ |
130 fReader->parse(SkGifImageReader::GIFFrameCountQuery); | 130 fReader->parse(SkGifImageReader::GIFFrameCountQuery); |
131 const size_t size = fReader->imagesCount(); | 131 const size_t size = fReader->imagesCount(); |
132 std::vector<FrameInfo> result(size); | 132 std::vector<FrameInfo> result(size); |
133 for (size_t i = 0; i < size; i++) { | 133 for (size_t i = 0; i < size; i++) { |
134 const GIFFrameContext* frameContext = fReader->frameContext(i); | 134 const GIFFrameContext* frameContext = fReader->frameContext(i); |
135 result[i].fDuration = frameContext->delayTime(); | 135 result[i].fDuration = frameContext->delayTime(); |
136 result[i].fRequiredFrame = frameContext->getRequiredFrame(); | 136 result[i].fRequiredFrame = frameContext->getRequiredFrame(); |
137 } | 137 } |
| 138 if (repetitionCount) { |
| 139 *repetitionCount = fReader->loopCount(); |
| 140 } |
138 return result; | 141 return result; |
139 } | 142 } |
140 | 143 |
141 void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, size_t frameIn
dex, | 144 void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, size_t frameIn
dex, |
142 SkPMColor* inputColorPtr, int* inputColorCount) { | 145 SkPMColor* inputColorPtr, int* inputColorCount) { |
143 fCurrColorTable = fReader->getColorTable(dstInfo.colorType(), frameIndex); | 146 fCurrColorTable = fReader->getColorTable(dstInfo.colorType(), frameIndex); |
144 fCurrColorTableIsReal = fCurrColorTable; | 147 fCurrColorTableIsReal = fCurrColorTable; |
145 if (!fCurrColorTable) { | 148 if (!fCurrColorTable) { |
146 // This is possible for an empty frame. Create a dummy with one value (t
ransparent). | 149 // This is possible for an empty frame. Create a dummy with one value (t
ransparent). |
147 SkPMColor color = SK_ColorTRANSPARENT; | 150 SkPMColor color = SK_ColorTRANSPARENT; |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 void* copiedLine = SkTAddOffset<void>(dstLine, fSwizzler->swizzleOffsetB
ytes()); | 557 void* copiedLine = SkTAddOffset<void>(dstLine, fSwizzler->swizzleOffsetB
ytes()); |
555 void* dst = copiedLine; | 558 void* dst = copiedLine; |
556 for (unsigned i = 1; i < repeatCount; i++) { | 559 for (unsigned i = 1; i < repeatCount; i++) { |
557 dst = SkTAddOffset<void>(dst, fDstRowBytes); | 560 dst = SkTAddOffset<void>(dst, fDstRowBytes); |
558 memcpy(dst, copiedLine, bytesToCopy); | 561 memcpy(dst, copiedLine, bytesToCopy); |
559 } | 562 } |
560 } | 563 } |
561 | 564 |
562 return true; | 565 return true; |
563 } | 566 } |
OLD | NEW |