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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 , fCurrColorTableIsReal(false) | 120 , fCurrColorTableIsReal(false) |
121 , fFilledBackground(false) | 121 , fFilledBackground(false) |
122 , fFirstCallToIncrementalDecode(false) | 122 , fFirstCallToIncrementalDecode(false) |
123 , fDst(nullptr) | 123 , fDst(nullptr) |
124 , fDstRowBytes(0) | 124 , fDstRowBytes(0) |
125 , fRowsDecoded(0) | 125 , fRowsDecoded(0) |
126 { | 126 { |
127 reader->setClient(this); | 127 reader->setClient(this); |
128 } | 128 } |
129 | 129 |
130 std::vector<SkCodec::FrameInfo> SkGifCodec::onGetFrameInfo() { | 130 bool SkGifCodec::onGetFrameInfo(std::vector<FrameInfo>* frameInfos, int* repetit
ionCount) { |
131 fReader->parse(SkGifImageReader::SkGIFFrameCountQuery); | 131 fReader->parse(SkGifImageReader::SkGIFFrameCountQuery); |
132 const size_t size = fReader->imagesCount(); | 132 const size_t size = fReader->imagesCount(); |
133 std::vector<FrameInfo> result(size); | 133 if (frameInfos) { |
134 for (size_t i = 0; i < size; i++) { | 134 frameInfos->resize(size); |
135 const SkGIFFrameContext* frameContext = fReader->frameContext(i); | 135 for (size_t i = 0; i < size; i++) { |
136 result[i].fDuration = frameContext->delayTime(); | 136 const SkGIFFrameContext* frameContext = fReader->frameContext(i); |
137 result[i].fRequiredFrame = frameContext->getRequiredFrame(); | 137 auto& info = frameInfos->operator[](i); |
| 138 info.fDuration = frameContext->delayTime(); |
| 139 info.fRequiredFrame = frameContext->getRequiredFrame(); |
| 140 } |
138 } | 141 } |
139 return result; | 142 if (repetitionCount) { |
| 143 *repetitionCount = fReader->loopCount(); |
| 144 } |
| 145 return true; |
140 } | 146 } |
141 | 147 |
142 void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, size_t frameIn
dex, | 148 void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, size_t frameIn
dex, |
143 SkPMColor* inputColorPtr, int* inputColorCount) { | 149 SkPMColor* inputColorPtr, int* inputColorCount) { |
144 fCurrColorTable = fReader->getColorTable(dstInfo.colorType(), frameIndex); | 150 fCurrColorTable = fReader->getColorTable(dstInfo.colorType(), frameIndex); |
145 fCurrColorTableIsReal = fCurrColorTable; | 151 fCurrColorTableIsReal = fCurrColorTable; |
146 if (!fCurrColorTable) { | 152 if (!fCurrColorTable) { |
147 // This is possible for an empty frame. Create a dummy with all transpar
ent. | 153 // This is possible for an empty frame. Create a dummy with all transpar
ent. |
148 SkPMColor colors[SK_MAX_COLORS]; | 154 SkPMColor colors[SK_MAX_COLORS]; |
149 sk_memset32(colors, SK_ColorTRANSPARENT, SK_MAX_COLORS); | 155 sk_memset32(colors, SK_ColorTRANSPARENT, SK_MAX_COLORS); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 void* copiedLine = SkTAddOffset<void>(dstLine, fSwizzler->swizzleOffsetB
ytes()); | 562 void* copiedLine = SkTAddOffset<void>(dstLine, fSwizzler->swizzleOffsetB
ytes()); |
557 void* dst = copiedLine; | 563 void* dst = copiedLine; |
558 for (unsigned i = 1; i < repeatCount; i++) { | 564 for (unsigned i = 1; i < repeatCount; i++) { |
559 dst = SkTAddOffset<void>(dst, fDstRowBytes); | 565 dst = SkTAddOffset<void>(dst, fDstRowBytes); |
560 memcpy(dst, copiedLine, bytesToCopy); | 566 memcpy(dst, copiedLine, bytesToCopy); |
561 } | 567 } |
562 } | 568 } |
563 | 569 |
564 return true; | 570 return true; |
565 } | 571 } |
OLD | NEW |