OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 SkVertState_DEFINED | 8 #ifndef SkVertState_DEFINED |
9 #define SkVertState_DEFINED | 9 #define SkVertState_DEFINED |
10 | 10 |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 | 12 |
13 /** \struct VertState | 13 /** \struct VertState |
14 This is a helper for drawVertices(). It is used to iterate over the triangle
s | 14 This is a helper for drawVertices(). It is used to iterate over the triangle
s |
15 that are to be rendered based on an SkCanvas::VertexMode and (optionally) an | 15 that are to be rendered based on an SkCanvas::VertexMode and (optionally) an |
16 index array. It does not copy the index array and the client must ensure it | 16 index array. It does not copy the index array and the client must ensure it |
17 remains valid for the lifetime of the VertState object. | 17 remains valid for the lifetime of the VertState object. |
18 */ | 18 */ |
19 | 19 |
20 struct VertState { | 20 struct VertState { |
21 int f0, f1, f2; | 21 int f0, f1, f2; |
22 | 22 |
23 /** | 23 /** |
24 * Construct a VertState from a vertex count, index array, and index count. | 24 * Construct a VertState from a vertex count, index array, and index count. |
25 * If the vertices are unindexed pass NULL for indices. | 25 * If the vertices are unindexed pass nullptr for indices. |
26 */ | 26 */ |
27 VertState(int vCount, const uint16_t indices[], int indexCount) | 27 VertState(int vCount, const uint16_t indices[], int indexCount) |
28 : fIndices(indices) { | 28 : fIndices(indices) { |
29 fCurrIndex = 0; | 29 fCurrIndex = 0; |
30 if (indices) { | 30 if (indices) { |
31 fCount = indexCount; | 31 fCount = indexCount; |
32 } else { | 32 } else { |
33 fCount = vCount; | 33 fCount = vCount; |
34 } | 34 } |
35 } | 35 } |
(...skipping 13 matching lines...) Expand all Loading... |
49 | 49 |
50 static bool Triangles(VertState*); | 50 static bool Triangles(VertState*); |
51 static bool TrianglesX(VertState*); | 51 static bool TrianglesX(VertState*); |
52 static bool TriangleStrip(VertState*); | 52 static bool TriangleStrip(VertState*); |
53 static bool TriangleStripX(VertState*); | 53 static bool TriangleStripX(VertState*); |
54 static bool TriangleFan(VertState*); | 54 static bool TriangleFan(VertState*); |
55 static bool TriangleFanX(VertState*); | 55 static bool TriangleFanX(VertState*); |
56 }; | 56 }; |
57 | 57 |
58 #endif | 58 #endif |
OLD | NEW |