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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 : fWinding(winding) | 242 : fWinding(winding) |
243 , fTop(top) | 243 , fTop(top) |
244 , fBottom(bottom) | 244 , fBottom(bottom) |
245 , fLeft(nullptr) | 245 , fLeft(nullptr) |
246 , fRight(nullptr) | 246 , fRight(nullptr) |
247 , fPrevEdgeAbove(nullptr) | 247 , fPrevEdgeAbove(nullptr) |
248 , fNextEdgeAbove(nullptr) | 248 , fNextEdgeAbove(nullptr) |
249 , fPrevEdgeBelow(nullptr) | 249 , fPrevEdgeBelow(nullptr) |
250 , fNextEdgeBelow(nullptr) | 250 , fNextEdgeBelow(nullptr) |
251 , fLeftPoly(nullptr) | 251 , fLeftPoly(nullptr) |
252 , fRightPoly(nullptr) { | 252 , fRightPoly(nullptr) |
| 253 , fLeftPolyPrev(nullptr) |
| 254 , fLeftPolyNext(nullptr) |
| 255 , fRightPolyPrev(nullptr) |
| 256 , fRightPolyNext(nullptr) { |
253 recompute(); | 257 recompute(); |
254 } | 258 } |
255 int fWinding; // 1 == edge goes downward; -1 = edge goes upwar
d. | 259 int fWinding; // 1 == edge goes downward; -1 = edge goes upwar
d. |
256 Vertex* fTop; // The top vertex in vertex-sort-order (sweep_lt
). | 260 Vertex* fTop; // The top vertex in vertex-sort-order (sweep_lt
). |
257 Vertex* fBottom; // The bottom vertex in vertex-sort-order. | 261 Vertex* fBottom; // The bottom vertex in vertex-sort-order. |
258 Edge* fLeft; // The linked list of edges in the active edge l
ist. | 262 Edge* fLeft; // The linked list of edges in the active edge l
ist. |
259 Edge* fRight; // " | 263 Edge* fRight; // " |
260 Edge* fPrevEdgeAbove; // The linked list of edges in the bottom Vertex
's "edges above". | 264 Edge* fPrevEdgeAbove; // The linked list of edges in the bottom Vertex
's "edges above". |
261 Edge* fNextEdgeAbove; // " | 265 Edge* fNextEdgeAbove; // " |
262 Edge* fPrevEdgeBelow; // The linked list of edges in the top Vertex's
"edges below". | 266 Edge* fPrevEdgeBelow; // The linked list of edges in the top Vertex's
"edges below". |
263 Edge* fNextEdgeBelow; // " | 267 Edge* fNextEdgeBelow; // " |
264 Poly* fLeftPoly; // The Poly to the left of this edge, if any. | 268 Poly* fLeftPoly; // The Poly to the left of this edge, if any. |
265 Poly* fRightPoly; // The Poly to the right of this edge, if any. | 269 Poly* fRightPoly; // The Poly to the right of this edge, if any. |
| 270 Edge* fLeftPolyPrev; |
| 271 Edge* fLeftPolyNext; |
| 272 Edge* fRightPolyPrev; |
| 273 Edge* fRightPolyNext; |
266 double fDX; // The line equation for this edge, in implicit
form. | 274 double fDX; // The line equation for this edge, in implicit
form. |
267 double fDY; // fDY * x + fDX * y + fC = 0, for point (x, y)
on the line. | 275 double fDY; // fDY * x + fDX * y + fC = 0, for point (x, y)
on the line. |
268 double fC; | 276 double fC; |
269 double dist(const SkPoint& p) const { | 277 double dist(const SkPoint& p) const { |
270 return fDY * p.fX - fDX * p.fY + fC; | 278 return fDY * p.fX - fDX * p.fY + fC; |
271 } | 279 } |
272 bool isRightOf(Vertex* v) const { | 280 bool isRightOf(Vertex* v) const { |
273 return dist(v->fPoint) < 0.0; | 281 return dist(v->fPoint) < 0.0; |
274 } | 282 } |
275 bool isLeftOf(Vertex* v) const { | 283 bool isLeftOf(Vertex* v) const { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 return true; | 317 return true; |
310 } | 318 } |
311 bool isActive(EdgeList* activeEdges) const { | 319 bool isActive(EdgeList* activeEdges) const { |
312 return activeEdges && (fLeft || fRight || activeEdges->fHead == this); | 320 return activeEdges && (fLeft || fRight || activeEdges->fHead == this); |
313 } | 321 } |
314 }; | 322 }; |
315 | 323 |
316 /*******************************************************************************
********/ | 324 /*******************************************************************************
********/ |
317 | 325 |
318 struct Poly { | 326 struct Poly { |
319 Poly(int winding) | 327 Poly(Vertex* v, int winding) |
320 : fWinding(winding) | 328 : fFirstVertex(v) |
| 329 , fWinding(winding) |
321 , fHead(nullptr) | 330 , fHead(nullptr) |
322 , fTail(nullptr) | 331 , fTail(nullptr) |
323 , fActive(nullptr) | |
324 , fNext(nullptr) | 332 , fNext(nullptr) |
325 , fPartner(nullptr) | 333 , fPartner(nullptr) |
326 , fCount(0) | 334 , fCount(0) |
327 { | 335 { |
328 #if LOGGING_ENABLED | 336 #if LOGGING_ENABLED |
329 static int gID = 0; | 337 static int gID = 0; |
330 fID = gID++; | 338 fID = gID++; |
331 LOG("*** created Poly %d\n", fID); | 339 LOG("*** created Poly %d\n", fID); |
332 #endif | 340 #endif |
333 } | 341 } |
334 typedef enum { kNeither_Side, kLeft_Side, kRight_Side } Side; | 342 typedef enum { kLeft_Side, kRight_Side } Side; |
335 struct MonotonePoly { | 343 struct MonotonePoly { |
336 MonotonePoly() | 344 MonotonePoly(Edge* edge, Side side) |
337 : fSide(kNeither_Side) | 345 : fSide(side) |
| 346 , fFirstEdge(nullptr) |
| 347 , fLastEdge(nullptr) |
338 , fPrev(nullptr) | 348 , fPrev(nullptr) |
339 , fNext(nullptr) {} | 349 , fNext(nullptr) { |
| 350 this->addEdge(edge); |
| 351 } |
340 Side fSide; | 352 Side fSide; |
341 VertexList fVertices; | 353 Edge* fFirstEdge; |
| 354 Edge* fLastEdge; |
342 MonotonePoly* fPrev; | 355 MonotonePoly* fPrev; |
343 MonotonePoly* fNext; | 356 MonotonePoly* fNext; |
344 bool addVertex(Vertex* v, Side side, SkChunkAlloc& alloc) { | 357 void addEdge(Edge* edge) { |
345 Vertex* newV = ALLOC_NEW(Vertex, (v->fPoint), alloc); | 358 if (fSide == kRight_Side) { |
346 bool done = false; | 359 list_insert<Edge, &Edge::fRightPolyPrev, &Edge::fRightPolyNext>( |
347 if (fSide == kNeither_Side) { | 360 edge, fLastEdge, nullptr, &fFirstEdge, &fLastEdge); |
348 fSide = side; | |
349 } else { | 361 } else { |
350 done = side != fSide; | 362 list_insert<Edge, &Edge::fLeftPolyPrev, &Edge::fLeftPolyNext>( |
| 363 edge, fLastEdge, nullptr, &fFirstEdge, &fLastEdge); |
351 } | 364 } |
352 if (fSide == kRight_Side) { | |
353 fVertices.append(newV); | |
354 } else { | |
355 fVertices.prepend(newV); | |
356 } | |
357 return done; | |
358 } | 365 } |
359 | 366 |
360 SkPoint* emit(SkPoint* data) { | 367 SkPoint* emit(SkPoint* data) { |
361 Vertex* first = fVertices.fHead; | 368 Edge* e = fFirstEdge; |
| 369 e->fTop->fPrev = e->fTop->fNext = nullptr; |
| 370 VertexList vertices; |
| 371 vertices.append(e->fTop); |
| 372 while (e != nullptr) { |
| 373 e->fBottom->fPrev = e->fBottom->fNext = nullptr; |
| 374 if (kRight_Side == fSide) { |
| 375 vertices.append(e->fBottom); |
| 376 e = e->fRightPolyNext; |
| 377 } else { |
| 378 vertices.prepend(e->fBottom); |
| 379 e = e->fLeftPolyNext; |
| 380 } |
| 381 } |
| 382 Vertex* first = vertices.fHead; |
362 Vertex* v = first->fNext; | 383 Vertex* v = first->fNext; |
363 while (v != fVertices.fTail) { | 384 while (v != vertices.fTail) { |
364 SkASSERT(v && v->fPrev && v->fNext); | 385 SkASSERT(v && v->fPrev && v->fNext); |
365 Vertex* prev = v->fPrev; | 386 Vertex* prev = v->fPrev; |
366 Vertex* curr = v; | 387 Vertex* curr = v; |
367 Vertex* next = v->fNext; | 388 Vertex* next = v->fNext; |
368 double ax = static_cast<double>(curr->fPoint.fX) - prev->fPoint.
fX; | 389 double ax = static_cast<double>(curr->fPoint.fX) - prev->fPoint.
fX; |
369 double ay = static_cast<double>(curr->fPoint.fY) - prev->fPoint.
fY; | 390 double ay = static_cast<double>(curr->fPoint.fY) - prev->fPoint.
fY; |
370 double bx = static_cast<double>(next->fPoint.fX) - curr->fPoint.
fX; | 391 double bx = static_cast<double>(next->fPoint.fX) - curr->fPoint.
fX; |
371 double by = static_cast<double>(next->fPoint.fY) - curr->fPoint.
fY; | 392 double by = static_cast<double>(next->fPoint.fY) - curr->fPoint.
fY; |
372 if (ax * by - ay * bx >= 0.0) { | 393 if (ax * by - ay * bx >= 0.0) { |
373 data = emit_triangle(prev, curr, next, data); | 394 data = emit_triangle(prev, curr, next, data); |
374 v->fPrev->fNext = v->fNext; | 395 v->fPrev->fNext = v->fNext; |
375 v->fNext->fPrev = v->fPrev; | 396 v->fNext->fPrev = v->fPrev; |
376 if (v->fPrev == first) { | 397 if (v->fPrev == first) { |
377 v = v->fNext; | 398 v = v->fNext; |
378 } else { | 399 } else { |
379 v = v->fPrev; | 400 v = v->fPrev; |
380 } | 401 } |
381 } else { | 402 } else { |
382 v = v->fNext; | 403 v = v->fNext; |
383 } | 404 } |
384 } | 405 } |
385 return data; | 406 return data; |
386 } | 407 } |
387 }; | 408 }; |
388 Poly* addVertex(Vertex* v, Side side, SkChunkAlloc& alloc) { | 409 Poly* addEdge(Edge* e, Side side, SkChunkAlloc& alloc) { |
389 LOG("addVertex() to %d at %g (%g, %g), %s side\n", fID, v->fID, v->fPoin
t.fX, v->fPoint.fY, | 410 LOG("addEdge (%g,%g)-(%g,%g) to poly %d, %s side\n", |
390 side == kLeft_Side ? "left" : side == kRight_Side ? "right" : "ne
ither"); | 411 e->fTop->fPoint.fX, e->fTop->fPoint.fY, e->fBottom->fPoint.fX, e-
>fBottom->fPoint.fY, |
| 412 fID, side == kLeft_Side ? "left" : "right"); |
391 Poly* partner = fPartner; | 413 Poly* partner = fPartner; |
392 Poly* poly = this; | 414 Poly* poly = this; |
393 if (partner) { | 415 if (partner) { |
394 fPartner = partner->fPartner = nullptr; | 416 fPartner = partner->fPartner = nullptr; |
395 } | 417 } |
396 if (!fActive) { | 418 if (!fTail) { |
397 fActive = ALLOC_NEW(MonotonePoly, (), alloc); | 419 fHead = fTail = ALLOC_NEW(MonotonePoly, (e, side), alloc); |
398 } | 420 fCount += 2; |
399 if (fActive->addVertex(v, side, alloc)) { | 421 } else if (side == fTail->fSide) { |
400 if (fTail) { | 422 fTail->addEdge(e); |
401 fActive->fPrev = fTail; | 423 fCount++; |
402 fTail->fNext = fActive; | 424 } else { |
403 fTail = fActive; | 425 if (e->fBottom == fTail->fLastEdge->fBottom) { |
404 } else { | 426 return poly; |
405 fHead = fTail = fActive; | |
406 } | 427 } |
| 428 e = ALLOC_NEW(Edge, (fTail->fLastEdge->fBottom, e->fBottom, 1), allo
c); |
| 429 fTail->addEdge(e); |
| 430 fCount++; |
407 if (partner) { | 431 if (partner) { |
408 partner->addVertex(v, side, alloc); | 432 partner->addEdge(e, side, alloc); |
409 poly = partner; | 433 poly = partner; |
410 } else { | 434 } else { |
411 Vertex* prev = fActive->fSide == Poly::kLeft_Side ? | 435 MonotonePoly* m = ALLOC_NEW(MonotonePoly, (e, side), alloc); |
412 fActive->fVertices.fHead->fNext : fActive->fVerti
ces.fTail->fPrev; | 436 m->fPrev = fTail; |
413 fActive = ALLOC_NEW(MonotonePoly, , alloc); | 437 fTail->fNext = m; |
414 fActive->addVertex(prev, Poly::kNeither_Side, alloc); | 438 fTail = m; |
415 fActive->addVertex(v, side, alloc); | 439 fCount += 2; |
416 } | 440 } |
417 } | 441 } |
418 fCount++; | |
419 return poly; | 442 return poly; |
420 } | 443 } |
421 void end(Vertex* v, SkChunkAlloc& alloc) { | |
422 LOG("end() %d at %g, %g\n", fID, v->fPoint.fX, v->fPoint.fY); | |
423 if (fPartner) { | |
424 fPartner = fPartner->fPartner = nullptr; | |
425 } | |
426 addVertex(v, fActive->fSide == kLeft_Side ? kRight_Side : kLeft_Side, al
loc); | |
427 } | |
428 SkPoint* emit(SkPoint *data) { | 444 SkPoint* emit(SkPoint *data) { |
429 if (fCount < 3) { | 445 if (fCount < 3) { |
430 return data; | 446 return data; |
431 } | 447 } |
432 LOG("emit() %d, size %d\n", fID, fCount); | 448 LOG("emit() %d, size %d\n", fID, fCount); |
433 for (MonotonePoly* m = fHead; m != nullptr; m = m->fNext) { | 449 for (MonotonePoly* m = fHead; m != nullptr; m = m->fNext) { |
434 data = m->emit(data); | 450 data = m->emit(data); |
435 } | 451 } |
436 return data; | 452 return data; |
437 } | 453 } |
| 454 Vertex* lastVertex() const { return fTail ? fTail->fLastEdge->fBottom : fFir
stVertex; } |
| 455 Vertex* fFirstVertex; |
438 int fWinding; | 456 int fWinding; |
439 MonotonePoly* fHead; | 457 MonotonePoly* fHead; |
440 MonotonePoly* fTail; | 458 MonotonePoly* fTail; |
441 MonotonePoly* fActive; | |
442 Poly* fNext; | 459 Poly* fNext; |
443 Poly* fPartner; | 460 Poly* fPartner; |
444 int fCount; | 461 int fCount; |
445 #if LOGGING_ENABLED | 462 #if LOGGING_ENABLED |
446 int fID; | 463 int fID; |
447 #endif | 464 #endif |
448 }; | 465 }; |
449 | 466 |
450 /*******************************************************************************
********/ | 467 /*******************************************************************************
********/ |
451 | 468 |
452 bool coincident(const SkPoint& a, const SkPoint& b) { | 469 bool coincident(const SkPoint& a, const SkPoint& b) { |
453 return a == b; | 470 return a == b; |
454 } | 471 } |
455 | 472 |
456 Poly* new_poly(Poly** head, Vertex* v, int winding, SkChunkAlloc& alloc) { | 473 Poly* new_poly(Poly** head, Vertex* v, int winding, SkChunkAlloc& alloc) { |
457 Poly* poly = ALLOC_NEW(Poly, (winding), alloc); | 474 Poly* poly = ALLOC_NEW(Poly, (v, winding), alloc); |
458 poly->addVertex(v, Poly::kNeither_Side, alloc); | |
459 poly->fNext = *head; | 475 poly->fNext = *head; |
460 *head = poly; | 476 *head = poly; |
461 return poly; | 477 return poly; |
462 } | 478 } |
463 | 479 |
464 Vertex* append_point_to_contour(const SkPoint& p, Vertex* prev, Vertex** head, | 480 Vertex* append_point_to_contour(const SkPoint& p, Vertex* prev, Vertex** head, |
465 SkChunkAlloc& alloc) { | 481 SkChunkAlloc& alloc) { |
466 Vertex* v = ALLOC_NEW(Vertex, (p), alloc); | 482 Vertex* v = ALLOC_NEW(Vertex, (p), alloc); |
467 #if LOGGING_ENABLED | 483 #if LOGGING_ENABLED |
468 static float gID = 0.0f; | 484 static float gID = 0.0f; |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 e->fLeftPoly ? e->fLeftPoly->fID : -1, e->fRightPoly ? e->fRight
Poly->fID : -1); | 1205 e->fLeftPoly ? e->fLeftPoly->fID : -1, e->fRightPoly ? e->fRight
Poly->fID : -1); |
1190 } | 1206 } |
1191 LOG("edges below:\n"); | 1207 LOG("edges below:\n"); |
1192 for (Edge* e = v->fFirstEdgeBelow; e; e = e->fNextEdgeBelow) { | 1208 for (Edge* e = v->fFirstEdgeBelow; e; e = e->fNextEdgeBelow) { |
1193 LOG("%g -> %g, lpoly %d, rpoly %d\n", e->fTop->fID, e->fBottom->fID, | 1209 LOG("%g -> %g, lpoly %d, rpoly %d\n", e->fTop->fID, e->fBottom->fID, |
1194 e->fLeftPoly ? e->fLeftPoly->fID : -1, e->fRightPoly ? e->fRight
Poly->fID : -1); | 1210 e->fLeftPoly ? e->fLeftPoly->fID : -1, e->fRightPoly ? e->fRight
Poly->fID : -1); |
1195 } | 1211 } |
1196 #endif | 1212 #endif |
1197 if (v->fFirstEdgeAbove) { | 1213 if (v->fFirstEdgeAbove) { |
1198 if (leftPoly) { | 1214 if (leftPoly) { |
1199 leftPoly = leftPoly->addVertex(v, Poly::kRight_Side, alloc); | 1215 leftPoly = leftPoly->addEdge(v->fFirstEdgeAbove, Poly::kRight_Si
de, alloc); |
1200 } | 1216 } |
1201 if (rightPoly) { | 1217 if (rightPoly) { |
1202 rightPoly = rightPoly->addVertex(v, Poly::kLeft_Side, alloc); | 1218 rightPoly = rightPoly->addEdge(v->fLastEdgeAbove, Poly::kLeft_Si
de, alloc); |
1203 } | 1219 } |
1204 for (Edge* e = v->fFirstEdgeAbove; e != v->fLastEdgeAbove; e = e->fN
extEdgeAbove) { | 1220 for (Edge* e = v->fFirstEdgeAbove; e != v->fLastEdgeAbove; e = e->fN
extEdgeAbove) { |
1205 Edge* leftEdge = e; | 1221 Edge* leftEdge = e; |
1206 Edge* rightEdge = e->fNextEdgeAbove; | 1222 Edge* rightEdge = e->fNextEdgeAbove; |
1207 SkASSERT(rightEdge->isRightOf(leftEdge->fTop)); | 1223 SkASSERT(rightEdge->isRightOf(leftEdge->fTop)); |
1208 remove_edge(leftEdge, &activeEdges); | 1224 remove_edge(leftEdge, &activeEdges); |
1209 if (leftEdge->fRightPoly) { | 1225 if (leftEdge->fRightPoly) { |
1210 leftEdge->fRightPoly->end(v, alloc); | 1226 leftEdge->fRightPoly->addEdge(e, Poly::kLeft_Side, alloc); |
1211 } | 1227 } |
1212 if (rightEdge->fLeftPoly && rightEdge->fLeftPoly != leftEdge->fR
ightPoly) { | 1228 if (rightEdge->fLeftPoly) { |
1213 rightEdge->fLeftPoly->end(v, alloc); | 1229 rightEdge->fLeftPoly->addEdge(e, Poly::kRight_Side, alloc); |
1214 } | 1230 } |
1215 } | 1231 } |
1216 remove_edge(v->fLastEdgeAbove, &activeEdges); | 1232 remove_edge(v->fLastEdgeAbove, &activeEdges); |
1217 if (!v->fFirstEdgeBelow) { | 1233 if (!v->fFirstEdgeBelow) { |
1218 if (leftPoly && rightPoly && leftPoly != rightPoly) { | 1234 if (leftPoly && rightPoly && leftPoly != rightPoly) { |
1219 SkASSERT(leftPoly->fPartner == nullptr && rightPoly->fPartne
r == nullptr); | 1235 SkASSERT(leftPoly->fPartner == nullptr && rightPoly->fPartne
r == nullptr); |
1220 rightPoly->fPartner = leftPoly; | 1236 rightPoly->fPartner = leftPoly; |
1221 leftPoly->fPartner = rightPoly; | 1237 leftPoly->fPartner = rightPoly; |
1222 } | 1238 } |
1223 } | 1239 } |
1224 } | 1240 } |
1225 if (v->fFirstEdgeBelow) { | 1241 if (v->fFirstEdgeBelow) { |
1226 if (!v->fFirstEdgeAbove) { | 1242 if (!v->fFirstEdgeAbove) { |
1227 if (leftPoly && leftPoly == rightPoly) { | 1243 if (leftPoly) { |
1228 // Split the poly. | 1244 if (leftPoly == rightPoly) { |
1229 if (leftPoly->fActive->fSide == Poly::kLeft_Side) { | 1245 if (leftPoly->fTail && leftPoly->fTail->fSide == Poly::k
Left_Side) { |
1230 leftPoly = new_poly(&polys, leftEnclosingEdge->fTop, lef
tPoly->fWinding, | 1246 leftPoly = new_poly(&polys, leftPoly->lastVertex(), |
1231 alloc); | 1247 leftPoly->fWinding, alloc); |
1232 leftPoly->addVertex(v, Poly::kRight_Side, alloc); | 1248 leftEnclosingEdge->fRightPoly = leftPoly; |
1233 rightPoly->addVertex(v, Poly::kLeft_Side, alloc); | 1249 } else { |
1234 leftEnclosingEdge->fRightPoly = leftPoly; | 1250 rightPoly = new_poly(&polys, rightPoly->lastVertex()
, |
1235 } else { | 1251 rightPoly->fWinding, alloc); |
1236 rightPoly = new_poly(&polys, rightEnclosingEdge->fTop, r
ightPoly->fWinding, | 1252 rightEnclosingEdge->fLeftPoly = rightPoly; |
1237 alloc); | 1253 } |
1238 rightPoly->addVertex(v, Poly::kLeft_Side, alloc); | |
1239 leftPoly->addVertex(v, Poly::kRight_Side, alloc); | |
1240 rightEnclosingEdge->fLeftPoly = rightPoly; | |
1241 } | 1254 } |
1242 } else { | 1255 Edge* join = ALLOC_NEW(Edge, (leftPoly->lastVertex(), v, 1),
alloc); |
1243 if (leftPoly) { | 1256 leftPoly = leftPoly->addEdge(join, Poly::kRight_Side, alloc)
; |
1244 leftPoly = leftPoly->addVertex(v, Poly::kRight_Side, all
oc); | 1257 rightPoly = rightPoly->addEdge(join, Poly::kLeft_Side, alloc
); |
1245 } | |
1246 if (rightPoly) { | |
1247 rightPoly = rightPoly->addVertex(v, Poly::kLeft_Side, al
loc); | |
1248 } | |
1249 } | 1258 } |
1250 } | 1259 } |
1251 Edge* leftEdge = v->fFirstEdgeBelow; | 1260 Edge* leftEdge = v->fFirstEdgeBelow; |
1252 leftEdge->fLeftPoly = leftPoly; | 1261 leftEdge->fLeftPoly = leftPoly; |
1253 insert_edge(leftEdge, leftEnclosingEdge, &activeEdges); | 1262 insert_edge(leftEdge, leftEnclosingEdge, &activeEdges); |
1254 for (Edge* rightEdge = leftEdge->fNextEdgeBelow; rightEdge; | 1263 for (Edge* rightEdge = leftEdge->fNextEdgeBelow; rightEdge; |
1255 rightEdge = rightEdge->fNextEdgeBelow) { | 1264 rightEdge = rightEdge->fNextEdgeBelow) { |
1256 insert_edge(rightEdge, leftEdge, &activeEdges); | 1265 insert_edge(rightEdge, leftEdge, &activeEdges); |
1257 int winding = leftEdge->fLeftPoly ? leftEdge->fLeftPoly->fWindin
g : 0; | 1266 int winding = leftEdge->fLeftPoly ? leftEdge->fLeftPoly->fWindin
g : 0; |
1258 winding += leftEdge->fWinding; | 1267 winding += leftEdge->fWinding; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 } | 1442 } |
1434 } | 1443 } |
1435 int actualCount = static_cast<int>(vertsEnd - *verts); | 1444 int actualCount = static_cast<int>(vertsEnd - *verts); |
1436 SkASSERT(actualCount <= count); | 1445 SkASSERT(actualCount <= count); |
1437 SkASSERT(pointsEnd - points == actualCount); | 1446 SkASSERT(pointsEnd - points == actualCount); |
1438 delete[] points; | 1447 delete[] points; |
1439 return actualCount; | 1448 return actualCount; |
1440 } | 1449 } |
1441 | 1450 |
1442 } // namespace | 1451 } // namespace |
OLD | NEW |