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

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

Issue 1507803002: fix coincident fuzzer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | src/pathops/SkOpSegment.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "SkOpCoincidence.h" 7 #include "SkOpCoincidence.h"
8 #include "SkOpSegment.h" 8 #include "SkOpSegment.h"
9 #include "SkPathOpsTSect.h" 9 #include "SkPathOpsTSect.h"
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return false; 103 return false;
104 } 104 }
105 double oStartPart = (oTest->t() - oStartPtT->fT) / oStartRange; 105 double oStartPart = (oTest->t() - oStartPtT->fT) / oStartRange;
106 if (startPart == oStartPart) { 106 if (startPart == oStartPart) {
107 return false; 107 return false;
108 } 108 }
109 SkOpPtT* newPt; 109 SkOpPtT* newPt;
110 if (startPart < oStartPart) { 110 if (startPart < oStartPart) {
111 double newT = oStartPtT->fT + oStartRange * startPart; 111 double newT = oStartPtT->fT + oStartRange * startPart;
112 newPt = oStart->segment()->addT(newT, SkOpSegment::kAllowAli as, allocator); 112 newPt = oStart->segment()->addT(newT, SkOpSegment::kAllowAli as, allocator);
113 if (!newPt) {
114 return false;
115 }
113 newPt->fPt = test->pt(); 116 newPt->fPt = test->pt();
114 test->ptT()->addOpp(newPt); 117 test->ptT()->addOpp(newPt);
115 } else { 118 } else {
116 double newT = startPtT->fT + startRange * oStartPart; 119 double newT = startPtT->fT + startRange * oStartPart;
117 newPt = start->segment()->addT(newT, SkOpSegment::kAllowAlia s, allocator); 120 newPt = start->segment()->addT(newT, SkOpSegment::kAllowAlia s, allocator);
121 if (!newPt) {
122 return false;
123 }
118 newPt->fPt = oTest->pt(); 124 newPt->fPt = oTest->pt();
119 oTest->ptT()->addOpp(newPt); 125 oTest->ptT()->addOpp(newPt);
120 } 126 }
121 // start over 127 // start over
122 test = start; 128 test = start;
123 oTest = oStart; 129 oTest = oStart;
124 } 130 }
125 if (test != end) { 131 if (test != end) {
126 test = test->upCast()->next(); 132 test = test->upCast()->next();
127 } 133 }
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f T)); 673 *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->f T));
668 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f T)); 674 *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->f T));
669 return *overS < *overE; 675 return *overS < *overE;
670 } 676 }
671 677
672 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS, 678 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS,
673 const SkOpPtT* testE) const { 679 const SkOpPtT* testE) const {
674 return testS->segment()->testForCoincidence(testS, testE, testS->span(), 680 return testS->segment()->testForCoincidence(testS, testE, testS->span(),
675 testE->span(), outer->fCoinPtTStart->segment(), 120000); // FIXME: replace with tuned 681 testE->span(), outer->fCoinPtTStart->segment(), 120000); // FIXME: replace with tuned
676 } 682 }
OLDNEW
« no previous file with comments | « no previous file | src/pathops/SkOpSegment.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698