| OLD | NEW |
| 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 | 7 |
| 8 #include "GrTessellator.h" | 8 #include "GrTessellator.h" |
| 9 | 9 |
| 10 #include "GrPathUtils.h" | 10 #include "GrPathUtils.h" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 e->fTop->fPoint.fX, e->fTop->fPoint.fY, e->fBottom->fPoint.fX, e-
>fBottom->fPoint.fY, | 411 e->fTop->fPoint.fX, e->fTop->fPoint.fY, e->fBottom->fPoint.fX, e-
>fBottom->fPoint.fY, |
| 412 fID, side == kLeft_Side ? "left" : "right"); | 412 fID, side == kLeft_Side ? "left" : "right"); |
| 413 Poly* partner = fPartner; | 413 Poly* partner = fPartner; |
| 414 Poly* poly = this; | 414 Poly* poly = this; |
| 415 if (partner) { | 415 if (partner) { |
| 416 fPartner = partner->fPartner = nullptr; | 416 fPartner = partner->fPartner = nullptr; |
| 417 } | 417 } |
| 418 if (!fTail) { | 418 if (!fTail) { |
| 419 fHead = fTail = ALLOC_NEW(MonotonePoly, (e, side), alloc); | 419 fHead = fTail = ALLOC_NEW(MonotonePoly, (e, side), alloc); |
| 420 fCount += 2; | 420 fCount += 2; |
| 421 } else if (e->fBottom == fTail->fLastEdge->fBottom) { |
| 422 return poly; |
| 421 } else if (side == fTail->fSide) { | 423 } else if (side == fTail->fSide) { |
| 422 fTail->addEdge(e); | 424 fTail->addEdge(e); |
| 423 fCount++; | 425 fCount++; |
| 424 } else { | 426 } else { |
| 425 if (e->fBottom == fTail->fLastEdge->fBottom) { | |
| 426 return poly; | |
| 427 } | |
| 428 e = ALLOC_NEW(Edge, (fTail->fLastEdge->fBottom, e->fBottom, 1), allo
c); | 427 e = ALLOC_NEW(Edge, (fTail->fLastEdge->fBottom, e->fBottom, 1), allo
c); |
| 429 fTail->addEdge(e); | 428 fTail->addEdge(e); |
| 430 fCount++; | 429 fCount++; |
| 431 if (partner) { | 430 if (partner) { |
| 432 partner->addEdge(e, side, alloc); | 431 partner->addEdge(e, side, alloc); |
| 433 poly = partner; | 432 poly = partner; |
| 434 } else { | 433 } else { |
| 435 MonotonePoly* m = ALLOC_NEW(MonotonePoly, (e, side), alloc); | 434 MonotonePoly* m = ALLOC_NEW(MonotonePoly, (e, side), alloc); |
| 436 m->fPrev = fTail; | 435 m->fPrev = fTail; |
| 437 fTail->fNext = m; | 436 fTail->fNext = m; |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 if (!v->fFirstEdgeBelow) { | 1232 if (!v->fFirstEdgeBelow) { |
| 1234 if (leftPoly && rightPoly && leftPoly != rightPoly) { | 1233 if (leftPoly && rightPoly && leftPoly != rightPoly) { |
| 1235 SkASSERT(leftPoly->fPartner == nullptr && rightPoly->fPartne
r == nullptr); | 1234 SkASSERT(leftPoly->fPartner == nullptr && rightPoly->fPartne
r == nullptr); |
| 1236 rightPoly->fPartner = leftPoly; | 1235 rightPoly->fPartner = leftPoly; |
| 1237 leftPoly->fPartner = rightPoly; | 1236 leftPoly->fPartner = rightPoly; |
| 1238 } | 1237 } |
| 1239 } | 1238 } |
| 1240 } | 1239 } |
| 1241 if (v->fFirstEdgeBelow) { | 1240 if (v->fFirstEdgeBelow) { |
| 1242 if (!v->fFirstEdgeAbove) { | 1241 if (!v->fFirstEdgeAbove) { |
| 1243 if (leftPoly) { | 1242 if (leftPoly && rightPoly) { |
| 1244 if (leftPoly == rightPoly) { | 1243 if (leftPoly == rightPoly) { |
| 1245 if (leftPoly->fTail && leftPoly->fTail->fSide == Poly::k
Left_Side) { | 1244 if (leftPoly->fTail && leftPoly->fTail->fSide == Poly::k
Left_Side) { |
| 1246 leftPoly = new_poly(&polys, leftPoly->lastVertex(), | 1245 leftPoly = new_poly(&polys, leftPoly->lastVertex(), |
| 1247 leftPoly->fWinding, alloc); | 1246 leftPoly->fWinding, alloc); |
| 1248 leftEnclosingEdge->fRightPoly = leftPoly; | 1247 leftEnclosingEdge->fRightPoly = leftPoly; |
| 1249 } else { | 1248 } else { |
| 1250 rightPoly = new_poly(&polys, rightPoly->lastVertex()
, | 1249 rightPoly = new_poly(&polys, rightPoly->lastVertex()
, |
| 1251 rightPoly->fWinding, alloc); | 1250 rightPoly->fWinding, alloc); |
| 1252 rightEnclosingEdge->fLeftPoly = rightPoly; | 1251 rightEnclosingEdge->fLeftPoly = rightPoly; |
| 1253 } | 1252 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 } | 1441 } |
| 1443 } | 1442 } |
| 1444 int actualCount = static_cast<int>(vertsEnd - *verts); | 1443 int actualCount = static_cast<int>(vertsEnd - *verts); |
| 1445 SkASSERT(actualCount <= count); | 1444 SkASSERT(actualCount <= count); |
| 1446 SkASSERT(pointsEnd - points == actualCount); | 1445 SkASSERT(pointsEnd - points == actualCount); |
| 1447 delete[] points; | 1446 delete[] points; |
| 1448 return actualCount; | 1447 return actualCount; |
| 1449 } | 1448 } |
| 1450 | 1449 |
| 1451 } // namespace | 1450 } // namespace |
| OLD | NEW |