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 "gm.h" | 8 #include "gm.h" |
9 #include "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 paint.setStrokeWidth(0.055f); | 259 paint.setStrokeWidth(0.055f); |
260 | 260 |
261 canvas->scale(1000, 1000); | 261 canvas->scale(1000, 1000); |
262 canvas->drawCircle(0, 2, 1.97f, paint); | 262 canvas->drawCircle(0, 2, 1.97f, paint); |
263 } | 263 } |
264 | 264 |
265 private: | 265 private: |
266 typedef skiagm::GM INHERITED; | 266 typedef skiagm::GM INHERITED; |
267 }; | 267 }; |
268 | 268 |
269 // Test stroking for curves that produce degenerate tangents when t is 0 or 1 (s
ee bug 4191) | |
270 class Strokes5GM : public skiagm::GM { | |
271 public: | |
272 Strokes5GM() {} | |
273 | |
274 protected: | |
275 | |
276 SkString onShortName() override { | |
277 return SkString("zero_control_stroke"); | |
278 } | |
279 | |
280 SkISize onISize() override { | |
281 return SkISize::Make(W, H*2); | |
282 } | |
283 | |
284 void onDraw(SkCanvas* canvas) override { | |
285 SkPaint p; | |
286 p.setColor(SK_ColorRED); | |
287 p.setAntiAlias(true); | |
288 p.setStyle(SkPaint::kStroke_Style); | |
289 p.setStrokeWidth(40); | |
290 p.setStrokeCap(SkPaint::kButt_Cap); | |
291 | |
292 SkPath path; | |
293 path.moveTo(157.474f,111.753f); | |
294 path.cubicTo(128.5f,111.5f,35.5f,29.5f,35.5f,29.5f); | |
295 canvas->drawPath(path, p); | |
296 path.reset(); | |
297 path.moveTo(250, 50); | |
298 path.quadTo(280, 80, 280, 80); | |
299 canvas->drawPath(path, p); | |
300 path.reset(); | |
301 path.moveTo(150, 50); | |
302 path.conicTo(180, 80, 180, 80, 0.707f); | |
303 canvas->drawPath(path, p); | |
304 | |
305 path.reset(); | |
306 path.moveTo(157.474f,311.753f); | |
307 path.cubicTo(157.474f,311.753f,85.5f,229.5f,35.5f,229.5f); | |
308 canvas->drawPath(path, p); | |
309 path.reset(); | |
310 path.moveTo(280, 250); | |
311 path.quadTo(280, 250, 310, 280); | |
312 canvas->drawPath(path, p); | |
313 path.reset(); | |
314 path.moveTo(180, 250); | |
315 path.conicTo(180, 250, 210, 280, 0.707f); | |
316 canvas->drawPath(path, p); | |
317 } | |
318 | |
319 private: | |
320 typedef skiagm::GM INHERITED; | |
321 }; | |
322 | |
323 | 269 |
324 ////////////////////////////////////////////////////////////////////////////// | 270 ////////////////////////////////////////////////////////////////////////////// |
325 | 271 |
326 static skiagm::GM* F0(void*) { return new StrokesGM; } | 272 static skiagm::GM* F0(void*) { return new StrokesGM; } |
327 static skiagm::GM* F1(void*) { return new Strokes2GM; } | 273 static skiagm::GM* F1(void*) { return new Strokes2GM; } |
328 static skiagm::GM* F2(void*) { return new Strokes3GM; } | 274 static skiagm::GM* F2(void*) { return new Strokes3GM; } |
329 static skiagm::GM* F3(void*) { return new Strokes4GM; } | 275 static skiagm::GM* F3(void*) { return new Strokes4GM; } |
330 static skiagm::GM* F4(void*) { return new Strokes5GM; } | |
331 | 276 |
332 static skiagm::GMRegistry R0(F0); | 277 static skiagm::GMRegistry R0(F0); |
333 static skiagm::GMRegistry R1(F1); | 278 static skiagm::GMRegistry R1(F1); |
334 static skiagm::GMRegistry R2(F2); | 279 static skiagm::GMRegistry R2(F2); |
335 static skiagm::GMRegistry R3(F3); | 280 static skiagm::GMRegistry R3(F3); |
336 static skiagm::GMRegistry R4(F4); | |
OLD | NEW |