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

Side by Side Diff: gm/dashing.cpp

Issue 1776983002: pass cap to dash text (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | src/core/SkPaint.cpp » ('j') | src/core/SkScalerContext.h » ('J')
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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 SkPath wavy; 522 SkPath wavy;
523 wavy.moveTo(-10000, 100); 523 wavy.moveTo(-10000, 100);
524 for (SkScalar i = -10000; i < 10000; i += 20) { 524 for (SkScalar i = -10000; i < 10000; i += 20) {
525 wavy.quadTo(i + 5, 95, i + 10, 100); 525 wavy.quadTo(i + 5, 95, i + 10, 100);
526 wavy.quadTo(i + 15, 105, i + 20, 100); 526 wavy.quadTo(i + 15, 105, i + 20, 100);
527 } 527 }
528 canvas->drawPath(wavy, p); 528 canvas->drawPath(wavy, p);
529 } 529 }
530 530
531 DEF_SIMPLE_GM(dashtextcaps, canvas, 512, 512) {
532 SkPaint p;
533 p.setAntiAlias(true);
534 p.setStyle(SkPaint::kStroke_Style);
535 p.setStrokeWidth(10);
536 p.setStrokeCap(SkPaint::kRound_Cap);
537 p.setTextSize(100);
538 p.setARGB(0xff, 0xbb, 0x00, 0x00);
539 const SkScalar intervals[] = { 12, 12 };
540 p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals ), 0))->unref();
541 canvas->drawText("Sausages", 8, 10, 90, p);
542 canvas->drawLine(8, 120, 456, 120, p);
543 }
544
531 ////////////////////////////////////////////////////////////////////////////// 545 //////////////////////////////////////////////////////////////////////////////
532 546
533 DEF_GM(return new DashingGM;) 547 DEF_GM(return new DashingGM;)
534 DEF_GM(return new Dashing2GM;) 548 DEF_GM(return new Dashing2GM;)
535 DEF_GM(return new Dashing3GM;) 549 DEF_GM(return new Dashing3GM;)
536 DEF_GM(return new Dashing4GM;) 550 DEF_GM(return new Dashing4GM;)
537 DEF_GM(return new Dashing5GM(true);) 551 DEF_GM(return new Dashing5GM(true);)
538 DEF_GM(return new Dashing5GM(false);) 552 DEF_GM(return new Dashing5GM(false);)
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | src/core/SkScalerContext.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698