Debian Codegraph @

gm/bug530095.cpp

raw
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "gm/gm.h"
9 #include "include/core/SkCanvas.h"
10 #include "include/core/SkColor.h"
11 #include "include/core/SkPaint.h"
12 #include "include/core/SkPath.h"
13 #include "include/core/SkPathEffect.h"
14 #include "include/core/SkScalar.h"
15 #include "include/core/SkTypes.h"
16 #include "include/effects/SkDashPathEffect.h"
17
18 DEF_SIMPLE_GM(bug530095, canvas, 900, 1200) {
19 SkPath path1 = SkPath::Circle(200, 200, 124),
20 path2 = SkPath::Circle(2, 2, 1.24f);
21
22 SkPaint paint;
23 paint.setAntiAlias(true);
24 paint.setStyle(SkPaint::kStroke_Style);
25 paint.setStrokeWidth(26);
26 SkScalar intervals[] = {700, 700 };
27 paint.setPathEffect(SkDashPathEffect::Make(intervals, -40));
28 canvas->drawPath(path1, paint);
29
30 paint.setStrokeWidth(0.26f);
31 SkScalar smIntervals[] = {7, 7 };
32 paint.setPathEffect(SkDashPathEffect::Make(smIntervals, -0.40f));
33 canvas->save();
34 canvas->scale(100, 100);
35 canvas->translate(4, 0);
36 canvas->drawPath(path2, paint);
37 canvas->restore();
38
39 paint.setStrokeWidth(26);
40 paint.setPathEffect(SkDashPathEffect::Make(intervals, 0));
41 canvas->save();
42 canvas->translate(0, 400);
43 canvas->drawPath(path1, paint);
44 canvas->restore();
45
46 paint.setStrokeWidth(0.26f);
47 paint.setPathEffect(SkDashPathEffect::Make(smIntervals, 0));
48 canvas->scale(100, 100);
49 canvas->translate(4, 4);
50 canvas->drawPath(path2, paint);
51 }
52
53 DEF_SIMPLE_GM(bug591993, canvas, 40, 140) {
54 SkPaint p;
55 p.setColor(SK_ColorRED);
56 p.setAntiAlias(true);
57 p.setStyle(SkPaint::kStroke_Style);
58 p.setStrokeCap(SkPaint::kRound_Cap);
59 p.setStrokeWidth(10);
60 const SkScalar intervals[] = { 100, 100 };
61 p.setPathEffect(SkDashPathEffect::Make(intervals, 100));
62 canvas->drawLine(20, 20, 120, 20, p);
63 }