caryclark@google.com | 9e49fb6 | 2012-08-27 14:11:33 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
caryclark@google.com | c682590 | 2012-02-03 22:07:47 +0000 | [diff] [blame] | 7 | #include "CurveIntersection.h" |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 8 | #include "CubicIntersection_TestData.h" |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame] | 9 | #include "Intersection_Tests.h" |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 10 | |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame] | 11 | void CubicBezierClip_Test() { |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 12 | for (size_t index = 0; index < tests_count; ++index) { |
| 13 | const Cubic& cubic1 = tests[index][0]; |
| 14 | const Cubic& cubic2 = tests[index][1]; |
| 15 | Cubic reduce1, reduce2; |
| 16 | int order1 = reduceOrder(cubic1, reduce1, kReduceOrder_NoQuadraticsAllowed); |
| 17 | int order2 = reduceOrder(cubic2, reduce2, kReduceOrder_NoQuadraticsAllowed); |
| 18 | if (order1 < 4) { |
caryclark@google.com | aa35831 | 2013-01-29 20:28:49 +0000 | [diff] [blame^] | 19 | SkDebugf("%s [%d] cubic1 order=%d\n", __FUNCTION__, (int) index, order1); |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 20 | } |
| 21 | if (order2 < 4) { |
caryclark@google.com | aa35831 | 2013-01-29 20:28:49 +0000 | [diff] [blame^] | 22 | SkDebugf("%s [%d] cubic2 order=%d\n", __FUNCTION__, (int) index, order2); |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 23 | } |
| 24 | if (order1 == 4 && order2 == 4) { |
| 25 | double minT = 0; |
| 26 | double maxT = 1; |
| 27 | bezier_clip(reduce1, reduce2, minT, maxT); |
| 28 | } |
| 29 | } |
| 30 | } |