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

Unified Diff: src/pathops/SkOpCoincidence.cpp

Issue 1140813002: deal more consistently with unsortable edges (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix linux warning Created 5 years, 7 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 | « src/pathops/SkOpCoincidence.h ('k') | src/pathops/SkOpSegment.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkOpCoincidence.cpp
diff --git a/src/pathops/SkOpCoincidence.cpp b/src/pathops/SkOpCoincidence.cpp
index 4251d9fcd8153fcb545eedb20d6044883fa76855..ed195641bf20352130ec7199df58797b3f63ab92 100755
--- a/src/pathops/SkOpCoincidence.cpp
+++ b/src/pathops/SkOpCoincidence.cpp
@@ -8,6 +8,38 @@
#include "SkOpSegment.h"
#include "SkPathOpsTSect.h"
+bool SkOpCoincidence::extend(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart,
+ SkOpPtT* oppPtTEnd) {
+ // if there is an existing pair that overlaps the addition, extend it
+ SkCoincidentSpans* coinRec = fHead;
+ if (coinRec) {
+ do {
+ if (coinRec->fCoinPtTStart->segment() != coinPtTStart->segment()) {
+ continue;
+ }
+ if (coinRec->fOppPtTStart->segment() != oppPtTStart->segment()) {
+ continue;
+ }
+ if (coinRec->fCoinPtTStart->fT > coinPtTEnd->fT) {
+ continue;
+ }
+ if (coinRec->fCoinPtTEnd->fT < coinPtTStart->fT) {
+ continue;
+ }
+ if (coinRec->fCoinPtTStart->fT > coinPtTStart->fT) {
+ coinRec->fCoinPtTStart = coinPtTStart;
+ coinRec->fOppPtTStart = oppPtTStart;
+ }
+ if (coinRec->fCoinPtTEnd->fT < coinPtTEnd->fT) {
+ coinRec->fCoinPtTEnd = coinPtTEnd;
+ coinRec->fOppPtTEnd = oppPtTEnd;
+ }
+ return true;
+ } while ((coinRec = coinRec->fNext));
+ }
+ return false;
+}
+
void SkOpCoincidence::add(SkOpPtT* coinPtTStart, SkOpPtT* coinPtTEnd, SkOpPtT* oppPtTStart,
SkOpPtT* oppPtTEnd, SkChunkAlloc* allocator) {
SkASSERT(coinPtTStart->fT < coinPtTEnd->fT);
« no previous file with comments | « src/pathops/SkOpCoincidence.h ('k') | src/pathops/SkOpSegment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698