diff options
author | caryclark <caryclark@google.com> | 2015-03-26 07:52:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-26 07:52:43 -0700 |
commit | 54359294a7c9dc54802d512a5d891a35c1663392 (patch) | |
tree | 7339bbad708bb43a4a96f7b76075c84ff7732189 /gm | |
parent | c08330f1601aeca7f10aeb2194118decbfbf83e1 (diff) |
cumulative pathops patch
Replace the implicit curve intersection with a geometric curve intersection. The implicit intersection proved mathematically unstable and took a long time to zero in on an answer.
Use pointers instead of indices to refer to parts of curves. Indices required awkward renumbering.
Unify t and point values so that small intervals can be eliminated in one pass.
Break cubics up front to eliminate loops and cusps.
Make the Simplify and Op code more regular and eliminate arbitrary differences.
Add a builder that takes an array of paths and operators.
Delete unused code.
BUG=skia:3588
R=reed@google.com
Review URL: https://codereview.chromium.org/1037573004
Diffstat (limited to 'gm')
-rw-r--r-- | gm/pathopsinverse.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gm/pathopsinverse.cpp b/gm/pathopsinverse.cpp index 4b87778619..476eda1991 100644 --- a/gm/pathopsinverse.cpp +++ b/gm/pathopsinverse.cpp @@ -25,11 +25,11 @@ protected: SkColor blendColor = blend(oneColor, twoColor); makePaint(&fOnePaint, oneColor); makePaint(&fTwoPaint, twoColor); - makePaint(&fOpPaint[kDifference_PathOp], oneColor); - makePaint(&fOpPaint[kIntersect_PathOp], blendColor); - makePaint(&fOpPaint[kUnion_PathOp], 0xFFc0FFc0); - makePaint(&fOpPaint[kReverseDifference_PathOp], twoColor); - makePaint(&fOpPaint[kXOR_PathOp], 0xFFa0FFe0); + makePaint(&fOpPaint[kDifference_SkPathOp], oneColor); + makePaint(&fOpPaint[kIntersect_SkPathOp], blendColor); + makePaint(&fOpPaint[kUnion_SkPathOp], 0xFFc0FFc0); + makePaint(&fOpPaint[kReverseDifference_SkPathOp], twoColor); + makePaint(&fOpPaint[kXOR_SkPathOp], 0xFFa0FFe0); makePaint(&fOutlinePaint, 0xFF000000); fOutlinePaint.setStyle(SkPaint::kStroke_Style); } @@ -82,7 +82,7 @@ protected: canvas->drawPath(two, fOutlinePaint); canvas->restore(); int xPos = 150; - for (int op = kDifference_PathOp; op <= kReverseDifference_PathOp; ++op) { + for (int op = kDifference_SkPathOp; op <= kReverseDifference_SkPathOp; ++op) { SkPath result; Op(one, two, (SkPathOp) op, &result); canvas->save(); @@ -102,7 +102,7 @@ private: SkPaint fOnePaint; SkPaint fTwoPaint; SkPaint fOutlinePaint; - SkPaint fOpPaint[kReverseDifference_PathOp - kDifference_PathOp + 1]; + SkPaint fOpPaint[kReverseDifference_SkPathOp - kDifference_SkPathOp + 1]; typedef GM INHERITED; }; |