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 | 8 |
9 #include "SampleCode.h" | 9 #include "SampleCode.h" |
10 #include "SkView.h" | 10 #include "SkView.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 path.lineTo(SkIntToScalar(80), SkIntToScalar(20)); | 128 path.lineTo(SkIntToScalar(80), SkIntToScalar(20)); |
129 path.lineTo(SkIntToScalar(80), SkIntToScalar(80)); | 129 path.lineTo(SkIntToScalar(80), SkIntToScalar(80)); |
130 path.lineTo(SkIntToScalar(20), SkIntToScalar(80)); | 130 path.lineTo(SkIntToScalar(20), SkIntToScalar(80)); |
131 path.moveTo(SkIntToScalar(30), SkIntToScalar(30)); | 131 path.moveTo(SkIntToScalar(30), SkIntToScalar(30)); |
132 path.lineTo(SkIntToScalar(30), SkIntToScalar(70)); | 132 path.lineTo(SkIntToScalar(30), SkIntToScalar(70)); |
133 path.lineTo(SkIntToScalar(70), SkIntToScalar(70)); | 133 path.lineTo(SkIntToScalar(70), SkIntToScalar(70)); |
134 path.lineTo(SkIntToScalar(70), SkIntToScalar(30)); | 134 path.lineTo(SkIntToScalar(70), SkIntToScalar(30)); |
135 canvas->drawPath(path, paint); | 135 canvas->drawPath(path, paint); |
136 canvas->restore(); | 136 canvas->restore(); |
137 } | 137 } |
| 138 if (1) { |
| 139 SkPath path; |
| 140 canvas->save(); |
| 141 canvas->translate(300, 100); |
| 142 path.moveTo(30, 20); |
| 143 path.lineTo(50, 80); |
| 144 path.lineTo(70, 20); |
| 145 path.lineTo(20, 57); |
| 146 path.lineTo(80, 57); |
| 147 path.close(); |
| 148 canvas->drawPath(path, paint); |
| 149 canvas->restore(); |
| 150 } |
| 151 // Quadratic path test. |
| 152 if (1) { |
| 153 SkPath path; |
| 154 canvas->save(); |
| 155 canvas->translate(0, 200); |
| 156 path.moveTo(SkIntToScalar(20), SkIntToScalar(50)); |
| 157 path.quadTo(SkIntToScalar(50), SkIntToScalar(50), SkIntToScalar(50),
SkIntToScalar(20)); |
| 158 path.lineTo(SkIntToScalar(80), SkIntToScalar(20)); |
| 159 path.lineTo(SkIntToScalar(80), SkIntToScalar(80)); |
| 160 path.lineTo(SkIntToScalar(20), SkIntToScalar(80)); |
| 161 canvas->drawPath(path, paint); |
| 162 canvas->restore(); |
| 163 } |
| 164 // Cubic path test. |
| 165 if (1) { |
| 166 SkPath path; |
| 167 canvas->save(); |
| 168 canvas->translate(100, 200); |
| 169 path.moveTo(SkIntToScalar(20), SkIntToScalar(50)); |
| 170 // path.cubicTo(SkIntToScalar(20), SkIntToScalar(20), |
| 171 // SkIntToScalar(70), SkIntToScalar(70), |
| 172 // SkIntToScalar(50), SkIntToScalar(20)); |
| 173 path.cubicTo(SkIntToScalar(60), SkIntToScalar(40), |
| 174 SkIntToScalar(-20), SkIntToScalar(30), |
| 175 SkIntToScalar(50), SkIntToScalar(20)); |
| 176 path.lineTo(SkIntToScalar(80), SkIntToScalar(20)); |
| 177 path.lineTo(SkIntToScalar(80), SkIntToScalar(80)); |
| 178 path.lineTo(SkIntToScalar(20), SkIntToScalar(80)); |
| 179 canvas->drawPath(path, paint); |
| 180 canvas->restore(); |
| 181 } |
138 } | 182 } |
139 | 183 |
140 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, | 184 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, |
141 unsigned modi) { | 185 unsigned modi) { |
142 this->inval(nullptr); | 186 this->inval(nullptr); |
143 return this->INHERITED::onFindClickHandler(x, y, modi); | 187 return this->INHERITED::onFindClickHandler(x, y, modi); |
144 } | 188 } |
145 | 189 |
146 private: | 190 private: |
147 typedef SampleView INHERITED; | 191 typedef SampleView INHERITED; |
148 }; | 192 }; |
149 | 193 |
150 ////////////////////////////////////////////////////////////////////////////// | 194 ////////////////////////////////////////////////////////////////////////////// |
151 | 195 |
152 static SkView* MyFactory() { return new ConcavePathView; } | 196 static SkView* MyFactory() { return new ConcavePathView; } |
153 static SkViewRegister reg(MyFactory); | 197 static SkViewRegister reg(MyFactory); |
OLD | NEW |