| OLD | NEW |
| 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 GrTessellator_DEFINED | 8 #ifndef GrTessellator_DEFINED |
| 9 #define GrTessellator_DEFINED | 9 #define GrTessellator_DEFINED |
| 10 | 10 |
| 11 #include "SkPath.h" | 11 #include "SkPoint.h" |
| 12 #include "GrResourceProvider.h" | 12 |
| 13 class SkPath; |
| 14 struct SkRect; |
| 13 | 15 |
| 14 /** | 16 /** |
| 15 * Provides utility functions for converting paths to a collection of triangles. | 17 * Provides utility functions for converting paths to a collection of triangles. |
| 16 */ | 18 */ |
| 17 | 19 |
| 18 #define TESSELLATOR_WIREFRAME 0 | 20 #define TESSELLATOR_WIREFRAME 0 |
| 19 | 21 |
| 20 namespace GrTessellator { | 22 namespace GrTessellator { |
| 21 | 23 |
| 24 class VertexAllocator { |
| 25 public: |
| 26 virtual ~VertexAllocator() {} |
| 27 virtual SkPoint* lock(int vertexCount) = 0; |
| 28 virtual void unlock(int actualCount) = 0; |
| 29 }; |
| 30 |
| 22 struct WindingVertex { | 31 struct WindingVertex { |
| 23 SkPoint fPos; | 32 SkPoint fPos; |
| 24 int fWinding; | 33 int fWinding; |
| 25 }; | 34 }; |
| 26 | 35 |
| 27 // Triangulates a path to an array of vertices. Each triangle is represented as
a set of three | 36 // Triangulates a path to an array of vertices. Each triangle is represented as
a set of three |
| 28 // WindingVertex entries, each of which contains the position and winding count
(which is the same | 37 // WindingVertex entries, each of which contains the position and winding count
(which is the same |
| 29 // for all three vertices of a triangle). The 'verts' out parameter is set to po
int to the resultant | 38 // for all three vertices of a triangle). The 'verts' out parameter is set to po
int to the resultant |
| 30 // vertex array. CALLER IS RESPONSIBLE for deleting this buffer to avoid a memor
y leak! | 39 // vertex array. CALLER IS RESPONSIBLE for deleting this buffer to avoid a memor
y leak! |
| 31 int PathToVertices(const SkPath& path, SkScalar tolerance, const SkRect& clipBou
nds, | 40 int PathToVertices(const SkPath& path, SkScalar tolerance, const SkRect& clipBou
nds, |
| 32 WindingVertex** verts); | 41 WindingVertex** verts); |
| 33 | 42 |
| 34 int PathToTriangles(const SkPath& path, SkScalar tolerance, const SkRect& clipBo
unds, | 43 int PathToTriangles(const SkPath& path, SkScalar tolerance, const SkRect& clipBo
unds, |
| 35 GrResourceProvider* resourceProvider, | 44 VertexAllocator*, bool *isLinear); |
| 36 SkAutoTUnref<GrVertexBuffer>& vertexBuffer, bool canMapVB, b
ool* isLinear); | |
| 37 | |
| 38 } | 45 } |
| 39 | 46 |
| 40 #endif | 47 #endif |
| OLD | NEW |