OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 path2.reset(); | 72 path2.reset(); |
73 path2.addCircle(x + SkIntToScalar(240), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCCW_Direction); | 73 path2.addCircle(x + SkIntToScalar(240), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCCW_Direction); |
74 canvas->drawPath(path2, paint); | 74 canvas->drawPath(path2, paint); |
75 SkASSERT(path2.cheapIsDirection(SkPath::kCCW_Direction)); | 75 SkASSERT(path2.cheapIsDirection(SkPath::kCCW_Direction)); |
76 | 76 |
77 path2.reset(); | 77 path2.reset(); |
78 SkASSERT(!path2.cheapComputeDirection(NULL)); | 78 SkASSERT(!path2.cheapComputeDirection(NULL)); |
79 path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCW_Direction); | 79 path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToS
calar(50), SkPath::kCW_Direction); |
80 SkASSERT(path2.cheapIsDirection(SkPath::kCW_Direction)); | 80 SkASSERT(path2.cheapIsDirection(SkPath::kCW_Direction)); |
81 canvas->drawPath(path2, paint); | 81 canvas->drawPath(path2, paint); |
| 82 |
| 83 SkRect r = SkRect::MakeXYWH(x - SkIntToScalar(50), y + SkIntToScalar(280
), |
| 84 SkIntToScalar(100), SkIntToScalar(100)); |
| 85 SkPath path3; |
| 86 path3.setFillType(SkPath::kWinding_FillType); |
| 87 path3.addRect(r, SkPath::kCW_Direction); |
| 88 r.inset(SkIntToScalar(10), SkIntToScalar(10)); |
| 89 path3.addRect(r, SkPath::kCCW_Direction); |
| 90 canvas->drawPath(path3, paint); |
| 91 |
| 92 r = SkRect::MakeXYWH(x + SkIntToScalar(70), y + SkIntToScalar(280), |
| 93 SkIntToScalar(100), SkIntToScalar(100)); |
| 94 SkPath path4; |
| 95 path4.setFillType(SkPath::kWinding_FillType); |
| 96 path4.addRect(r, SkPath::kCCW_Direction); |
| 97 r.inset(SkIntToScalar(10), SkIntToScalar(10)); |
| 98 path4.addRect(r, SkPath::kCW_Direction); |
| 99 canvas->drawPath(path4, paint); |
| 100 |
| 101 r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280), |
| 102 SkIntToScalar(100), SkIntToScalar(100)); |
| 103 path4.reset(); |
| 104 SkASSERT(!path4.cheapComputeDirection(NULL)); |
| 105 path4.addRect(r, SkPath::kCCW_Direction); |
| 106 SkASSERT(path4.cheapIsDirection(SkPath::kCCW_Direction)); |
| 107 path4.moveTo(0, 0); // test for crbug.com/247770 |
| 108 canvas->drawPath(path4, paint); |
| 109 |
| 110 r = SkRect::MakeXYWH(x + SkIntToScalar(310), y + SkIntToScalar(280), |
| 111 SkIntToScalar(100), SkIntToScalar(100)); |
| 112 path4.reset(); |
| 113 SkASSERT(!path4.cheapComputeDirection(NULL)); |
| 114 path4.addRect(r, SkPath::kCW_Direction); |
| 115 SkASSERT(path4.cheapIsDirection(SkPath::kCW_Direction)); |
| 116 path4.moveTo(0, 0); // test for crbug.com/247770 |
| 117 canvas->drawPath(path4, paint); |
82 } | 118 } |
83 | 119 |
84 private: | 120 private: |
85 typedef GM INHERITED; | 121 typedef GM INHERITED; |
86 }; | 122 }; |
87 | 123 |
88 ////////////////////////////////////////////////////////////////////////////// | 124 ////////////////////////////////////////////////////////////////////////////// |
89 | 125 |
90 static GM* MyFactory(void*) { return new StrokeFillGM; } | 126 DEF_GM(return SkNEW(StrokeFillGM);) |
91 static GMRegistry reg(MyFactory); | |
92 | 127 |
93 } | 128 } |
OLD | NEW |