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

Unified Diff: src/gpu/GrTessellator.cpp

Issue 2259493002: Fix assert caused by floating point error in tessellating path renderer. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/TessellatingPathRendererTests.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTessellator.cpp
diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp
index cefe4cd65b9b8525e8fd1acb040c7a84d5f7fc5a..50d4af6148b30333789f68e663ee46c6aeac3651 100644
--- a/src/gpu/GrTessellator.cpp
+++ b/src/gpu/GrTessellator.cpp
@@ -253,7 +253,9 @@ struct Edge {
, fLeftPolyPrev(nullptr)
, fLeftPolyNext(nullptr)
, fRightPolyPrev(nullptr)
- , fRightPolyNext(nullptr) {
+ , fRightPolyNext(nullptr)
+ , fUsedInLeftPoly(false)
+ , fUsedInRightPoly(false) {
recompute();
}
int fWinding; // 1 == edge goes downward; -1 = edge goes upward.
@@ -271,6 +273,8 @@ struct Edge {
Edge* fLeftPolyNext;
Edge* fRightPolyPrev;
Edge* fRightPolyNext;
+ bool fUsedInLeftPoly;
+ bool fUsedInRightPoly;
double fDX; // The line equation for this edge, in implicit form.
double fDY; // fDY * x + fDX * y + fC = 0, for point (x, y) on the line.
double fC;
@@ -356,11 +360,19 @@ struct Poly {
MonotonePoly* fNext;
void addEdge(Edge* edge) {
if (fSide == kRight_Side) {
+ if (edge->fUsedInRightPoly) {
+ return;
+ }
list_insert<Edge, &Edge::fRightPolyPrev, &Edge::fRightPolyNext>(
edge, fLastEdge, nullptr, &fFirstEdge, &fLastEdge);
+ edge->fUsedInRightPoly = true;
} else {
+ if (edge->fUsedInLeftPoly) {
+ return;
+ }
list_insert<Edge, &Edge::fLeftPolyPrev, &Edge::fLeftPolyNext>(
edge, fLastEdge, nullptr, &fFirstEdge, &fLastEdge);
+ edge->fUsedInLeftPoly = true;
}
}
@@ -407,9 +419,8 @@ struct Poly {
}
};
Poly* addEdge(Edge* e, Side side, SkChunkAlloc& alloc) {
- LOG("addEdge (%g,%g)-(%g,%g) to poly %d, %s side\n",
- e->fTop->fPoint.fX, e->fTop->fPoint.fY, e->fBottom->fPoint.fX, e->fBottom->fPoint.fY,
- fID, side == kLeft_Side ? "left" : "right");
+ LOG("addEdge (%g -> %g) to poly %d, %s side\n",
+ e->fTop->fID, e->fBottom->fID, fID, side == kLeft_Side ? "left" : "right");
Poly* partner = fPartner;
Poly* poly = this;
if (partner) {
« no previous file with comments | « no previous file | tests/TessellatingPathRendererTests.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698