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

Side by Side Diff: gm/animatedGif.cpp

Issue 2447793002: Clear background to white in animatedGif GM (Closed)
Patch Set: 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 | « no previous file | no next file » | 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 2016 Google Inc. 2 * Copyright 2016 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 "gm.h" 8 #include "gm.h"
9 #include "SkAnimTimer.h" 9 #include "SkAnimTimer.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Wide enough to display all the frames. 91 // Wide enough to display all the frames.
92 dim.fWidth *= fTotalFrames; 92 dim.fWidth *= fTotalFrames;
93 // Tall enough to show the row of frames plus an animating version. 93 // Tall enough to show the row of frames plus an animating version.
94 dim.fHeight *= 2; 94 dim.fHeight *= 2;
95 return dim; 95 return dim;
96 } 96 }
97 return SkISize::Make(640, 480); 97 return SkISize::Make(640, 480);
98 } 98 }
99 99
100 void onDrawBackground(SkCanvas* canvas) override { 100 void onDrawBackground(SkCanvas* canvas) override {
101 canvas->clear(SK_ColorWHITE);
101 if (this->initCodec()) { 102 if (this->initCodec()) {
102 SkAutoCanvasRestore acr(canvas, true); 103 SkAutoCanvasRestore acr(canvas, true);
103 for (size_t frameIndex = 0; frameIndex < fTotalFrames; frameIndex++) { 104 for (size_t frameIndex = 0; frameIndex < fTotalFrames; frameIndex++) {
104 this->drawFrame(canvas, frameIndex); 105 this->drawFrame(canvas, frameIndex);
105 canvas->translate(fCodec->getInfo().width(), 0); 106 canvas->translate(fCodec->getInfo().width(), 0);
106 } 107 }
107 } 108 }
108 } 109 }
109 110
110 bool initCodec() { 111 bool initCodec() {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // in order to draw correctly. 177 // in order to draw correctly.
177 fNextUpdate += fFrameInfos[fFrame].fDuration; 178 fNextUpdate += fFrameInfos[fFrame].fDuration;
178 } 179 }
179 180
180 return true; 181 return true;
181 } 182 }
182 }; 183 };
183 184
184 DEF_GM(return new AnimatedGifGM); 185 DEF_GM(return new AnimatedGifGM);
185 186
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698