From: Stephen White Date: Fri, 3 Mar 2017 17:24:16 +0000 (-0500) Subject: GrTessellator: Implement a fast path in poly emission. X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~46^2~734 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=651cbe9af67b49c5a3ad3788c3a50a003827a8e2;p=platform%2Fupstream%2FlibSkiaSharp.git GrTessellator: Implement a fast path in poly emission. When there's a single triangle remaining in the monotone, emit early and skip a convexity check. BUG=skia: Change-Id: I591acf4b7f567dbbf7681ba72181e578ca4623ec Reviewed-on: https://skia-review.googlesource.com/8797 Commit-Queue: Stephen White Reviewed-by: Brian Salomon --- diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp index 80a813f..10f6edf 100644 --- a/src/gpu/GrTessellator.cpp +++ b/src/gpu/GrTessellator.cpp @@ -481,6 +481,7 @@ struct Poly { Edge* e = fFirstEdge; VertexList vertices; vertices.append(e->fTop); + int count = 1; while (e != nullptr) { if (kRight_Side == fSide) { vertices.append(e->fBottom); @@ -489,6 +490,7 @@ struct Poly { vertices.prepend(e->fBottom); e = e->fLeftPolyNext; } + count++; } Vertex* first = vertices.fHead; Vertex* v = first->fNext; @@ -497,6 +499,9 @@ struct Poly { Vertex* prev = v->fPrev; Vertex* curr = v; Vertex* next = v->fNext; + if (count == 3) { + return emit_triangle(prev, curr, next, aaParams, data); + } double ax = static_cast(curr->fPoint.fX) - prev->fPoint.fX; double ay = static_cast(curr->fPoint.fY) - prev->fPoint.fY; double bx = static_cast(next->fPoint.fX) - curr->fPoint.fX; @@ -505,6 +510,7 @@ struct Poly { data = emit_triangle(prev, curr, next, aaParams, data); v->fPrev->fNext = v->fNext; v->fNext->fPrev = v->fPrev; + count--; if (v->fPrev == first) { v = v->fNext; } else {