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

Side by Side Diff: gm/gm.cpp

Issue 888283002: allow GMs to animate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: switch all existing animations to use animatePulse Created 5 years, 10 months 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 | « gm/gm.h ('k') | samplecode/GMSampleView.h » ('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 2011 Google Inc. 2 * Copyright 2011 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 9
10 using namespace skiagm; 10 using namespace skiagm;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (fShortName.size() == 0) { 44 if (fShortName.size() == 0) {
45 fShortName = this->onShortName(); 45 fShortName = this->onShortName();
46 } 46 }
47 return fShortName.c_str(); 47 return fShortName.c_str();
48 } 48 }
49 49
50 void GM::setBGColor(SkColor color) { 50 void GM::setBGColor(SkColor color) {
51 fBGColor = color; 51 fBGColor = color;
52 } 52 }
53 53
54 bool GM::animatePulse(SkMSec curr, SkMSec prev) {
55 return this->onAnimatePulse(curr, prev);
56 }
57
58 //////////////////////////////////////////////////////////////////////////////// /////////////
59
54 void GM::onDrawBackground(SkCanvas* canvas) { 60 void GM::onDrawBackground(SkCanvas* canvas) {
55 canvas->drawColor(fBGColor, SkXfermode::kSrc_Mode); 61 canvas->drawColor(fBGColor, SkXfermode::kSrc_Mode);
56 } 62 }
57 63
58 void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) { 64 void GM::drawSizeBounds(SkCanvas* canvas, SkColor color) {
59 SkISize size = this->getISize(); 65 SkISize size = this->getISize();
60 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()), 66 SkRect r = SkRect::MakeWH(SkIntToScalar(size.width()),
61 SkIntToScalar(size.height())); 67 SkIntToScalar(size.height()));
62 SkPaint paint; 68 SkPaint paint;
63 paint.setColor(color); 69 paint.setColor(color);
64 canvas->drawRect(r, paint); 70 canvas->drawRect(r, paint);
65 } 71 }
66 72
67 // need to explicitly declare this, or we get some weird infinite loop llist 73 // need to explicitly declare this, or we get some weird infinite loop llist
68 template GMRegistry* GMRegistry::gHead; 74 template GMRegistry* GMRegistry::gHead;
69 75
70 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) { 76 void skiagm::SimpleGM::onDraw(SkCanvas* canvas) {
71 fDrawProc(canvas); 77 fDrawProc(canvas);
72 } 78 }
73 79
74 SkISize skiagm::SimpleGM::onISize() { 80 SkISize skiagm::SimpleGM::onISize() {
75 return fSize; 81 return fSize;
76 } 82 }
77 83
78 SkString skiagm::SimpleGM::onShortName() { 84 SkString skiagm::SimpleGM::onShortName() {
79 return fName; 85 return fName;
80 } 86 }
87
OLDNEW
« no previous file with comments | « gm/gm.h ('k') | samplecode/GMSampleView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698