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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 SkScalar y = SkIntToScalar(0); | 121 SkScalar y = SkIntToScalar(0); |
122 for (int i = 12; i <= 26; i++) { | 122 for (int i = 12; i <= 26; i++) { |
123 paint.setTextSize(SkIntToScalar(i*fSizeScale)); | 123 paint.setTextSize(SkIntToScalar(i*fSizeScale)); |
124 y += paint.getFontSpacing(); | 124 y += paint.getFontSpacing(); |
125 DrawTheText(canvas, text, length, SkIntToScalar(110), y, paint); | 125 DrawTheText(canvas, text, length, SkIntToScalar(110), y, paint); |
126 } | 126 } |
127 canvas->restore(); | 127 canvas->restore(); |
128 | 128 |
129 paint.setTextSize(16); | 129 paint.setTextSize(16); |
130 canvas->drawText(outString.c_str(), outString.size(), 512.f, 540.f, pain
t); | 130 // canvas->drawText(outString.c_str(), outString.size(), 512.f, 540.f, pa
int); |
131 canvas->drawText(modeString.c_str(), modeString.size(), 768.f, 540.f, pa
int); | 131 canvas->drawText(modeString.c_str(), modeString.size(), 768.f, 540.f, pa
int); |
132 } | 132 } |
133 | 133 |
134 bool onAnimate(const SkAnimTimer& timer) override { | 134 bool onAnimate(const SkAnimTimer& timer) override { |
135 // We add noise to the scale and rotation animations to | 135 // We add noise to the scale and rotation animations to |
136 // keep the font atlas from falling into a steady state | 136 // keep the font atlas from falling into a steady state |
137 fRotation += (1.0f + gRand.nextRangeF(-0.1f, 0.1f)); | 137 fRotation += (1.0f + gRand.nextRangeF(-0.1f, 0.1f)); |
138 fScale += (fScaleInc + gRand.nextRangeF(-0.025f, 0.025f)); | 138 fScale += (fScaleInc + gRand.nextRangeF(-0.025f, 0.025f)); |
139 if (fScale >= 2.0f) { | 139 if (fScale >= 2.0f) { |
140 fScaleInc = -0.1f; | 140 fScaleInc = -0.1f; |
(...skipping 14 matching lines...) Expand all Loading... |
155 int fCurrentTime; | 155 int fCurrentTime; |
156 | 156 |
157 | 157 |
158 typedef SampleView INHERITED; | 158 typedef SampleView INHERITED; |
159 }; | 159 }; |
160 | 160 |
161 ////////////////////////////////////////////////////////////////////////////// | 161 ////////////////////////////////////////////////////////////////////////////// |
162 | 162 |
163 static SkView* MyFactory() { return new AnimatedTextView; } | 163 static SkView* MyFactory() { return new AnimatedTextView; } |
164 static SkViewRegister reg(MyFactory); | 164 static SkViewRegister reg(MyFactory); |
OLD | NEW |