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 | 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) { | 141 static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) { |
142 for (size_t i = 0; i < n; i++) | 142 for (size_t i = 0; i < n; i++) |
143 pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); | 143 pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); |
144 } | 144 } |
145 | 145 |
146 void onDrawContent(SkCanvas* canvas) override { | 146 void onDrawContent(SkCanvas* canvas) override { |
147 SkAutoCanvasRestore restore(canvas, false); | 147 SkAutoCanvasRestore restore(canvas, false); |
148 { | 148 { |
149 SkRect r; | 149 SkRect r; |
150 r.set(0, 0, SkIntToScalar(1000), SkIntToScalar(20)); | 150 r.set(0, 0, SkIntToScalar(1000), SkIntToScalar(20)); |
151 // canvas->saveLayer(&r, NULL, SkCanvas::kHasAlphaLayer_SaveFlag); | 151 // canvas->saveLayer(&r, nullptr, SkCanvas::kHasAlphaLayer_SaveFlag); |
152 } | 152 } |
153 | 153 |
154 SkPaint paint; | 154 SkPaint paint; |
155 // const uint16_t glyphs[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,1
7,18,19 }; | 155 // const uint16_t glyphs[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,1
7,18,19 }; |
156 int index = fHints % SK_ARRAY_COUNT(gHints); | 156 int index = fHints % SK_ARRAY_COUNT(gHints); |
157 index = 1; | 157 index = 1; |
158 // const char* style = gHints[index].fName; | 158 // const char* style = gHints[index].fName; |
159 | 159 |
160 // canvas->translate(0, SkIntToScalar(50)); | 160 // canvas->translate(0, SkIntToScalar(50)); |
161 | 161 |
(...skipping 19 matching lines...) Expand all Loading... |
181 } | 181 } |
182 } | 182 } |
183 if (gHints[index].fFlushCache) { | 183 if (gHints[index].fFlushCache) { |
184 // SkGraphics::SetFontCacheUsed(0); | 184 // SkGraphics::SetFontCacheUsed(0); |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, | 188 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, |
189 unsigned modi) override { | 189 unsigned modi) override { |
190 fClickX = x; | 190 fClickX = x; |
191 this->inval(NULL); | 191 this->inval(nullptr); |
192 return this->INHERITED::onFindClickHandler(x, y, modi); | 192 return this->INHERITED::onFindClickHandler(x, y, modi); |
193 } | 193 } |
194 | 194 |
195 bool onClick(Click* click) override { | 195 bool onClick(Click* click) override { |
196 return this->INHERITED::onClick(click); | 196 return this->INHERITED::onClick(click); |
197 } | 197 } |
198 | 198 |
199 private: | 199 private: |
200 int fHints; | 200 int fHints; |
201 SkScalar fClickX; | 201 SkScalar fClickX; |
202 | 202 |
203 typedef SampleView INHERITED; | 203 typedef SampleView INHERITED; |
204 }; | 204 }; |
205 | 205 |
206 ////////////////////////////////////////////////////////////////////////////// | 206 ////////////////////////////////////////////////////////////////////////////// |
207 | 207 |
208 static SkView* MyFactory() { return new TextSpeedView; } | 208 static SkView* MyFactory() { return new TextSpeedView; } |
209 static SkViewRegister reg(MyFactory); | 209 static SkViewRegister reg(MyFactory); |
OLD | NEW |