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

Side by Side Diff: src/gpu/GrTessellator.h

Issue 1557083002: Broke GrTessellatingPathRenderer's tessellator out into a separate file. (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
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrTessellator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrTessellator_DEFINED
9 #define GrTessellator_DEFINED
10
11 #include "SkChunkAlloc.h"
12 #include "GrPathRenderer.h"
13
14 /**
15 * Provides utility functions for converting paths to a collection of triangles.
16 */
17
18 #define TESSELLATOR_WIREFRAME 0
19
20 namespace GrTessellator {
21
22 struct Poly;
23 struct Edge;
24 struct Vertex;
25
26 struct EdgeList {
27 EdgeList() : fHead(nullptr), fTail(nullptr) {}
28 Edge* fHead;
29 Edge* fTail;
30 };
31
32 struct Edge {
Stephen White 2016/01/05 15:59:04 Does this (and EdgeList) need to be public? It onl
ethannicholas 2016/01/05 16:09:22 It did at one point, but you are of course correct
33 Edge(Vertex* top, Vertex* bottom, int winding)
34 : fTop(top)
35 , fBottom(bottom)
36 , fWinding(winding)
37 , fLeft(nullptr)
38 , fRight(nullptr)
39 , fPrevEdgeAbove(nullptr)
40 , fNextEdgeAbove(nullptr)
41 , fPrevEdgeBelow(nullptr)
42 , fNextEdgeBelow(nullptr)
43 , fLeftPoly(nullptr)
44 , fRightPoly(nullptr) {
45 recompute();
46 }
47 Vertex* fTop; // The top vertex in vertex-sort-order (sweep_lt).
48 Vertex* fBottom; // The bottom vertex in vertex-sort-order.
49 int fWinding; // 1 == edge goes downward; -1 = edge goes upward.
50 Edge* fLeft; // The linked list of edges in the active edge list.
51 Edge* fRight; // "
52 Edge* fPrevEdgeAbove; // The linked list of edges in the bottom Vertex's "e dges above".
53 Edge* fNextEdgeAbove; // "
54 Edge* fPrevEdgeBelow; // The linked list of edges in the top Vertex's "edge s below".
55 Edge* fNextEdgeBelow; // "
56 Poly* fLeftPoly; // The Poly to the left of this edge, if any.
57 Poly* fRightPoly; // The Poly to the right of this edge, if any.
58 double fDX; // The line equation for this edge, in implicit form.
59 double fDY; // fDY * x + fDX * y + fC = 0, for point (x, y) on th e line.
60 double fC;
61 double dist(const SkPoint& p) const;
62 bool isRightOf(Vertex* v) const;
63 bool isLeftOf(Vertex* v) const;
64 void recompute();
65 bool intersect(const Edge& other, SkPoint* p);
66 bool isActive(EdgeList* activeEdges) const;
67 };
68
69 struct WindingVertex {
70 SkPoint fPos;
71 int fWinding;
72 };
73
74 // creates an array of (point, winding) vertices and sets the 'verts' out parame ter to point to it.
75 // CALLER IS RESPONSIBLE for deleting this buffer to avoid a memory leak!
76 int PathToVertices(const SkPath& path, SkScalar tolerance, const SkRect& clipBou nds,
77 WindingVertex** verts);
78
79 int PathToTriangles(const SkPath& path, SkScalar tolerance, const SkRect& clipBo unds,
80 GrResourceProvider* resourceProvider,
81 SkAutoTUnref<GrVertexBuffer>& vertexBuffer, bool canMapVB, b ool* isLinear);
82
83 }
84
85 #endif
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | src/gpu/GrTessellator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698