OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkDashPathEffect.h" | 10 #include "SkDashPathEffect.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 SkPaint p; | 61 SkPaint p; |
62 p.setAntiAlias(true); | 62 p.setAntiAlias(true); |
63 p.setStyle(SkPaint::kStroke_Style); | 63 p.setStyle(SkPaint::kStroke_Style); |
64 p.setStrokeWidth(10); | 64 p.setStrokeWidth(10); |
65 SkScalar intervals[4]; | 65 SkScalar intervals[4]; |
66 int intervalCount = dashExample.length; | 66 int intervalCount = dashExample.length; |
67 SkScalar dashLength = circumference / wedge / dashUnits; | 67 SkScalar dashLength = circumference / wedge / dashUnits; |
68 for (int index = 0; index < dashExample.length; ++index) { | 68 for (int index = 0; index < dashExample.length; ++index) { |
69 intervals[index] = dashExample.pattern[index] * dashLength; | 69 intervals[index] = dashExample.pattern[index] * dashLength; |
70 } | 70 } |
71 p.setPathEffect(SkDashPathEffect::Make(intervals, intervalCount, 0))
; | 71 p.setPathEffect(SkDashPathEffect::Create(intervals, intervalCount, 0
))->unref(); |
72 canvas->drawPath(circle, p); | 72 canvas->drawPath(circle, p); |
73 canvas->translate(0, radius * 2 + 50); | 73 canvas->translate(0, radius * 2 + 50); |
74 } | 74 } |
75 canvas->restore(); | 75 canvas->restore(); |
76 canvas->translate(radius * 2 + 50, 0); | 76 canvas->translate(radius * 2 + 50, 0); |
77 } | 77 } |
78 } | 78 } |
OLD | NEW |