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

Unified Diff: src/gpu/batches/GrTessellatingPathRenderer.h

Issue 1541903002: added support for PLS path rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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
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.

Powered by Google App Engine
This is Rietveld 408576698