OLD | NEW |
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 #include "SampleCode.h" | 7 #include "SampleCode.h" |
8 #include "SkView.h" | 8 #include "SkView.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 virtual void onDraw(SkCanvas* canvas) { | 215 virtual void onDraw(SkCanvas* canvas) { |
216 this->drawBG(canvas); | 216 this->drawBG(canvas); |
217 | 217 |
218 SkScalar x = SkIntToScalar(20); | 218 SkScalar x = SkIntToScalar(20); |
219 SkScalar y = SkIntToScalar(300); | 219 SkScalar y = SkIntToScalar(300); |
220 SkPaint paint; | 220 SkPaint paint; |
221 | 221 |
222 paint.setAntiAlias(true); | 222 paint.setAntiAlias(true); |
223 paint.setTextSize(SkIntToScalar(240)); | 223 paint.setTextSize(SkIntToScalar(240)); |
224 paint.setTypeface(SkTypeface::MakeFromName("sans-serif", SkTypeface::kBo
ld)); | 224 paint.setTypeface(SkTypeface::MakeFromName("sans-serif", |
| 225 SkFontStyle::FromOldStyle(SkT
ypeface::kBold))); |
225 | 226 |
226 SkString str("9"); | 227 SkString str("9"); |
227 | 228 |
228 paint.setTypeface(fFace); | 229 paint.setTypeface(fFace); |
229 | 230 |
230 apply_shader(&paint, SkScalarToFloat(fInterp)); | 231 apply_shader(&paint, SkScalarToFloat(fInterp)); |
231 canvas->drawText(str.c_str(), str.size(), x, y, paint); | 232 canvas->drawText(str.c_str(), str.size(), x, y, paint); |
232 | 233 |
233 // drawdots(canvas, paint); | 234 // drawdots(canvas, paint); |
234 | 235 |
(...skipping 11 matching lines...) Expand all Loading... |
246 } | 247 } |
247 | 248 |
248 private: | 249 private: |
249 typedef SkView INHERITED; | 250 typedef SkView INHERITED; |
250 }; | 251 }; |
251 | 252 |
252 ////////////////////////////////////////////////////////////////////////////// | 253 ////////////////////////////////////////////////////////////////////////////// |
253 | 254 |
254 static SkView* MyFactory() { return new ClockFaceView; } | 255 static SkView* MyFactory() { return new ClockFaceView; } |
255 static SkViewRegister reg(MyFactory); | 256 static SkViewRegister reg(MyFactory); |
OLD | NEW |