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 BD-style license that can be | 4 * Use of this source code is governed by a BD-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 "SkParsePath.h" | 9 #include "SkParsePath.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 SkRect oval = SkRect::MakeXYWH(-radius, yOffset - radius, 2 * radius, 2 * ra
dius); | 198 SkRect oval = SkRect::MakeXYWH(-radius, yOffset - radius, 2 * radius, 2 * ra
dius); |
199 p.arcTo(oval, 1.25f * 180, .5f * 180, false); | 199 p.arcTo(oval, 1.25f * 180, .5f * 180, false); |
200 | 200 |
201 SkPaint paint; | 201 SkPaint paint; |
202 paint.setStyle(SkPaint::kStroke_Style); | 202 paint.setStyle(SkPaint::kStroke_Style); |
203 paint.setStrokeCap(SkPaint::kRound_Cap); | 203 paint.setStrokeCap(SkPaint::kRound_Cap); |
204 paint.setStrokeWidth(15.36f); | 204 paint.setStrokeWidth(15.36f); |
205 | 205 |
206 canvas->drawPath(p, paint); | 206 canvas->drawPath(p, paint); |
207 } | 207 } |
| 208 |
| 209 #include "SkDashPathEffect.h" |
| 210 #include "SkPathMeasure.h" |
| 211 |
| 212 DEF_SIMPLE_GM(bug583299, canvas, 300, 300) { |
| 213 const char* d="M60,60 A50,50 0 0 0 160,60 A50,50 0 0 0 60,60z"; |
| 214 SkPaint p; |
| 215 p.setStyle(SkPaint::kStroke_Style); |
| 216 p.setStrokeWidth(100); |
| 217 p.setAntiAlias(true); |
| 218 p.setColor(0xFF008200); |
| 219 p.setStrokeCap(SkPaint::kSquare_Cap); |
| 220 SkPath path; |
| 221 SkParsePath::FromSVGString(d, &path); |
| 222 SkPathMeasure meas(path, false); |
| 223 SkScalar length = meas.getLength(); |
| 224 SkScalar intervals[] = {0, length }; |
| 225 int intervalCount = (int) SK_ARRAY_COUNT(intervals); |
| 226 p.setPathEffect(SkDashPathEffect::Create(intervals, intervalCount, 0))->unref(
); |
| 227 canvas->drawPath(path, p); |
| 228 } |
OLD | NEW |