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

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

Issue 2186973002: fuzz wednesday (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add 631992 Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/pathops/SkOpCoincidence.h ('k') | src/pathops/SkOpSpan.h » ('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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 SkASSERT(coinPtTStart->fT < coinPtTEnd->fT); 254 SkASSERT(coinPtTStart->fT < coinPtTEnd->fT);
255 SkASSERT(oppPtTStart->fT != oppPtTEnd->fT); 255 SkASSERT(oppPtTStart->fT != oppPtTEnd->fT);
256 SkASSERT(!coinPtTStart->deleted()); 256 SkASSERT(!coinPtTStart->deleted());
257 SkASSERT(!coinPtTEnd->deleted()); 257 SkASSERT(!coinPtTEnd->deleted());
258 SkASSERT(!oppPtTStart->deleted()); 258 SkASSERT(!oppPtTStart->deleted());
259 SkASSERT(!oppPtTEnd->deleted()); 259 SkASSERT(!oppPtTEnd->deleted());
260 DebugCheckAdd(fHead, coinPtTStart, coinPtTEnd, oppPtTStart, oppPtTEnd); 260 DebugCheckAdd(fHead, coinPtTStart, coinPtTEnd, oppPtTStart, oppPtTEnd);
261 DebugCheckAdd(fTop, coinPtTStart, coinPtTEnd, oppPtTStart, oppPtTEnd); 261 DebugCheckAdd(fTop, coinPtTStart, coinPtTEnd, oppPtTStart, oppPtTEnd);
262 SkCoincidentSpans* coinRec = SkOpTAllocator<SkCoincidentSpans>::Allocate( 262 SkCoincidentSpans* coinRec = SkOpTAllocator<SkCoincidentSpans>::Allocate(
263 this->globalState()->allocator()); 263 this->globalState()->allocator());
264 coinRec->init(); 264 coinRec->init(SkDEBUGCODE(fGlobalState));
265 coinRec->set(this->fHead, coinPtTStart, coinPtTEnd, oppPtTStart, oppPtTEnd 265 coinRec->set(this->fHead, coinPtTStart, coinPtTEnd, oppPtTStart, oppPtTEnd
266 SkDEBUGPARAMS(fGlobalState->nextCoinID())); 266 SkDEBUGPARAMS(fGlobalState->nextCoinID()));
267 fHead = coinRec; 267 fHead = coinRec;
268 } 268 }
269 269
270 // description below 270 // description below
271 bool SkOpCoincidence::addEndMovedSpans(const SkOpSpan* base, const SkOpSpanBase* testSpan) { 271 bool SkOpCoincidence::addEndMovedSpans(const SkOpSpan* base, const SkOpSpanBase* testSpan) {
272 const SkOpPtT* testPtT = testSpan->ptT(); 272 const SkOpPtT* testPtT = testSpan->ptT();
273 const SkOpPtT* stopPtT = testPtT; 273 const SkOpPtT* stopPtT = testPtT;
274 const SkOpSegment* baseSeg = base->segment(); 274 const SkOpSegment* baseSeg = base->segment();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 if (!this->addOrOverlap(coinSeg, oppSeg, coinTs, coinTe, oppTs, oppT e)) { 327 if (!this->addOrOverlap(coinSeg, oppSeg, coinTs, coinTe, oppTs, oppT e)) {
328 return false; 328 return false;
329 } 329 }
330 } 330 }
331 } 331 }
332 return true; 332 return true;
333 } 333 }
334 334
335 // description below 335 // description below
336 bool SkOpCoincidence::addEndMovedSpans(const SkOpPtT* ptT) { 336 bool SkOpCoincidence::addEndMovedSpans(const SkOpPtT* ptT) {
337 if (!ptT->span()->upCastable()) {
338 return false;
339 }
337 const SkOpSpan* base = ptT->span()->upCast(); 340 const SkOpSpan* base = ptT->span()->upCast();
338 const SkOpSpan* prev = base->prev(); 341 const SkOpSpan* prev = base->prev();
339 if (!prev) { 342 if (!prev) {
340 return false; 343 return false;
341 } 344 }
342 if (!prev->isCanceled()) { 345 if (!prev->isCanceled()) {
343 if (!this->addEndMovedSpans(base, base->prev())) { 346 if (!this->addEndMovedSpans(base, base->prev())) {
344 return false; 347 return false;
345 } 348 }
346 } 349 }
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 } 1364 }
1362 /* coin and opp spans may not match up. Mark the ends, and then let the interior 1365 /* coin and opp spans may not match up. Mark the ends, and then let the interior
1363 get marked as many times as the spans allow */ 1366 get marked as many times as the spans allow */
1364 start->insertCoincidence(oStart->upCast()); 1367 start->insertCoincidence(oStart->upCast());
1365 end->insertCoinEnd(oEnd); 1368 end->insertCoinEnd(oEnd);
1366 const SkOpSegment* segment = start->segment(); 1369 const SkOpSegment* segment = start->segment();
1367 const SkOpSegment* oSegment = oStart->segment(); 1370 const SkOpSegment* oSegment = oStart->segment();
1368 SkOpSpanBase* next = start; 1371 SkOpSpanBase* next = start;
1369 SkOpSpanBase* oNext = oStart; 1372 SkOpSpanBase* oNext = oStart;
1370 while ((next = next->upCast()->next()) != end) { 1373 while ((next = next->upCast()->next()) != end) {
1374 if (!next->upCastable()) {
1375 return false;
1376 }
1371 if (!next->upCast()->insertCoincidence(oSegment, flipped)) { 1377 if (!next->upCast()->insertCoincidence(oSegment, flipped)) {
1372 return false; 1378 return false;
1373 } 1379 }
1374 } 1380 }
1375 while ((oNext = oNext->upCast()->next()) != oEnd) { 1381 while ((oNext = oNext->upCast()->next()) != oEnd) {
1376 if (!oNext->upCast()->insertCoincidence(segment, flipped)) { 1382 if (!oNext->upCast()->insertCoincidence(segment, flipped)) {
1377 return false; 1383 return false;
1378 } 1384 }
1379 } 1385 }
1380 } while ((coin = coin->next())); 1386 } while ((coin = coin->next()));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 this->release(fHead, coin); 1455 this->release(fHead, coin);
1450 } 1456 }
1451 } while ((coin = coin->next())); 1457 } while ((coin = coin->next()));
1452 } 1458 }
1453 1459
1454 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS, 1460 bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const S kOpPtT* testS,
1455 const SkOpPtT* testE) const { 1461 const SkOpPtT* testE) const {
1456 return testS->segment()->testForCoincidence(testS, testE, testS->span(), 1462 return testS->segment()->testForCoincidence(testS, testE, testS->span(),
1457 testE->span(), outer->coinPtTStart()->segment()); 1463 testE->span(), outer->coinPtTStart()->segment());
1458 } 1464 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpCoincidence.h ('k') | src/pathops/SkOpSpan.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698