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

Side by Side Diff: samplecode/SampleAnimatedText.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « samplecode/SampleAll.cpp ('k') | samplecode/SampleAnimator.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 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 DrawTheText(canvas, text, length, SkIntToScalar(110), y, paint); 126 DrawTheText(canvas, text, length, SkIntToScalar(110), y, paint);
127 } 127 }
128 canvas->restore(); 128 canvas->restore();
129 129
130 paint.setTextSize(16); 130 paint.setTextSize(16);
131 // canvas->drawText(outString.c_str(), outString.size(), 512.f, 540.f, pa int); 131 // canvas->drawText(outString.c_str(), outString.size(), 512.f, 540.f, pa int);
132 canvas->drawText(modeString.c_str(), modeString.size(), 768.f, 540.f, pa int); 132 canvas->drawText(modeString.c_str(), modeString.size(), 768.f, 540.f, pa int);
133 } 133 }
134 134
135 bool onAnimate(const SkAnimTimer& timer) override { 135 bool onAnimate(const SkAnimTimer& timer) override {
136 // We add noise to the scale and rotation animations to 136 // We add noise to the scale and rotation animations to
137 // keep the font atlas from falling into a steady state 137 // keep the font atlas from falling into a steady state
138 fRotation += (1.0f + gRand.nextRangeF(-0.1f, 0.1f)); 138 fRotation += (1.0f + gRand.nextRangeF(-0.1f, 0.1f));
139 fScale += (fScaleInc + gRand.nextRangeF(-0.025f, 0.025f)); 139 fScale += (fScaleInc + gRand.nextRangeF(-0.025f, 0.025f));
140 if (fScale >= 2.0f) { 140 if (fScale >= 2.0f) {
141 fScaleInc = -0.1f; 141 fScaleInc = -0.1f;
142 } else if (fScale <= 1.0f) { 142 } else if (fScale <= 1.0f) {
143 fScaleInc = 0.1f; 143 fScaleInc = 0.1f;
144 } 144 }
145 return true; 145 return true;
146 } 146 }
147 147
148 private: 148 private:
149 float fScale; 149 float fScale;
150 float fScaleInc; 150 float fScaleInc;
151 float fRotation; 151 float fRotation;
152 int fSizeScale; 152 int fSizeScale;
153 153
154 WallTimer fTimer; 154 WallTimer fTimer;
155 float fTimes[32]; 155 float fTimes[32];
156 int fCurrentTime; 156 int fCurrentTime;
157 157
158 158
159 typedef SampleView INHERITED; 159 typedef SampleView INHERITED;
160 }; 160 };
161 161
162 ////////////////////////////////////////////////////////////////////////////// 162 //////////////////////////////////////////////////////////////////////////////
163 163
164 static SkView* MyFactory() { return new AnimatedTextView; } 164 static SkView* MyFactory() { return new AnimatedTextView; }
165 static SkViewRegister reg(MyFactory); 165 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | samplecode/SampleAnimator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698