OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 r.inset(p.getStrokeWidth(), p.getStrokeWidth()); | 48 r.inset(p.getStrokeWidth(), p.getStrokeWidth()); |
49 SkRect innerBounds = r; | 49 SkRect innerBounds = r; |
50 | 50 |
51 if (true) { | 51 if (true) { |
52 c->drawOval(r, p); | 52 c->drawOval(r, p); |
53 } else { | 53 } else { |
54 SkScalar x = r.centerX(); | 54 SkScalar x = r.centerX(); |
55 SkScalar y = r.centerY(); | 55 SkScalar y = r.centerY(); |
56 SkScalar radius = r.width() / 2; | 56 SkScalar radius = r.width() / 2; |
57 SkScalar thickness = p.getStrokeWidth(); | 57 SkScalar thickness = p.getStrokeWidth(); |
58 SkScalar sweep = SkFloatToScalar(360.0f); | 58 SkScalar sweep = 360.0f; |
59 SkPath path; | 59 SkPath path; |
60 | 60 |
61 path.moveTo(x + radius, y); | 61 path.moveTo(x + radius, y); |
62 // outer top | 62 // outer top |
63 path.lineTo(x + radius + thickness, y); | 63 path.lineTo(x + radius + thickness, y); |
64 // outer arc | 64 // outer arc |
65 path.arcTo(bounds, 0, sweep, false); | 65 path.arcTo(bounds, 0, sweep, false); |
66 // inner arc | 66 // inner arc |
67 path.arcTo(innerBounds, sweep, -sweep, false); | 67 path.arcTo(innerBounds, sweep, -sweep, false); |
68 path.close(); | 68 path.close(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 private: | 177 private: |
178 typedef SampleView INHERITED; | 178 typedef SampleView INHERITED; |
179 }; | 179 }; |
180 | 180 |
181 ////////////////////////////////////////////////////////////////////////////// | 181 ////////////////////////////////////////////////////////////////////////////// |
182 | 182 |
183 static SkView* MyFactory() { return new DitherView; } | 183 static SkView* MyFactory() { return new DitherView; } |
184 static SkViewRegister reg(MyFactory); | 184 static SkViewRegister reg(MyFactory); |
OLD | NEW |