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

Unified Diff: src/pathops/SkOpEdgeBuilder.cpp

Issue 13851015: path ops : fix empty-diff bug, op-in-place (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | « no previous file | src/pathops/SkPathOpsOp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkOpEdgeBuilder.cpp
===================================================================
--- src/pathops/SkOpEdgeBuilder.cpp (revision 8822)
+++ src/pathops/SkOpEdgeBuilder.cpp (working copy)
@@ -53,9 +53,13 @@
fExtra.reset(); // we're done with this
}
-// FIXME:remove once we can access path pts directly
+// Note that copying the points here avoids copying the resulting path later.
+// To allow Op() to take one of the input paths as an output parameter, either the source data
+// must be copied (as implemented below) or the result must be copied.
+// OPTIMIZATION: This copies both sets of input points every time. If the input data was read
+// directly, the output path would only need to be copied if it was also one of the input paths.
int SkOpEdgeBuilder::preFetch() {
- SkPath::RawIter iter(*fPath); // FIXME: access path directly when allowed
+ SkPath::RawIter iter(*fPath);
SkPoint pts[4];
SkPath::Verb verb;
do {
@@ -78,7 +82,11 @@
const SkPoint* finalCurveStart = NULL;
const SkPoint* finalCurveEnd = NULL;
SkPath::Verb verb;
- while ((verb = (SkPath::Verb) *verbPtr++) != SkPath::kDone_Verb) {
+ while ((verb = (SkPath::Verb) *verbPtr) != SkPath::kDone_Verb) {
+ if (verbPtr == endOfFirstHalf) {
+ fOperand = true;
+ }
+ verbPtr++;
switch (verb) {
case SkPath::kMove_Verb:
complete();
@@ -89,7 +97,7 @@
*fExtra.append() = -1; // start new contour
}
finalCurveEnd = pointsPtr++;
- goto nextVerb;
+ continue;
case SkPath::kLine_Verb:
// skip degenerate points
if (pointsPtr[-1].fX != pointsPtr[0].fX || pointsPtr[-1].fY != pointsPtr[0].fY) {
@@ -132,7 +140,7 @@
*fExtra.append() = fCurrentContour->addLine(fReducePts.end() - 2);
}
complete();
- goto nextVerb;
+ continue;
default:
SkDEBUGFAIL("bad verb");
return;
@@ -140,9 +148,5 @@
finalCurveStart = &pointsPtr[verb - 1];
pointsPtr += verb;
SkASSERT(fCurrentContour);
- nextVerb:
- if (verbPtr == endOfFirstHalf) {
- fOperand = true;
- }
}
}
« no previous file with comments | « no previous file | src/pathops/SkPathOpsOp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698