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

Side by Side Diff: gm/dashing.cpp

Issue 1651573002: add new tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | gyp/SampleApp.gyp » ('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 2012 Google Inc. 2 * Copyright 2012 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 495 }
496 SkPaint p; 496 SkPaint p;
497 p.setAntiAlias(true); 497 p.setAntiAlias(true);
498 p.setStyle(SkPaint::kStroke_Style); 498 p.setStyle(SkPaint::kStroke_Style);
499 p.setStrokeWidth(1); 499 p.setStrokeWidth(1);
500 const SkScalar intervals[] = { 1, 1 }; 500 const SkScalar intervals[] = { 1, 1 };
501 p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals ), 0))->unref(); 501 p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals ), 0))->unref();
502 canvas->drawPath(lines, p); 502 canvas->drawPath(lines, p);
503 } 503 }
504 504
505 DEF_SIMPLE_GM(longlinedash, canvas, 512, 512) {
506 SkPaint p;
507 p.setAntiAlias(true);
508 p.setStyle(SkPaint::kStroke_Style);
509 p.setStrokeWidth(80);
510
511 const SkScalar intervals[] = { 2, 2 };
512 p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals ), 0))->unref();
513 canvas->drawRect(SkRect::MakeXYWH(-10000, 100, 20000, 20), p);
514 }
515
516 DEF_SIMPLE_GM(longwavyline, canvas, 512, 512) {
517 SkPaint p;
518 p.setAntiAlias(true);
519 p.setStyle(SkPaint::kStroke_Style);
520 p.setStrokeWidth(2);
521
522 SkPath wavy;
523 wavy.moveTo(-10000, 100);
524 for (SkScalar i = -10000; i < 10000; i += 20) {
525 wavy.quadTo(i + 5, 95, i + 10, 100);
526 wavy.quadTo(i + 15, 105, i + 20, 100);
527 }
528 canvas->drawPath(wavy, p);
529 }
530
505 ////////////////////////////////////////////////////////////////////////////// 531 //////////////////////////////////////////////////////////////////////////////
506 532
507 DEF_GM(return new DashingGM;) 533 DEF_GM(return new DashingGM;)
508 DEF_GM(return new Dashing2GM;) 534 DEF_GM(return new Dashing2GM;)
509 DEF_GM(return new Dashing3GM;) 535 DEF_GM(return new Dashing3GM;)
510 DEF_GM(return new Dashing4GM;) 536 DEF_GM(return new Dashing4GM;)
511 DEF_GM(return new Dashing5GM(true);) 537 DEF_GM(return new Dashing5GM(true);)
512 DEF_GM(return new Dashing5GM(false);) 538 DEF_GM(return new Dashing5GM(false);)
OLDNEW
« no previous file with comments | « no previous file | gyp/SampleApp.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698