Chromium Code Reviews| Index: src/gpu/batches/GrTessellatingPathRenderer.h |
| diff --git a/src/gpu/batches/GrTessellatingPathRenderer.h b/src/gpu/batches/GrTessellatingPathRenderer.h |
| index 7598ceb065a7995530ddb99e41d847203ea81276..aab618a223a167b7adc92429ac64bdefbc700eac 100644 |
| --- a/src/gpu/batches/GrTessellatingPathRenderer.h |
| +++ b/src/gpu/batches/GrTessellatingPathRenderer.h |
| @@ -8,8 +8,63 @@ |
| #ifndef GrTessellatingPathRenderer_DEFINED |
| #define GrTessellatingPathRenderer_DEFINED |
| +#include "SkChunkAlloc.h" |
| #include "GrPathRenderer.h" |
| +#define TESSELLATION_LOGGING_ENABLED 0 |
|
bsalomon
2016/01/04 15:33:47
Maybe we can pull tessellation into it's own utili
|
| + |
| +struct TessellatingVertex; |
| +struct Poly; |
| +struct Edge; |
| + |
| +/** |
| + * Vertices are used in three ways: first, the path contours are converted into a |
| + * circularly-linked list of Vertices for each contour. After edge construction, the same Vertices |
| + * are re-ordered by the merge sort according to the sweep_lt comparator (usually, increasing |
| + * in Y) using the same fPrev/fNext pointers that were used for the contours, to avoid |
| + * reallocation. Finally, MonotonePolys are built containing a circularly-linked list of |
| + * Vertices. (Currently, those Vertices are newly-allocated for the MonotonePolys, since |
| + * an individual TessellatingVertex from the path mesh may belong to multiple |
| + * MonotonePolys, so the original Vertices cannot be re-used. |
| + */ |
| + |
| +struct WindingVertex { |
| + SkPoint fPos; |
| + int fWinding; |
| +}; |
| + |
| +struct TessellatingVertex { |
| + TessellatingVertex(const SkPoint& point) |
| + : fPoint(point), fPrev(nullptr), fNext(nullptr) |
| + , fFirstEdgeAbove(nullptr), fLastEdgeAbove(nullptr) |
| + , fFirstEdgeBelow(nullptr), fLastEdgeBelow(nullptr) |
| + , fProcessed(false) |
| +#if TESSELLATION_LOGGING_ENABLED |
| + , fID (-1.0f) |
| +#endif |
| + {} |
| + SkPoint fPoint; // Vertex position |
| + TessellatingVertex* fPrev; // Linked list of contours, then Y-sorted vertices. |
| + TessellatingVertex* fNext; // " |
| + Edge* fFirstEdgeAbove; // Linked list of edges above this vertex. |
| + Edge* fLastEdgeAbove; // " |
| + Edge* fFirstEdgeBelow; // Linked list of edges below this vertex. |
| + Edge* fLastEdgeBelow; // " |
| + bool fProcessed; // Has this vertex been seen in simplify()? |
| +#if TESSELLATION_LOGGING_ENABLED |
| + float fID; // Identifier used for logging. |
| +#endif |
| +}; |
| + |
| +TessellatingVertex* append_point_to_contour(const SkPoint& p, TessellatingVertex* prev, |
| + TessellatingVertex** head, SkChunkAlloc& alloc); |
| + |
| +Poly* contours_to_polys(TessellatingVertex** contours, int contourCnt, SkRect bounds, |
| + SkChunkAlloc& alloc); |
| + |
| +int polys_to_vertices(Poly* polys, SkPath::FillType fillType, bool isLinear, |
| + WindingVertex** verts); |
| + |
| /** |
| * Subclass that renders the path by converting to screen-space trapezoids plus |
| * extra 1-pixel geometry for AA. |