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

Side by Side Diff: src/pathops/SkAddIntersections.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 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 2012 Google Inc. 2 * Copyright 2012 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 "SkAddIntersections.h" 7 #include "SkAddIntersections.h"
8 #include "SkPathOpsBounds.h" 8 #include "SkPathOpsBounds.h"
9 9
10 #if DEBUG_ADD_INTERSECTING_TS 10 #if DEBUG_ADD_INTERSECTING_TS
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 ts.cleanUpCoincidence(); // prefer (t == 0 or t == 1) 390 ts.cleanUpCoincidence(); // prefer (t == 0 or t == 1)
391 pts = 1; 391 pts = 1;
392 } 392 }
393 } 393 }
394 } 394 }
395 } 395 }
396 for (int pt = 0; pt < pts; ++pt) { 396 for (int pt = 0; pt < pts; ++pt) {
397 SkASSERT(ts[0][pt] >= 0 && ts[0][pt] <= 1); 397 SkASSERT(ts[0][pt] >= 0 && ts[0][pt] <= 1);
398 SkASSERT(ts[1][pt] >= 0 && ts[1][pt] <= 1); 398 SkASSERT(ts[1][pt] >= 0 && ts[1][pt] <= 1);
399 SkPoint point = ts.pt(pt).asSkPoint(); 399 SkPoint point = ts.pt(pt).asSkPoint();
400 int testTAt = wt.addT(wn, point, ts[swap][pt], swap && ts.isNear (pt)); 400 int testTAt = wt.addT(wn, point, ts[swap][pt]);
401 int nextTAt = wn.addT(wt, point, ts[!swap][pt], !swap && ts.isNe ar(pt)); 401 int nextTAt = wn.addT(wt, point, ts[!swap][pt]);
402 wt.addOtherT(testTAt, ts[!swap][pt], nextTAt); 402 wt.addOtherT(testTAt, ts[!swap][pt], nextTAt);
403 wn.addOtherT(nextTAt, ts[swap][pt], testTAt); 403 wn.addOtherT(nextTAt, ts[swap][pt], testTAt);
404 } 404 }
405 } while (wn.advance()); 405 } while (wn.advance());
406 } while (wt.advance()); 406 } while (wt.advance());
407 return true; 407 return true;
408 } 408 }
409 409
410 void AddSelfIntersectTs(SkOpContour* test) { 410 void AddSelfIntersectTs(SkOpContour* test) {
411 SkIntersectionHelper wt; 411 SkIntersectionHelper wt;
412 wt.init(test); 412 wt.init(test);
413 do { 413 do {
414 if (wt.segmentType() != SkIntersectionHelper::kCubic_Segment) { 414 if (wt.segmentType() != SkIntersectionHelper::kCubic_Segment) {
415 continue; 415 continue;
416 } 416 }
417 SkIntersections ts; 417 SkIntersections ts;
418 int pts = ts.cubic(wt.pts()); 418 int pts = ts.cubic(wt.pts());
419 debugShowCubicIntersection(pts, wt, ts); 419 debugShowCubicIntersection(pts, wt, ts);
420 if (!pts) { 420 if (!pts) {
421 continue; 421 continue;
422 } 422 }
423 SkASSERT(pts == 1); 423 SkASSERT(pts == 1);
424 SkASSERT(ts[0][0] >= 0 && ts[0][0] <= 1); 424 SkASSERT(ts[0][0] >= 0 && ts[0][0] <= 1);
425 SkASSERT(ts[1][0] >= 0 && ts[1][0] <= 1); 425 SkASSERT(ts[1][0] >= 0 && ts[1][0] <= 1);
426 SkPoint point = ts.pt(0).asSkPoint(); 426 SkPoint point = ts.pt(0).asSkPoint();
427 int testTAt = wt.addSelfT(wt, point, ts[0][0]); 427 int testTAt = wt.addSelfT(wt, point, ts[0][0]);
428 int nextTAt = wt.addT(wt, point, ts[1][0], ts.isNear(0)); 428 int nextTAt = wt.addT(wt, point, ts[1][0]);
429 wt.addOtherT(testTAt, ts[1][0], nextTAt); 429 wt.addOtherT(testTAt, ts[1][0], nextTAt);
430 wt.addOtherT(nextTAt, ts[0][0], testTAt); 430 wt.addOtherT(nextTAt, ts[0][0], testTAt);
431 } while (wt.advance()); 431 } while (wt.advance());
432 } 432 }
433 433
434 // resolve any coincident pairs found while intersecting, and 434 // resolve any coincident pairs found while intersecting, and
435 // see if coincidence is formed by clipping non-concident segments 435 // see if coincidence is formed by clipping non-concident segments
436 void CoincidenceCheck(SkTArray<SkOpContour*, true>* contourList, int total) { 436 void CoincidenceCheck(SkTArray<SkOpContour*, true>* contourList, int total) {
437 int contourCount = (*contourList).count(); 437 int contourCount = (*contourList).count();
438 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { 438 for (int cIndex = 0; cIndex < contourCount; ++cIndex) {
439 SkOpContour* contour = (*contourList)[cIndex]; 439 SkOpContour* contour = (*contourList)[cIndex];
440 contour->addCoincidentPoints(); 440 contour->addCoincidentPoints();
441 } 441 }
442 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { 442 for (int cIndex = 0; cIndex < contourCount; ++cIndex) {
443 SkOpContour* contour = (*contourList)[cIndex]; 443 SkOpContour* contour = (*contourList)[cIndex];
444 contour->calcCoincidentWinding(); 444 contour->calcCoincidentWinding();
445 } 445 }
446 for (int cIndex = 0; cIndex < contourCount; ++cIndex) { 446 for (int cIndex = 0; cIndex < contourCount; ++cIndex) {
447 SkOpContour* contour = (*contourList)[cIndex]; 447 SkOpContour* contour = (*contourList)[cIndex];
448 contour->calcPartialCoincidentWinding(); 448 contour->calcPartialCoincidentWinding();
449 } 449 }
450 } 450 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698