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

Side by Side Diff: samplecode/ClockFaceView.cpp

Issue 1818043002: SkTypeface::MakeFromName to take SkFontStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Android fix + nit fix Created 4 years, 6 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 | « include/core/SkTypeface.h ('k') | samplecode/SampleAll.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 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
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
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);
OLDNEW
« no previous file with comments | « include/core/SkTypeface.h ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698