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

Side by Side 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 4 years, 11 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
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 #ifndef GrTessellatingPathRenderer_DEFINED 8 #ifndef GrTessellatingPathRenderer_DEFINED
9 #define GrTessellatingPathRenderer_DEFINED 9 #define GrTessellatingPathRenderer_DEFINED
10 10
11 #include "SkChunkAlloc.h"
11 #include "GrPathRenderer.h" 12 #include "GrPathRenderer.h"
12 13
14 #define TESSELLATION_LOGGING_ENABLED 0
15
16 struct TessellatingVertex;
17 struct Poly;
18 struct Edge;
19
20 /**
21 * Vertices are used in three ways: first, the path contours are converted into a
bsalomon 2016/01/13 19:15:34 I thought you already moved all this stuff to a ut
ethannicholas 2016/01/20 17:51:05 I did; just failed to quash this during the merge.
22 * circularly-linked list of Vertices for each contour. After edge construction, the same Vertices
23 * are re-ordered by the merge sort according to the sweep_lt comparator (usuall y, increasing
24 * in Y) using the same fPrev/fNext pointers that were used for the contours, to avoid
25 * reallocation. Finally, MonotonePolys are built containing a circularly-linked list of
26 * Vertices. (Currently, those Vertices are newly-allocated for the MonotonePoly s, since
27 * an individual TessellatingVertex from the path mesh may belong to multiple
28 * MonotonePolys, so the original Vertices cannot be re-used.
29 */
30
31 struct WindingVertex {
32 SkPoint fPos;
33 int fWinding;
34 };
35
36 struct TessellatingVertex {
37 TessellatingVertex(const SkPoint& point)
38 : fPoint(point), fPrev(nullptr), fNext(nullptr)
39 , fFirstEdgeAbove(nullptr), fLastEdgeAbove(nullptr)
40 , fFirstEdgeBelow(nullptr), fLastEdgeBelow(nullptr)
41 , fProcessed(false)
42 #if TESSELLATION_LOGGING_ENABLED
43 , fID (-1.0f)
44 #endif
45 {}
46 SkPoint fPoint; // Vertex position
47 TessellatingVertex* fPrev; // Linked list of contours, then Y-sorted vertice s.
48 TessellatingVertex* fNext; // "
49 Edge* fFirstEdgeAbove; // Linked list of edges above this vertex.
50 Edge* fLastEdgeAbove; // "
51 Edge* fFirstEdgeBelow; // Linked list of edges below this vertex.
52 Edge* fLastEdgeBelow; // "
53 bool fProcessed; // Has this vertex been seen in simplify()?
54 #if TESSELLATION_LOGGING_ENABLED
55 float fID; // Identifier used for logging.
56 #endif
57 };
58
59 TessellatingVertex* append_point_to_contour(const SkPoint& p, TessellatingVertex * prev,
60 TessellatingVertex** head, SkChunkAl loc& alloc);
61
62 Poly* contours_to_polys(TessellatingVertex** contours, int contourCnt, SkRect bo unds,
63 SkChunkAlloc& alloc);
64
65 int polys_to_vertices(Poly* polys, SkPath::FillType fillType, bool isLinear,
66 WindingVertex** verts);
67
13 /** 68 /**
14 * Subclass that renders the path by converting to screen-space trapezoids plus 69 * Subclass that renders the path by converting to screen-space trapezoids plus
15 * extra 1-pixel geometry for AA. 70 * extra 1-pixel geometry for AA.
16 */ 71 */
17 class SK_API GrTessellatingPathRenderer : public GrPathRenderer { 72 class SK_API GrTessellatingPathRenderer : public GrPathRenderer {
18 public: 73 public:
19 GrTessellatingPathRenderer(); 74 GrTessellatingPathRenderer();
20 75
21 private: 76 private:
22 bool onCanDrawPath(const CanDrawPathArgs& ) const override; 77 bool onCanDrawPath(const CanDrawPathArgs& ) const override;
23 78
24 StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override { 79 StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
25 return GrPathRenderer::kNoSupport_StencilSupport; 80 return GrPathRenderer::kNoSupport_StencilSupport;
26 } 81 }
27 82
28 bool onDrawPath(const DrawPathArgs&) override; 83 bool onDrawPath(const DrawPathArgs&) override;
29 84
30 typedef GrPathRenderer INHERITED; 85 typedef GrPathRenderer INHERITED;
31 }; 86 };
32 87
33 #endif 88 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698