| 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 "SkGeometry.h" | 8 #include "SkGeometry.h" |
| 9 #include "Test.h" | 9 #include "Test.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 SkPoint pts[3], dst[5]; | 109 SkPoint pts[3], dst[5]; |
| 110 | 110 |
| 111 pts[0].set(0, 0); | 111 pts[0].set(0, 0); |
| 112 pts[1].set(100, 50); | 112 pts[1].set(100, 50); |
| 113 pts[2].set(0, 100); | 113 pts[2].set(0, 100); |
| 114 | 114 |
| 115 int count = SkChopQuadAtMaxCurvature(pts, dst); | 115 int count = SkChopQuadAtMaxCurvature(pts, dst); |
| 116 REPORTER_ASSERT(reporter, count == 1 || count == 2); | 116 REPORTER_ASSERT(reporter, count == 1 || count == 2); |
| 117 | 117 |
| 118 pts[0].set(0, 0); | 118 pts[0].set(0, 0); |
| 119 pts[1].set(SkIntToScalar(3), 0); | 119 pts[1].set(3, 0); |
| 120 pts[2].set(SkIntToScalar(3), SkIntToScalar(3)); | 120 pts[2].set(3, 3); |
| 121 SkConvertQuadToCubic(pts, dst); | 121 SkConvertQuadToCubic(pts, dst); |
| 122 const SkPoint cubic[] = { | 122 const SkPoint cubic[] = { |
| 123 { 0, 0, }, | 123 { 0, 0, }, { 2, 0, }, { 3, 1, }, { 3, 3 }, |
| 124 { SkIntToScalar(2), 0, }, | |
| 125 { SkIntToScalar(3), SkIntToScalar(1), }, | |
| 126 { SkIntToScalar(3), SkIntToScalar(3) }, | |
| 127 }; | 124 }; |
| 128 for (int i = 0; i < 4; ++i) { | 125 for (int i = 0; i < 4; ++i) { |
| 129 REPORTER_ASSERT(reporter, nearly_equal(cubic[i], dst[i])); | 126 REPORTER_ASSERT(reporter, nearly_equal(cubic[i], dst[i])); |
| 130 } | 127 } |
| 131 | 128 |
| 132 testChopCubic(reporter); | 129 testChopCubic(reporter); |
| 133 test_evalquadat(reporter); | 130 test_evalquadat(reporter); |
| 134 test_conic(reporter); | 131 test_conic(reporter); |
| 135 } | 132 } |
| OLD | NEW |