OLD | NEW |
(Empty) | |
| 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 */ |
| 7 #include "PathOpsTestCommon.h" |
| 8 #include "SkPathOpsCubic.h" |
| 9 |
| 10 void CubicToQuads(const SkDCubic& cubic, double precision, SkTDArray<SkDQuad>& q
uads) { |
| 11 SkTDArray<double> ts; |
| 12 cubic.toQuadraticTs(precision, &ts); |
| 13 if (ts.count() <= 1) { |
| 14 SkDQuad quad = cubic.toQuad(); |
| 15 *quads.append() = quad; |
| 16 return; |
| 17 } |
| 18 double tStart = 0; |
| 19 for (int i1 = 0; i1 <= ts.count(); ++i1) { |
| 20 const double tEnd = i1 < ts.count() ? ts[i1] : 1; |
| 21 SkDCubic part = cubic.subDivide(tStart, tEnd); |
| 22 SkDQuad quad = part.toQuad(); |
| 23 *quads.append() = quad; |
| 24 tStart = tEnd; |
| 25 } |
| 26 } |
| 27 |
OLD | NEW |