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

Side by Side Diff: src/pathops/SkOpContour.cpp

Issue 75453003: optimize pathops coverage (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove unused code now that testing is complete Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SkIntersections.h" 7 #include "SkIntersections.h"
8 #include "SkOpContour.h" 8 #include "SkOpContour.h"
9 #include "SkPathWriter.h" 9 #include "SkPathWriter.h"
10 #include "SkTSort.h" 10 #include "SkTSort.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 SkTSwap<double>(startT, endT); 205 SkTSwap<double>(startT, endT);
206 SkTSwap<double>(oStartT, oEndT); 206 SkTSwap<double>(oStartT, oEndT);
207 } 207 }
208 bool cancel = swapOther != swapStart; 208 bool cancel = swapOther != swapStart;
209 int step = swapStart ? -1 : 1; 209 int step = swapStart ? -1 : 1;
210 int oStep = swapOther ? -1 : 1; 210 int oStep = swapOther ? -1 : 1;
211 double oMatchStart = cancel ? oEndT : oStartT; 211 double oMatchStart = cancel ? oEndT : oStartT;
212 if (partial ? startT != 0 || oMatchStart != 0 : (startT == 0) != (oMatch Start == 0)) { 212 if (partial ? startT != 0 || oMatchStart != 0 : (startT == 0) != (oMatch Start == 0)) {
213 bool added = false; 213 bool added = false;
214 if (oMatchStart != 0) { 214 if (oMatchStart != 0) {
215 added = thisOne.joinCoincidence(false, &other, oMatchStart, oSte p, cancel); 215 added = thisOne.joinCoincidence(&other, oMatchStart, oStep, canc el);
216 } 216 }
217 if (startT != 0 && !added) { 217 if (!cancel && startT != 0 && !added) {
218 (void) other.joinCoincidence(cancel, &thisOne, startT, step, can cel); 218 (void) other.joinCoincidence(&thisOne, startT, step, cancel);
219 } 219 }
220 } 220 }
221 double oMatchEnd = cancel ? oStartT : oEndT; 221 double oMatchEnd = cancel ? oStartT : oEndT;
222 if (partial ? endT != 1 || oMatchEnd != 1 : (endT == 1) != (oMatchEnd == 1)) { 222 if (partial ? endT != 1 || oMatchEnd != 1 : (endT == 1) != (oMatchEnd == 1)) {
223 bool added = false; 223 bool added = false;
224 if (oMatchEnd != 1) { 224 if (cancel && endT != 1 && !added) {
225 added = thisOne.joinCoincidence(true, &other, oMatchEnd, -oStep, cancel); 225 (void) other.joinCoincidence(&thisOne, endT, -step, cancel);
226 }
227 if (endT != 1 && !added) {
228 (void) other.joinCoincidence(!cancel, &thisOne, endT, -step, can cel);
229 } 226 }
230 } 227 }
231 } 228 }
232 } 229 }
233 230
234 void SkOpContour::calcCommonCoincidentWinding(const SkCoincidence& coincidence) { 231 void SkOpContour::calcCommonCoincidentWinding(const SkCoincidence& coincidence) {
235 int thisIndex = coincidence.fSegments[0]; 232 int thisIndex = coincidence.fSegments[0];
236 SkOpSegment& thisOne = fSegments[thisIndex]; 233 SkOpSegment& thisOne = fSegments[thisIndex];
237 if (thisOne.done()) { 234 if (thisOne.done()) {
238 return; 235 return;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 SkDebugf("%s empty contour\n", __FUNCTION__); 379 SkDebugf("%s empty contour\n", __FUNCTION__);
383 SkASSERT(0); 380 SkASSERT(0);
384 // FIXME: delete empty contour? 381 // FIXME: delete empty contour?
385 return; 382 return;
386 } 383 }
387 fBounds = fSegments.front().bounds(); 384 fBounds = fSegments.front().bounds();
388 for (int index = 1; index < count; ++index) { 385 for (int index = 1; index < count; ++index) {
389 fBounds.add(fSegments[index].bounds()); 386 fBounds.add(fSegments[index].bounds());
390 } 387 }
391 } 388 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698