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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 canvas->drawPath(path, paint); | 236 canvas->drawPath(path, paint); |
237 } | 237 } |
238 | 238 |
239 DEF_SIMPLE_GM(quadcap, canvas, 200, 200) { | 239 DEF_SIMPLE_GM(quadcap, canvas, 200, 200) { |
240 SkPaint p; | 240 SkPaint p; |
241 p.setAntiAlias(true); | 241 p.setAntiAlias(true); |
242 p.setStyle(SkPaint::kStroke_Style); | 242 p.setStyle(SkPaint::kStroke_Style); |
243 p.setStrokeWidth(0); | 243 p.setStrokeWidth(0); |
244 SkPath path; | 244 SkPath path; |
245 SkPoint pts[] = {{105.738571f,13.126318f}, | 245 SkPoint pts[] = {{105.738571f,13.126318f}, |
246 {105.738571f,13.126318f}, | 246 {105.738571f,13.126318f}, |
247 {123.753784f,1.f}}; | 247 {123.753784f,1.f}}; |
248 SkVector tangent = pts[1] - pts[2]; | 248 SkVector tangent = pts[1] - pts[2]; |
249 tangent.normalize(); | 249 tangent.normalize(); |
250 SkPoint pts2[3]; | 250 SkPoint pts2[3]; |
251 memcpy(pts2, pts, sizeof(pts)); | 251 memcpy(pts2, pts, sizeof(pts)); |
252 const SkScalar capOutset = SK_ScalarPI / 8; | 252 const SkScalar capOutset = SK_ScalarPI / 8; |
253 pts2[0].fX += tangent.fX * capOutset; | 253 pts2[0].fX += tangent.fX * capOutset; |
254 pts2[0].fY += tangent.fY * capOutset; | 254 pts2[0].fY += tangent.fY * capOutset; |
255 pts2[1].fX += tangent.fX * capOutset; | 255 pts2[1].fX += tangent.fX * capOutset; |
256 pts2[1].fY += tangent.fY * capOutset; | 256 pts2[1].fY += tangent.fY * capOutset; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 442 } |
443 | 443 |
444 SkISize onISize() override { | 444 SkISize onISize() override { |
445 return SkISize::Make(W, H*2); | 445 return SkISize::Make(W, H*2); |
446 } | 446 } |
447 | 447 |
448 void onDraw(SkCanvas* canvas) override { | 448 void onDraw(SkCanvas* canvas) override { |
449 SkPaint paint; | 449 SkPaint paint; |
450 paint.setStyle(SkPaint::kStroke_Style); | 450 paint.setStyle(SkPaint::kStroke_Style); |
451 paint.setStrokeWidth(0.055f); | 451 paint.setStrokeWidth(0.055f); |
452 | 452 |
453 canvas->scale(1000, 1000); | 453 canvas->scale(1000, 1000); |
454 canvas->drawCircle(0, 2, 1.97f, paint); | 454 canvas->drawCircle(0, 2, 1.97f, paint); |
455 } | 455 } |
456 | 456 |
457 private: | 457 private: |
458 typedef skiagm::GM INHERITED; | 458 typedef skiagm::GM INHERITED; |
459 }; | 459 }; |
460 | 460 |
461 // Test stroking for curves that produce degenerate tangents when t is 0 or 1 (s
ee bug 4191) | 461 // Test stroking for curves that produce degenerate tangents when t is 0 or 1 (s
ee bug 4191) |
462 class Strokes5GM : public skiagm::GM { | 462 class Strokes5GM : public skiagm::GM { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 ////////////////////////////////////////////////////////////////////////////// | 516 ////////////////////////////////////////////////////////////////////////////// |
517 | 517 |
518 DEF_GM( return new StrokesGM; ) | 518 DEF_GM( return new StrokesGM; ) |
519 DEF_GM( return new Strokes2GM; ) | 519 DEF_GM( return new Strokes2GM; ) |
520 DEF_GM( return new Strokes3GM; ) | 520 DEF_GM( return new Strokes3GM; ) |
521 DEF_GM( return new Strokes4GM; ) | 521 DEF_GM( return new Strokes4GM; ) |
522 DEF_GM( return new Strokes5GM; ) | 522 DEF_GM( return new Strokes5GM; ) |
523 | 523 |
524 DEF_GM( return new ZeroLenStrokesGM; ) | 524 DEF_GM( return new ZeroLenStrokesGM; ) |
525 DEF_GM( return new TeenyStrokesGM; ) | 525 DEF_GM( return new TeenyStrokesGM; ) |
OLD | NEW |