OLD | NEW |
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 Loading... |
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::Make(intervals, SK_ARRAY_COUNT(intervals),
phase)); | 58 p.setPathEffect(SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals
), phase))->unref(); |
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 } |
OLD | NEW |