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

Side by Side Diff: src/codec/SkGifCodec.cpp

Issue 2447863002: Report repetition count in SkCodec (Closed)
Patch Set: Make colorTables.gif use a different loop count Created 4 years, 1 month 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 | « src/codec/SkGifCodec.h ('k') | tests/CodecAnimTest.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 /* 8 /*
9 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 9 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
10 * 10 *
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const size_t size = fReader->imagesCount(); 132 const size_t size = fReader->imagesCount();
133 std::vector<FrameInfo> result(size); 133 std::vector<FrameInfo> result(size);
134 for (size_t i = 0; i < size; i++) { 134 for (size_t i = 0; i < size; i++) {
135 const SkGIFFrameContext* frameContext = fReader->frameContext(i); 135 const SkGIFFrameContext* frameContext = fReader->frameContext(i);
136 result[i].fDuration = frameContext->delayTime(); 136 result[i].fDuration = frameContext->delayTime();
137 result[i].fRequiredFrame = frameContext->getRequiredFrame(); 137 result[i].fRequiredFrame = frameContext->getRequiredFrame();
138 } 138 }
139 return result; 139 return result;
140 } 140 }
141 141
142 int SkGifCodec::onGetRepetitionCount() {
143 fReader->parse(SkGifImageReader::SkGIFLoopCountQuery);
144 return fReader->loopCount();
145 }
146
142 void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, size_t frameIn dex) { 147 void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, size_t frameIn dex) {
143 fCurrColorTable = fReader->getColorTable(dstInfo.colorType(), frameIndex); 148 fCurrColorTable = fReader->getColorTable(dstInfo.colorType(), frameIndex);
144 fCurrColorTableIsReal = fCurrColorTable; 149 fCurrColorTableIsReal = fCurrColorTable;
145 if (!fCurrColorTable) { 150 if (!fCurrColorTable) {
146 // This is possible for an empty frame. Create a dummy with one value (t ransparent). 151 // This is possible for an empty frame. Create a dummy with one value (t ransparent).
147 SkPMColor color = SK_ColorTRANSPARENT; 152 SkPMColor color = SK_ColorTRANSPARENT;
148 fCurrColorTable.reset(new SkColorTable(&color, 1)); 153 fCurrColorTable.reset(new SkColorTable(&color, 1));
149 } 154 }
150 } 155 }
151 156
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 void* copiedLine = SkTAddOffset<void>(dstLine, fSwizzler->swizzleOffsetB ytes()); 589 void* copiedLine = SkTAddOffset<void>(dstLine, fSwizzler->swizzleOffsetB ytes());
585 void* dst = copiedLine; 590 void* dst = copiedLine;
586 for (unsigned i = 1; i < repeatCount; i++) { 591 for (unsigned i = 1; i < repeatCount; i++) {
587 dst = SkTAddOffset<void>(dst, fDstRowBytes); 592 dst = SkTAddOffset<void>(dst, fDstRowBytes);
588 memcpy(dst, copiedLine, bytesToCopy); 593 memcpy(dst, copiedLine, bytesToCopy);
589 } 594 }
590 } 595 }
591 596
592 return true; 597 return true;
593 } 598 }
OLDNEW
« no previous file with comments | « src/codec/SkGifCodec.h ('k') | tests/CodecAnimTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698