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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 /** | 157 /** |
158 * We need to ensure that when a conic is approximated by quads, that we always
return finite | 158 * We need to ensure that when a conic is approximated by quads, that we always
return finite |
159 * values in the quads. | 159 * values in the quads. |
160 * | 160 * |
161 * Inspired by crbug_627414 | 161 * Inspired by crbug_627414 |
162 */ | 162 */ |
163 static void test_conic_to_quads(skiatest::Reporter* reporter) { | 163 static void test_conic_to_quads(skiatest::Reporter* reporter) { |
164 const SkPoint triples[] = { | 164 const SkPoint triples[] = { |
165 { 0, 0 }, { 1, 0 }, { 1, 1 }, | 165 { 0, 0 }, { 1, 0 }, { 1, 1 }, |
166 { 3.58732e-43f, 2.72084f }, { 3.00392f, 3.00392f }, | 166 { 0, 0 }, { 3.58732e-43f, 2.72084f }, { 3.00392f, 3.00392f }, |
167 { 0, 0 }, { 100000, 0 }, { 100000, 100000 }, | 167 { 0, 0 }, { 100000, 0 }, { 100000, 100000 }, |
168 { 0, 0 }, { 1e30f, 0 }, { 1e30f, 1e30f }, | 168 { 0, 0 }, { 1e30f, 0 }, { 1e30f, 1e30f }, |
169 }; | 169 }; |
170 const int N = sizeof(triples) / sizeof(SkPoint); | 170 const int N = sizeof(triples) / sizeof(SkPoint); |
171 | 171 |
172 for (int i = 0; i < N; i += 3) { | 172 for (int i = 0; i < N; i += 3) { |
173 const SkPoint* pts = &triples[i]; | 173 const SkPoint* pts = &triples[i]; |
174 | 174 |
175 SkRect bounds; | 175 SkRect bounds; |
176 bounds.set(pts, 3); | 176 bounds.set(pts, 3); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 | 228 |
229 testChopCubic(reporter); | 229 testChopCubic(reporter); |
230 test_evalquadat(reporter); | 230 test_evalquadat(reporter); |
231 test_conic(reporter); | 231 test_conic(reporter); |
232 test_cubic_tangents(reporter); | 232 test_cubic_tangents(reporter); |
233 test_quad_tangents(reporter); | 233 test_quad_tangents(reporter); |
234 test_conic_tangents(reporter); | 234 test_conic_tangents(reporter); |
235 test_conic_to_quads(reporter); | 235 test_conic_to_quads(reporter); |
236 } | 236 } |
OLD | NEW |