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

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

Issue 1182493015: pathops coincident fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: all tests (including extended) work Created 5 years, 5 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/SkOpSpan.h ('k') | src/pathops/SkPathOpsCommon.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 2014 Google Inc. 2 * Copyright 2014 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 "SkOpContour.h" 8 #include "SkOpContour.h"
9 #include "SkOpSegment.h" 9 #include "SkOpSegment.h"
10 #include "SkPathWriter.h" 10 #include "SkPathWriter.h"
11 11
12 bool SkOpPtT::alias() const { 12 bool SkOpPtT::alias() const {
13 return this->span()->ptT() != this; 13 return this->span()->ptT() != this;
14 } 14 }
15 15
16 bool SkOpPtT::contains(const SkOpPtT* check) const {
17 SkASSERT(this != check);
18 const SkOpPtT* ptT = this;
19 const SkOpPtT* stopPtT = ptT;
20 while ((ptT = ptT->next()) != stopPtT) {
21 if (ptT == check) {
22 return true;
23 }
24 }
25 return false;
26 }
27
28 SkOpPtT* SkOpPtT::contains(const SkOpSegment* check) {
29 SkASSERT(this->segment() != check);
30 SkOpPtT* ptT = this;
31 const SkOpPtT* stopPtT = ptT;
32 while ((ptT = ptT->next()) != stopPtT) {
33 if (ptT->segment() == check) {
34 return ptT;
35 }
36 }
37 return NULL;
38 }
39
16 SkOpContour* SkOpPtT::contour() const { 40 SkOpContour* SkOpPtT::contour() const {
17 return segment()->contour(); 41 return segment()->contour();
18 } 42 }
19 43
44 SkOpPtT* SkOpPtT::doppelganger() {
45 SkASSERT(fDeleted);
46 SkOpPtT* ptT = fNext;
47 while (ptT->fDeleted) {
48 ptT = ptT->fNext;
49 }
50 const SkOpPtT* stopPtT = ptT;
51 do {
52 if (ptT->fSpan == fSpan) {
53 return ptT;
54 }
55 ptT = ptT->fNext;
56 } while (stopPtT != ptT);
57 SkASSERT(0);
58 return NULL;
59 }
60
61 SkOpPtT* SkOpPtT::find(SkOpSegment* segment) {
62 SkOpPtT* ptT = this;
63 const SkOpPtT* stopPtT = ptT;
64 do {
65 if (ptT->segment() == segment) {
66 return ptT;
67 }
68 ptT = ptT->fNext;
69 } while (stopPtT != ptT);
70 SkASSERT(0);
71 return NULL;
72 }
73
20 SkOpGlobalState* SkOpPtT::globalState() const { 74 SkOpGlobalState* SkOpPtT::globalState() const {
21 return contour()->globalState(); 75 return contour()->globalState();
22 } 76 }
23 77
24 void SkOpPtT::init(SkOpSpanBase* span, double t, const SkPoint& pt, bool duplica te) { 78 void SkOpPtT::init(SkOpSpanBase* span, double t, const SkPoint& pt, bool duplica te) {
25 fT = t; 79 fT = t;
26 fPt = pt; 80 fPt = pt;
27 fSpan = span; 81 fSpan = span;
28 fNext = this; 82 fNext = this;
29 fDuplicatePt = duplicate; 83 fDuplicatePt = duplicate;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 365
312 void SkOpSpan::setWindSum(int windSum) { 366 void SkOpSpan::setWindSum(int windSum) {
313 SkASSERT(!final()); 367 SkASSERT(!final());
314 if (fWindSum != SK_MinS32 && fWindSum != windSum) { 368 if (fWindSum != SK_MinS32 && fWindSum != windSum) {
315 this->globalState()->setWindingFailed(); 369 this->globalState()->setWindingFailed();
316 return; 370 return;
317 } 371 }
318 SkASSERT(!DEBUG_LIMIT_WIND_SUM || abs(windSum) <= DEBUG_LIMIT_WIND_SUM); 372 SkASSERT(!DEBUG_LIMIT_WIND_SUM || abs(windSum) <= DEBUG_LIMIT_WIND_SUM);
319 fWindSum = windSum; 373 fWindSum = windSum;
320 } 374 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpSpan.h ('k') | src/pathops/SkPathOpsCommon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698