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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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); |
OLD | NEW |