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

Unified Diff: include/pathops/SkPathOps.h

Issue 1002693002: pathops version two (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix arm 64 inspired coincident handling Created 5 years, 9 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 | « gyp/pathops_unittest.gypi ('k') | src/pathops/SkAddIntersections.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/pathops/SkPathOps.h
diff --git a/include/pathops/SkPathOps.h b/include/pathops/SkPathOps.h
index ba18f4ba72f50738e4d7f09618db2db3e6c5ba80..3ec935160632116c99ad5a268342ff6f05886ece 100644
--- a/include/pathops/SkPathOps.h
+++ b/include/pathops/SkPathOps.h
@@ -8,6 +8,8 @@
#define SkPathOps_DEFINED
#include "SkPreConfig.h"
+#include "SkTArray.h"
+#include "SkTDArray.h"
class SkPath;
struct SkRect;
@@ -35,9 +37,10 @@ enum SkPathOp {
@param one The first operand (for difference, the minuend)
@param two The second operand (for difference, the subtrahend)
+ @param op The operator to apply.
@param result The product of the operands. The result may be one of the
inputs.
- @return True if operation succeeded.
+ @return True if the operation succeeded.
*/
bool SK_API Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result);
@@ -63,4 +66,31 @@ bool SK_API Simplify(const SkPath& path, SkPath* result);
*/
bool SK_API TightBounds(const SkPath& path, SkRect* result);
+/** Perform a series of path operations, optimized for unioning many paths together.
+ */
+class SK_API SkOpBuilder {
+public:
+ /** Add one or more paths and their operand. The builder is empty before the first
+ path is added, so the result of a single add is (emptyPath OP path).
+
+ @param path The second operand.
+ @param op The operator to apply to the existing and supplied paths.
+ */
+ void add(const SkPath& path, SkPathOp op);
+
+ /** Computes the sum of all paths and operands, and resets the builder to its
+ initial state.
+
+ @param result The product of the operands.
+ @return True if the operation succeeded.
+ */
+ bool resolve(SkPath* result);
+
+private:
+ SkTArray<SkPath> fPathRefs;
+ SkTDArray<SkPathOp> fOps;
+
+ void reset();
+};
+
#endif
« no previous file with comments | « gyp/pathops_unittest.gypi ('k') | src/pathops/SkAddIntersections.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698