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

Side by Side Diff: samplecode/SampleAnimatedText.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. Created 4 years, 7 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/SampleApp.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 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 fSizeScale = 2; 66 fSizeScale = 2;
67 } 67 }
68 return true; 68 return true;
69 } 69 }
70 } 70 }
71 return this->INHERITED::onQuery(evt); 71 return this->INHERITED::onQuery(evt);
72 } 72 }
73 73
74 void onDrawContent(SkCanvas* canvas) override { 74 void onDrawContent(SkCanvas* canvas) override {
75 SkPaint paint; 75 SkPaint paint;
76 SkSafeUnref(paint.setTypeface(SkTypeface::CreateFromFile("/skimages/samp lefont.ttf"))); 76 paint.setTypeface(SkTypeface::MakeFromFile("/skimages/samplefont.ttf"));
77 paint.setAntiAlias(true); 77 paint.setAntiAlias(true);
78 paint.setFilterQuality(kMedium_SkFilterQuality); 78 paint.setFilterQuality(kMedium_SkFilterQuality);
79 79
80 SkString outString("fps: "); 80 SkString outString("fps: ");
81 fTimer.end(); 81 fTimer.end();
82 82
83 // TODO: generalize this timing code in utils 83 // TODO: generalize this timing code in utils
84 fTimes[fCurrentTime] = (float)(fTimer.fWall); 84 fTimes[fCurrentTime] = (float)(fTimer.fWall);
85 fCurrentTime = (fCurrentTime + 1) & 0x1f; 85 fCurrentTime = (fCurrentTime + 1) & 0x1f;
86 86
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/SampleApp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698