OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2013 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.h" | |
9 #include "SkCanvas.h" | |
10 #include "SkPath.h" | |
11 | |
12 namespace skiagm { | |
13 | |
14 class InverseStrokeFillGM : public GM { | |
15 public: | |
16 InverseStrokeFillGM() { | |
17 | |
18 } | |
19 | |
20 protected: | |
21 virtual SkString onShortName() { | |
22 return SkString("inverse_stroke_fill"); | |
23 } | |
24 | |
25 virtual SkISize onISize() { | |
26 return make_isize(100, 100); | |
27 } | |
28 | |
29 virtual void onDraw(SkCanvas* canvas) { | |
30 SkScalar x = SkIntToScalar(50); | |
31 SkScalar y = SkIntToScalar(50); | |
32 SkScalar r = SkIntToScalar(40); | |
33 | |
34 SkPaint paint; | |
35 paint.setStrokeWidth(SkIntToScalar(5)); | |
edisonn
2013/07/26 20:23:52
add option for stoke width 0
ducky
2013/07/29 19:07:51
Done. The original intent of this GM was to test o
| |
36 paint.setStyle(SkPaint::kStrokeAndFill_Style); | |
edisonn
2013/07/26 20:23:52
what about the rest of styles?
ducky
2013/07/29 19:07:51
Done.
| |
37 | |
38 SkPath path; | |
39 path.setFillType(SkPath::kInverseWinding_FillType); | |
40 path.addCircle(x, y, r, SkPath::kCW_Direction); | |
41 canvas->drawPath(path, paint); | |
edisonn
2013/07/26 20:23:52
please add tests for other addFoo operations. some
ducky
2013/07/29 19:07:51
Done.
| |
42 | |
43 // Draw positive centerline for reference. | |
44 paint.setStrokeWidth(SkIntToScalar(0)); | |
45 paint.setStyle(SkPaint::kStroke_Style); | |
46 path.setFillType(SkPath::kWinding_FillType); | |
47 canvas->drawPath(path, paint); | |
48 } | |
49 | |
50 private: | |
51 typedef GM INHERITED; | |
52 }; | |
53 | |
54 DEF_GM( return new InverseStrokeFillGM; ) | |
55 } | |
OLD | NEW |