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

Side by Side Diff: gm/stroketext.cpp

Issue 1813123003: Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.or… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move flag into sktypes, so it is visible to both paint and other patheffect clients 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 | « gm/strokes.cpp ('k') | gm/textbloblooper.cpp » ('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 2014 Google Inc. 2 * Copyright 2014 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 "SkDashPathEffect.h" 10 #include "SkDashPathEffect.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 draw_text_stroked(canvas, paint, 10); 48 draw_text_stroked(canvas, paint, 10);
49 49
50 canvas->translate(200, 0); 50 canvas->translate(200, 0);
51 draw_text_stroked(canvas, paint, 0); 51 draw_text_stroked(canvas, paint, 0);
52 52
53 const SkScalar intervals[] = { 20, 10, 5, 10 }; 53 const SkScalar intervals[] = { 20, 10, 5, 10 };
54 const SkScalar phase = 0; 54 const SkScalar phase = 0;
55 55
56 canvas->translate(200, 0); 56 canvas->translate(200, 0);
57 SkPaint p(paint); 57 SkPaint p(paint);
58 p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals ), phase))->unref(); 58 p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), phase));
59 draw_text_stroked(canvas, p, 10); 59 draw_text_stroked(canvas, p, 10);
60 } 60 }
61 61
62 namespace { 62 namespace {
63 enum { 63 enum {
64 kBelowThreshold_TextSize = 255, 64 kBelowThreshold_TextSize = 255,
65 kAboveThreshold_TextSize = 257 65 kAboveThreshold_TextSize = 257
66 }; 66 };
67 } 67 }
68 68
69 DEF_SIMPLE_GM(stroketext, canvas, 1200, 480) { 69 DEF_SIMPLE_GM(stroketext, canvas, 1200, 480) {
70 if (true) { test_nulldev(canvas); } 70 if (true) { test_nulldev(canvas); }
71 SkPaint paint; 71 SkPaint paint;
72 paint.setAntiAlias(true); 72 paint.setAntiAlias(true);
73 sk_tool_utils::set_portable_typeface(&paint); 73 sk_tool_utils::set_portable_typeface(&paint);
74 74
75 paint.setTextSize(kBelowThreshold_TextSize); 75 paint.setTextSize(kBelowThreshold_TextSize);
76 draw_text_set(canvas, paint); 76 draw_text_set(canvas, paint);
77 77
78 canvas->translate(600, 0); 78 canvas->translate(600, 0);
79 paint.setTextSize(kAboveThreshold_TextSize); 79 paint.setTextSize(kAboveThreshold_TextSize);
80 draw_text_set(canvas, paint); 80 draw_text_set(canvas, paint);
81 } 81 }
OLDNEW
« no previous file with comments | « gm/strokes.cpp ('k') | gm/textbloblooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698