aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkOpEdgeBuilder.h
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-03-26 07:52:43 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-26 07:52:43 -0700
commit54359294a7c9dc54802d512a5d891a35c1663392 (patch)
tree7339bbad708bb43a4a96f7b76075c84ff7732189 /src/pathops/SkOpEdgeBuilder.h
parentc08330f1601aeca7f10aeb2194118decbfbf83e1 (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 'src/pathops/SkOpEdgeBuilder.h')
-rw-r--r--src/pathops/SkOpEdgeBuilder.h39
1 files changed, 26 insertions, 13 deletions
diff --git a/src/pathops/SkOpEdgeBuilder.h b/src/pathops/SkOpEdgeBuilder.h
index fd0744572d..3ecc915833 100644
--- a/src/pathops/SkOpEdgeBuilder.h
+++ b/src/pathops/SkOpEdgeBuilder.h
@@ -9,20 +9,25 @@
#include "SkOpContour.h"
#include "SkPathWriter.h"
-#include "SkTArray.h"
class SkOpEdgeBuilder {
public:
- SkOpEdgeBuilder(const SkPathWriter& path, SkTArray<SkOpContour>& contours)
- : fPath(path.nativePath())
- , fContours(contours)
+ SkOpEdgeBuilder(const SkPathWriter& path, SkOpContour* contours2, SkChunkAlloc* allocator,
+ SkOpGlobalState* globalState)
+ : fAllocator(allocator) // FIXME: replace with const, tune this
+ , fGlobalState(globalState)
+ , fPath(path.nativePath())
+ , fContoursHead(contours2)
, fAllowOpenContours(true) {
init();
}
- SkOpEdgeBuilder(const SkPath& path, SkTArray<SkOpContour>& contours)
- : fPath(&path)
- , fContours(contours)
+ SkOpEdgeBuilder(const SkPath& path, SkOpContour* contours2, SkChunkAlloc* allocator,
+ SkOpGlobalState* globalState)
+ : fAllocator(allocator)
+ , fGlobalState(globalState)
+ , fPath(&path)
+ , fContoursHead(contours2)
, fAllowOpenContours(false) {
init();
}
@@ -30,13 +35,19 @@ public:
void addOperand(const SkPath& path);
void complete() {
- if (fCurrentContour && fCurrentContour->segments().count()) {
+ if (fCurrentContour && fCurrentContour->count()) {
fCurrentContour->complete();
fCurrentContour = NULL;
}
}
- bool finish();
+ int count() const;
+ bool finish(SkChunkAlloc* );
+
+ const SkOpContour* head() const {
+ return fContoursHead;
+ }
+
void init();
bool unparseable() const { return fUnparseable; }
SkPathOpsMask xorMask() const { return fXorMask[fOperand]; }
@@ -45,13 +56,15 @@ private:
void closeContour(const SkPoint& curveEnd, const SkPoint& curveStart);
bool close();
int preFetch();
- bool walk();
+ bool walk(SkChunkAlloc* );
+ SkChunkAlloc* fAllocator;
+ SkOpGlobalState* fGlobalState;
const SkPath* fPath;
- SkTArray<SkPoint, true> fPathPts;
- SkTArray<uint8_t, true> fPathVerbs;
+ SkTDArray<SkPoint> fPathPts;
+ SkTDArray<uint8_t> fPathVerbs;
SkOpContour* fCurrentContour;
- SkTArray<SkOpContour>& fContours;
+ SkOpContour* fContoursHead;
SkPathOpsMask fXorMask[2];
int fSecondHalf;
bool fOperand;