OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 canvas->save(); | 159 canvas->save(); |
160 canvas->translate(200, 200); | 160 canvas->translate(200, 200); |
161 path.moveTo(SkIntToScalar(20), SkIntToScalar(80)); | 161 path.moveTo(SkIntToScalar(20), SkIntToScalar(80)); |
162 path.lineTo(SkIntToScalar(80), SkIntToScalar(80)); | 162 path.lineTo(SkIntToScalar(80), SkIntToScalar(80)); |
163 path.lineTo(SkIntToScalar(80), SkIntToScalar(20)); | 163 path.lineTo(SkIntToScalar(80), SkIntToScalar(20)); |
164 path.lineTo(SkIntToScalar(80), SkIntToScalar(30)); | 164 path.lineTo(SkIntToScalar(80), SkIntToScalar(30)); |
165 canvas->drawPath(path, paint); | 165 canvas->drawPath(path, paint); |
166 canvas->restore(); | 166 canvas->restore(); |
167 } | 167 } |
168 | 168 |
| 169 // Two "island" triangles inside a containing rect. |
| 170 // This exercises the partnering code in the tessellator. |
| 171 void test_partners(SkCanvas* canvas, const SkPaint& paint) { |
| 172 SkPath path; |
| 173 canvas->save(); |
| 174 canvas->translate(300, 200); |
| 175 path.moveTo(20, 80); |
| 176 path.lineTo(80, 80); |
| 177 path.lineTo(80, 20); |
| 178 path.lineTo(20, 20); |
| 179 path.moveTo(30, 30); |
| 180 path.lineTo(45, 50); |
| 181 path.lineTo(30, 70); |
| 182 path.moveTo(70, 30); |
| 183 path.lineTo(70, 70); |
| 184 path.lineTo(55, 50); |
| 185 canvas->drawPath(path, paint); |
| 186 canvas->restore(); |
| 187 } |
| 188 |
169 // Monotone test 1 (point in the middle) | 189 // Monotone test 1 (point in the middle) |
170 void test_monotone_1(SkCanvas* canvas, const SkPaint& paint) { | 190 void test_monotone_1(SkCanvas* canvas, const SkPaint& paint) { |
171 SkPath path; | 191 SkPath path; |
172 canvas->save(); | 192 canvas->save(); |
173 canvas->translate(0, 300); | 193 canvas->translate(0, 300); |
174 path.moveTo(SkIntToScalar(20), SkIntToScalar(20)); | 194 path.moveTo(SkIntToScalar(20), SkIntToScalar(20)); |
175 path.quadTo(SkIntToScalar(20), SkIntToScalar(50), | 195 path.quadTo(SkIntToScalar(20), SkIntToScalar(50), |
176 SkIntToScalar(80), SkIntToScalar(50)); | 196 SkIntToScalar(80), SkIntToScalar(50)); |
177 path.quadTo(SkIntToScalar(20), SkIntToScalar(50), | 197 path.quadTo(SkIntToScalar(20), SkIntToScalar(50), |
178 SkIntToScalar(20), SkIntToScalar(80)); | 198 SkIntToScalar(20), SkIntToScalar(80)); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 test_reverse_concave(canvas, paint); | 383 test_reverse_concave(canvas, paint); |
364 test_bowtie(canvas, paint); | 384 test_bowtie(canvas, paint); |
365 test_fake_bowtie(canvas, paint); | 385 test_fake_bowtie(canvas, paint); |
366 test_fish(canvas, paint); | 386 test_fish(canvas, paint); |
367 test_collinear_edges(canvas, paint); | 387 test_collinear_edges(canvas, paint); |
368 test_hole(canvas, paint); | 388 test_hole(canvas, paint); |
369 test_star(canvas, paint); | 389 test_star(canvas, paint); |
370 test_stairstep(canvas, paint); | 390 test_stairstep(canvas, paint); |
371 test_stairstep2(canvas, paint); | 391 test_stairstep2(canvas, paint); |
372 test_overlapping(canvas, paint); | 392 test_overlapping(canvas, paint); |
| 393 test_partners(canvas, paint); |
373 test_monotone_1(canvas, paint); | 394 test_monotone_1(canvas, paint); |
374 test_monotone_2(canvas, paint); | 395 test_monotone_2(canvas, paint); |
375 test_monotone_3(canvas, paint); | 396 test_monotone_3(canvas, paint); |
376 test_monotone_4(canvas, paint); | 397 test_monotone_4(canvas, paint); |
377 test_monotone_5(canvas, paint); | 398 test_monotone_5(canvas, paint); |
378 test_degenerate(canvas, paint); | 399 test_degenerate(canvas, paint); |
379 test_coincident_edge(canvas, paint); | 400 test_coincident_edge(canvas, paint); |
380 test_bowtie_coincident_triangle(canvas, paint); | 401 test_bowtie_coincident_triangle(canvas, paint); |
381 test_coincident_edges_1(canvas, paint); | 402 test_coincident_edges_1(canvas, paint); |
382 test_coincident_edges_2(canvas, paint); | 403 test_coincident_edges_2(canvas, paint); |
383 test_coincident_edges_3(canvas, paint); | 404 test_coincident_edges_3(canvas, paint); |
384 test_coincident_edges_4(canvas, paint); | 405 test_coincident_edges_4(canvas, paint); |
385 } | 406 } |
386 | 407 |
387 private: | 408 private: |
388 typedef skiagm::GM INHERITED; | 409 typedef skiagm::GM INHERITED; |
389 }; | 410 }; |
390 | 411 |
391 DEF_GM( return new ConcavePathsGM; ) | 412 DEF_GM( return new ConcavePathsGM; ) |
OLD | NEW |