blob: 9133980f58d7eaa0850924062dbb510fa9030238 [file] [log] [blame]
caryclark@google.com9e49fb62012-08-27 14:11:33 +00001/*
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.comc6825902012-02-03 22:07:47 +00007#include "CurveIntersection.h"
caryclark@google.com639df892012-01-10 21:46:10 +00008#include "CubicIntersection_TestData.h"
caryclark@google.com27accef2012-01-25 18:57:23 +00009#include "Intersection_Tests.h"
caryclark@google.com639df892012-01-10 21:46:10 +000010
caryclark@google.com27accef2012-01-25 18:57:23 +000011void CubicBezierClip_Test() {
caryclark@google.com639df892012-01-10 21:46:10 +000012 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;
caryclark@google.com47d73da2013-02-17 01:41:25 +000016 int order1 = reduceOrder(cubic1, reduce1, kReduceOrder_NoQuadraticsAllowed,
17 kReduceOrder_TreatAsFill);
18 int order2 = reduceOrder(cubic2, reduce2, kReduceOrder_NoQuadraticsAllowed,
19 kReduceOrder_TreatAsFill);
caryclark@google.com639df892012-01-10 21:46:10 +000020 if (order1 < 4) {
caryclark@google.comaa358312013-01-29 20:28:49 +000021 SkDebugf("%s [%d] cubic1 order=%d\n", __FUNCTION__, (int) index, order1);
caryclark@google.com639df892012-01-10 21:46:10 +000022 }
23 if (order2 < 4) {
caryclark@google.comaa358312013-01-29 20:28:49 +000024 SkDebugf("%s [%d] cubic2 order=%d\n", __FUNCTION__, (int) index, order2);
caryclark@google.com639df892012-01-10 21:46:10 +000025 }
26 if (order1 == 4 && order2 == 4) {
27 double minT = 0;
28 double maxT = 1;
29 bezier_clip(reduce1, reduce2, minT, maxT);
30 }
31 }
32}