minor fixes to cubics code and overall alignment of how bounds and tops are computed for all curve types
All but 17 extended tests work.
A helper function is privately added to SkPath.h to permit a test to modify a given point in a path.
BUG=skia:3588
Review URL: https://codereview.chromium.org/1107353004
diff --git a/tests/PathOpsTestCommon.cpp b/tests/PathOpsTestCommon.cpp
index d933115..f685225 100644
--- a/tests/PathOpsTestCommon.cpp
+++ b/tests/PathOpsTestCommon.cpp
@@ -141,8 +141,20 @@
double tStart = 0;
for (int i1 = 0; i1 <= ts.count(); ++i1) {
const double tEnd = i1 < ts.count() ? ts[i1] : 1;
+ SkDRect bounds;
+ bounds.setBounds(cubic);
SkDCubic part = cubic.subDivide(tStart, tEnd);
SkDQuad quad = part.toQuad();
+ if (quad[1].fX < bounds.fLeft) {
+ quad[1].fX = bounds.fLeft;
+ } else if (quad[1].fX > bounds.fRight) {
+ quad[1].fX = bounds.fRight;
+ }
+ if (quad[1].fY < bounds.fTop) {
+ quad[1].fY = bounds.fTop;
+ } else if (quad[1].fY > bounds.fBottom) {
+ quad[1].fY = bounds.fBottom;
+ }
quads.push_back(quad);
tStart = tEnd;
}