OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkTArray.h" | 10 #include "SkTArray.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 { | 65 { |
66 SkPath* veryThinEllipse = &fPaths.push_back(); | 66 SkPath* veryThinEllipse = &fPaths.push_back(); |
67 veryThinEllipse->moveTo(0, 0); | 67 veryThinEllipse->moveTo(0, 0); |
68 veryThinEllipse->conicTo(100, 100, 1, 0, SK_ScalarHalf); | 68 veryThinEllipse->conicTo(100, 100, 1, 0, SK_ScalarHalf); |
69 } | 69 } |
70 { | 70 { |
71 SkPath* closedEllipse = &fPaths.push_back(); | 71 SkPath* closedEllipse = &fPaths.push_back(); |
72 closedEllipse->moveTo(0, 0); | 72 closedEllipse->moveTo(0, 0); |
73 closedEllipse->conicTo(100, 100, 0, 0, SK_ScalarHalf); | 73 closedEllipse->conicTo(100, 100, 0, 0, SK_ScalarHalf); |
74 } | 74 } |
| 75 { |
| 76 const SkScalar w = SkScalarSqrt(2)/2; |
| 77 fGiantCircle.moveTo(2.1e+11f, -1.05e+11f); |
| 78 fGiantCircle.conicTo(2.1e+11f, 0, 1.05e+11f, 0, w); |
| 79 fGiantCircle.conicTo(0, 0, 0, -1.05e+11f, w); |
| 80 fGiantCircle.conicTo(0, -2.1e+11f, 1.05e+11f, -2.1e+11f, w); |
| 81 fGiantCircle.conicTo(2.1e+11f, -2.1e+11f, 2.1e+11f, -1.05e+11f, w); |
| 82 |
| 83 } |
| 84 } |
| 85 |
| 86 void drawGiantCircle(SkCanvas* canvas) { |
| 87 SkPaint paint; |
| 88 canvas->drawPath(fGiantCircle, paint); |
75 } | 89 } |
76 | 90 |
77 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 91 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
78 const SkAlpha kAlphaValue[] = { 0xFF, 0x40 }; | 92 const SkAlpha kAlphaValue[] = { 0xFF, 0x40 }; |
79 | 93 |
80 const SkScalar margin = 15; | 94 const SkScalar margin = 15; |
81 canvas->translate(margin, margin); | 95 canvas->translate(margin, margin); |
82 | 96 |
83 SkPaint paint; | 97 SkPaint paint; |
84 for (int p = 0; p < fPaths.count(); ++p) { | 98 for (int p = 0; p < fPaths.count(); ++p) { |
(...skipping 12 matching lines...) Expand all Loading... |
97 canvas->restore(); | 111 canvas->restore(); |
98 | 112 |
99 canvas->translate(110, 0); | 113 canvas->translate(110, 0); |
100 } | 114 } |
101 } | 115 } |
102 } | 116 } |
103 canvas->restore(); | 117 canvas->restore(); |
104 canvas->translate(0, 110); | 118 canvas->translate(0, 110); |
105 } | 119 } |
106 canvas->restore(); | 120 canvas->restore(); |
| 121 |
| 122 this->drawGiantCircle(canvas); |
107 } | 123 } |
108 | 124 |
109 private: | 125 private: |
110 SkTArray<SkPath> fPaths; | 126 SkTArray<SkPath> fPaths; |
| 127 SkPath fGiantCircle; |
111 typedef skiagm::GM INHERITED; | 128 typedef skiagm::GM INHERITED; |
112 }; | 129 }; |
113 DEF_GM( return SkNEW(ConicPathsGM); ) | 130 DEF_GM( return SkNEW(ConicPathsGM); ) |
114 | 131 |
115 ////////////////////////////////////////////////////////////////////////////// | 132 ////////////////////////////////////////////////////////////////////////////// |
116 | 133 |
OLD | NEW |