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

Side by Side Diff: src/gpu/GrTessellator.cpp

Issue 2251643008: Tessellator: better fix for reused-edges issue. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | no next file » | 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 7
8 #include "GrTessellator.h" 8 #include "GrTessellator.h"
9 9
10 #include "GrPathUtils.h" 10 #include "GrPathUtils.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 , fNext(nullptr) { 353 , fNext(nullptr) {
354 this->addEdge(edge); 354 this->addEdge(edge);
355 } 355 }
356 Side fSide; 356 Side fSide;
357 Edge* fFirstEdge; 357 Edge* fFirstEdge;
358 Edge* fLastEdge; 358 Edge* fLastEdge;
359 MonotonePoly* fPrev; 359 MonotonePoly* fPrev;
360 MonotonePoly* fNext; 360 MonotonePoly* fNext;
361 void addEdge(Edge* edge) { 361 void addEdge(Edge* edge) {
362 if (fSide == kRight_Side) { 362 if (fSide == kRight_Side) {
363 if (edge->fUsedInRightPoly) { 363 SkASSERT(!edge->fUsedInRightPoly);
364 return;
365 }
366 list_insert<Edge, &Edge::fRightPolyPrev, &Edge::fRightPolyNext>( 364 list_insert<Edge, &Edge::fRightPolyPrev, &Edge::fRightPolyNext>(
367 edge, fLastEdge, nullptr, &fFirstEdge, &fLastEdge); 365 edge, fLastEdge, nullptr, &fFirstEdge, &fLastEdge);
368 edge->fUsedInRightPoly = true; 366 edge->fUsedInRightPoly = true;
369 } else { 367 } else {
370 if (edge->fUsedInLeftPoly) { 368 SkASSERT(!edge->fUsedInLeftPoly);
371 return;
372 }
373 list_insert<Edge, &Edge::fLeftPolyPrev, &Edge::fLeftPolyNext>( 369 list_insert<Edge, &Edge::fLeftPolyPrev, &Edge::fLeftPolyNext>(
374 edge, fLastEdge, nullptr, &fFirstEdge, &fLastEdge); 370 edge, fLastEdge, nullptr, &fFirstEdge, &fLastEdge);
375 edge->fUsedInLeftPoly = true; 371 edge->fUsedInLeftPoly = true;
376 } 372 }
377 } 373 }
378 374
379 SkPoint* emit(SkPoint* data) { 375 SkPoint* emit(SkPoint* data) {
380 Edge* e = fFirstEdge; 376 Edge* e = fFirstEdge;
381 e->fTop->fPrev = e->fTop->fNext = nullptr; 377 e->fTop->fPrev = e->fTop->fNext = nullptr;
382 VertexList vertices; 378 VertexList vertices;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 412 }
417 } 413 }
418 return data; 414 return data;
419 } 415 }
420 }; 416 };
421 Poly* addEdge(Edge* e, Side side, SkChunkAlloc& alloc) { 417 Poly* addEdge(Edge* e, Side side, SkChunkAlloc& alloc) {
422 LOG("addEdge (%g -> %g) to poly %d, %s side\n", 418 LOG("addEdge (%g -> %g) to poly %d, %s side\n",
423 e->fTop->fID, e->fBottom->fID, fID, side == kLeft_Side ? "left" : "right"); 419 e->fTop->fID, e->fBottom->fID, fID, side == kLeft_Side ? "left" : "right");
424 Poly* partner = fPartner; 420 Poly* partner = fPartner;
425 Poly* poly = this; 421 Poly* poly = this;
422 if (side == kRight_Side) {
423 if (e->fUsedInRightPoly) {
424 return this;
425 }
426 } else {
427 if (e->fUsedInLeftPoly) {
428 return this;
429 }
430 }
426 if (partner) { 431 if (partner) {
427 fPartner = partner->fPartner = nullptr; 432 fPartner = partner->fPartner = nullptr;
428 } 433 }
429 if (!fTail) { 434 if (!fTail) {
430 fHead = fTail = ALLOC_NEW(MonotonePoly, (e, side), alloc); 435 fHead = fTail = ALLOC_NEW(MonotonePoly, (e, side), alloc);
431 fCount += 2; 436 fCount += 2;
432 } else if (e->fBottom == fTail->fLastEdge->fBottom) { 437 } else if (e->fBottom == fTail->fLastEdge->fBottom) {
433 return poly; 438 return poly;
434 } else if (side == fTail->fSide) { 439 } else if (side == fTail->fSide) {
435 fTail->addEdge(e); 440 fTail->addEdge(e);
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 } 1456 }
1452 } 1457 }
1453 int actualCount = static_cast<int>(vertsEnd - *verts); 1458 int actualCount = static_cast<int>(vertsEnd - *verts);
1454 SkASSERT(actualCount <= count); 1459 SkASSERT(actualCount <= count);
1455 SkASSERT(pointsEnd - points == actualCount); 1460 SkASSERT(pointsEnd - points == actualCount);
1456 delete[] points; 1461 delete[] points;
1457 return actualCount; 1462 return actualCount;
1458 } 1463 }
1459 1464
1460 } // namespace 1465 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698