| Index: src/pathops/SkPathOpsRect.cpp
|
| diff --git a/src/pathops/SkPathOpsRect.cpp b/src/pathops/SkPathOpsRect.cpp
|
| index 540db16a0ee0d1f3a4ba89ed7d23000058e348ff..8c0115353298c039ee9ac1de2e41457764a8fd42 100644
|
| --- a/src/pathops/SkPathOpsRect.cpp
|
| +++ b/src/pathops/SkPathOpsRect.cpp
|
| @@ -10,54 +10,53 @@
|
| #include "SkPathOpsQuad.h"
|
| #include "SkPathOpsRect.h"
|
|
|
| -void SkDRect::setBounds(const SkDQuad& quad) {
|
| - set(quad[0]);
|
| - add(quad[2]);
|
| +void SkDRect::setBounds(const SkDQuad& curve, const SkDQuad& sub, double startT, double endT) {
|
| + set(sub[0]);
|
| + add(sub[2]);
|
| double tValues[2];
|
| int roots = 0;
|
| - if (!between(quad[0].fX, quad[1].fX, quad[2].fX)) {
|
| - roots = SkDQuad::FindExtrema(quad[0].fX, quad[1].fX, quad[2].fX, tValues);
|
| + if (!sub.monotonicInX()) {
|
| + roots = SkDQuad::FindExtrema(&sub[0].fX, tValues);
|
| }
|
| - if (!between(quad[0].fY, quad[1].fY, quad[2].fY)) {
|
| - roots += SkDQuad::FindExtrema(quad[0].fY, quad[1].fY, quad[2].fY, &tValues[roots]);
|
| + if (!sub.monotonicInY()) {
|
| + roots += SkDQuad::FindExtrema(&sub[0].fY, &tValues[roots]);
|
| }
|
| - for (int x = 0; x < roots; ++x) {
|
| - add(quad.ptAtT(tValues[x]));
|
| + for (int index = 0; index < roots; ++index) {
|
| + double t = startT + (endT - startT) * tValues[index];
|
| + add(curve.ptAtT(t));
|
| }
|
| }
|
|
|
| -void SkDRect::setBounds(const SkDConic& conic) {
|
| - set(conic[0]);
|
| - add(conic[2]);
|
| +void SkDRect::setBounds(const SkDConic& curve, const SkDConic& sub, double startT, double endT) {
|
| + set(sub[0]);
|
| + add(sub[2]);
|
| double tValues[2];
|
| int roots = 0;
|
| - if (!between(conic[0].fX, conic[1].fX, conic[2].fX)) {
|
| - roots = SkDConic::FindExtrema(&conic[0].fX, conic.fWeight, tValues);
|
| + if (!sub.monotonicInX()) {
|
| + roots = SkDConic::FindExtrema(&sub[0].fX, sub.fWeight, tValues);
|
| }
|
| - if (!between(conic[0].fY, conic[1].fY, conic[2].fY)) {
|
| - roots += SkDConic::FindExtrema(&conic[0].fY, conic.fWeight, &tValues[roots]);
|
| + if (!sub.monotonicInY()) {
|
| + roots += SkDConic::FindExtrema(&sub[0].fY, sub.fWeight, &tValues[roots]);
|
| }
|
| - for (int x = 0; x < roots; ++x) {
|
| - add(conic.ptAtT(tValues[x]));
|
| + for (int index = 0; index < roots; ++index) {
|
| + double t = startT + (endT - startT) * tValues[index];
|
| + add(curve.ptAtT(t));
|
| }
|
| }
|
|
|
| -static bool is_bounded_by_end_points(double a, double b, double c, double d) {
|
| - return between(a, b, d) && between(a, c, d);
|
| -}
|
| -
|
| -void SkDRect::setBounds(const SkDCubic& c) {
|
| - set(c[0]);
|
| - add(c[3]);
|
| +void SkDRect::setBounds(const SkDCubic& curve, const SkDCubic& sub, double startT, double endT) {
|
| + set(sub[0]);
|
| + add(sub[3]);
|
| double tValues[4];
|
| int roots = 0;
|
| - if (!is_bounded_by_end_points(c[0].fX, c[1].fX, c[2].fX, c[3].fX)) {
|
| - roots = SkDCubic::FindExtrema(c[0].fX, c[1].fX, c[2].fX, c[3].fX, tValues);
|
| + if (!sub.monotonicInX()) {
|
| + roots = SkDCubic::FindExtrema(&sub[0].fX, tValues);
|
| }
|
| - if (!is_bounded_by_end_points(c[0].fY, c[1].fY, c[2].fY, c[3].fY)) {
|
| - roots += SkDCubic::FindExtrema(c[0].fY, c[1].fY, c[2].fY, c[3].fY, &tValues[roots]);
|
| + if (!sub.monotonicInY()) {
|
| + roots += SkDCubic::FindExtrema(&sub[0].fY, &tValues[roots]);
|
| }
|
| - for (int x = 0; x < roots; ++x) {
|
| - add(c.ptAtT(tValues[x]));
|
| + for (int index = 0; index < roots; ++index) {
|
| + double t = startT + (endT - startT) * tValues[index];
|
| + add(curve.ptAtT(t));
|
| }
|
| }
|
|
|