Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1004)

Unified Diff: src/pathops/SkPathWriter.h

Issue 2321973005: Rewriting path writer (Closed)
Patch Set: revert unneeded test changes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pathops/SkPathOpsTightBounds.cpp ('k') | src/pathops/SkPathWriter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathWriter.h
diff --git a/src/pathops/SkPathWriter.h b/src/pathops/SkPathWriter.h
index 820ddc52b6f366e4633ec42c73fdb7e36979e735..bd13c718a90f3c2808b95d037c02832b17aff4c5 100644
--- a/src/pathops/SkPathWriter.h
+++ b/src/pathops/SkPathWriter.h
@@ -8,38 +8,47 @@
#define SkPathWriter_DEFINED
#include "SkPath.h"
+#include "SkTArray.h"
+#include "SkTDArray.h"
+
+class SkOpPtT;
+
+// Construct the path one contour at a time.
+// If the contour is closed, copy it to the final output.
+// Otherwise, keep the partial contour for later assembly.
class SkPathWriter {
public:
SkPathWriter(SkPath& path);
- void close();
- void conicTo(const SkPoint& pt1, const SkPoint& pt2, SkScalar weight);
- void cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkPoint& pt3);
- void deferredLine(const SkPoint& pt);
- void deferredMove(const SkPoint& pt);
- void deferredMoveLine(const SkPoint& pt);
- bool hasMove() const;
+ void assemble();
+ void conicTo(const SkPoint& pt1, const SkOpPtT* pt2, SkScalar weight);
+ void cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkOpPtT* pt3);
+ void deferredLine(const SkOpPtT* pt);
+ void deferredMove(const SkOpPtT* pt);
+ void finishContour();
+ bool hasMove() const { return !fFirstPtT; }
void init();
bool isClosed() const;
- bool isEmpty() const { return fEmpty; }
- void lineTo();
- const SkPath* nativePath() const;
- void nudge();
- void quadTo(const SkPoint& pt1, const SkPoint& pt2);
- bool someAssemblyRequired() const;
+ const SkPath* nativePath() const { return fPathPtr; }
+ void quadTo(const SkPoint& pt1, const SkOpPtT* pt2);
private:
- bool changedSlopes(const SkPoint& pt) const;
+ bool changedSlopes(const SkOpPtT* pt) const;
+ void close();
+ const SkTDArray<const SkOpPtT*>& endPtTs() const { return fEndPtTs; }
+ void lineTo();
+ bool matchedLast(const SkOpPtT*) const;
void moveTo();
+ const SkTArray<SkPath>& partials() const { return fPartials; }
+ bool someAssemblyRequired();
+ void update(const SkOpPtT* pt);
- SkPath* fPathPtr;
- SkPoint fDefer[2];
- SkPoint fFirstPt;
- int fCloses;
- int fMoves;
- bool fEmpty;
- bool fHasMove;
- bool fMoved;
+ SkPath fCurrent; // contour under construction
+ SkTArray<SkPath> fPartials; // contours with mismatched starts and ends
+ SkTDArray<const SkOpPtT*> fEndPtTs; // possible pt values for partial starts and ends
+ SkPath* fPathPtr; // closed contours are written here
+ const SkOpPtT* fDefer[2]; // [0] deferred move, [1] deferred line
+ const SkOpPtT* fFirstPtT; // first in current contour
};
#endif /* defined(__PathOps__SkPathWriter__) */
« no previous file with comments | « src/pathops/SkPathOpsTightBounds.cpp ('k') | src/pathops/SkPathWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698