aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTessellator.h
diff options
context:
space:
mode:
authorGravatar ethannicholas <ethannicholas@google.com>2016-01-07 13:34:16 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-07 13:34:16 -0800
commite9709e831954c3427d5cb839e84221a177bfedeb (patch)
treeac16e276fd2c8262126fb021eae51af0d19833b9 /src/gpu/GrTessellator.h
parent94da292e39db0d41da08b1d6055ca5e0d6b498cc (diff)
Broke GrTessellatingPathRenderer's tessellator out into a separate file.
Diffstat (limited to 'src/gpu/GrTessellator.h')
-rw-r--r--src/gpu/GrTessellator.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gpu/GrTessellator.h b/src/gpu/GrTessellator.h
new file mode 100644
index 0000000000..4304920fbc
--- /dev/null
+++ b/src/gpu/GrTessellator.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrTessellator_DEFINED
+#define GrTessellator_DEFINED
+
+#include "SkPath.h"
+#include "GrResourceProvider.h"
+
+/**
+ * Provides utility functions for converting paths to a collection of triangles.
+ */
+
+#define TESSELLATOR_WIREFRAME 0
+
+namespace GrTessellator {
+
+struct WindingVertex {
+ SkPoint fPos;
+ int fWinding;
+};
+
+// Triangulates a path to an array of vertices. Each triangle is represented as a set of three
+// WindingVertex entries, each of which contains the position and winding count (which is the same
+// for all three vertices of a triangle). The 'verts' out parameter is set to point to the resultant
+// vertex array. CALLER IS RESPONSIBLE for deleting this buffer to avoid a memory leak!
+int PathToVertices(const SkPath& path, SkScalar tolerance, const SkRect& clipBounds,
+ WindingVertex** verts);
+
+int PathToTriangles(const SkPath& path, SkScalar tolerance, const SkRect& clipBounds,
+ GrResourceProvider* resourceProvider,
+ SkAutoTUnref<GrVertexBuffer>& vertexBuffer, bool canMapVB, bool* isLinear);
+
+}
+
+#endif