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 GrDrawVerticesBatch_DEFINED | 8 #ifndef GrDrawVerticesBatch_DEFINED |
9 #define GrDrawVerticesBatch_DEFINED | 9 #define GrDrawVerticesBatch_DEFINED |
10 | 10 |
11 #include "GrBatch.h" | 11 #include "GrBatch.h" |
12 #include "GrColor.h" | 12 #include "GrColor.h" |
13 #include "GrTypes.h" | 13 #include "GrTypes.h" |
14 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
15 #include "SkRect.h" | 15 #include "SkRect.h" |
16 #include "SkTDArray.h" | 16 #include "SkTDArray.h" |
17 | 17 |
18 class GrBatchTarget; | 18 class GrBatchTarget; |
19 struct GrInitInvariantOutput; | 19 struct GrInitInvariantOutput; |
20 | 20 |
21 class GrDrawVerticesBatch : public GrBatch { | 21 class GrDrawVerticesBatch : public GrVertexBatch { |
22 public: | 22 public: |
23 struct Geometry { | 23 struct Geometry { |
24 GrColor fColor; | 24 GrColor fColor; |
25 SkTDArray<SkPoint> fPositions; | 25 SkTDArray<SkPoint> fPositions; |
26 SkTDArray<uint16_t> fIndices; | 26 SkTDArray<uint16_t> fIndices; |
27 SkTDArray<GrColor> fColors; | 27 SkTDArray<GrColor> fColors; |
28 SkTDArray<SkPoint> fLocalCoords; | 28 SkTDArray<SkPoint> fLocalCoords; |
29 }; | 29 }; |
30 | 30 |
31 static GrBatch* Create(const Geometry& geometry, GrPrimitiveType primitiveTy
pe, | 31 static GrDrawBatch* Create(const Geometry& geometry, GrPrimitiveType primiti
veType, |
32 const SkMatrix& viewMatrix, | 32 const SkMatrix& viewMatrix, |
33 const SkPoint* positions, int vertexCount, | 33 const SkPoint* positions, int vertexCount, |
34 const uint16_t* indices, int indexCount, | 34 const uint16_t* indices, int indexCount, |
35 const GrColor* colors, const SkPoint* localCoords, | 35 const GrColor* colors, const SkPoint* localCoords
, |
36 const SkRect& bounds) { | 36 const SkRect& bounds) { |
37 return SkNEW_ARGS(GrDrawVerticesBatch, (geometry, primitiveType, viewMat
rix, positions, | 37 return SkNEW_ARGS(GrDrawVerticesBatch, (geometry, primitiveType, viewMat
rix, positions, |
38 vertexCount, indices, indexCount
, colors, | 38 vertexCount, indices, indexCount
, colors, |
39 localCoords, bounds)); | 39 localCoords, bounds)); |
40 } | 40 } |
41 | 41 |
42 const char* name() const override { return "DrawVerticesBatch"; } | 42 const char* name() const override { return "DrawVerticesBatch"; } |
43 | 43 |
44 void getInvariantOutputColor(GrInitInvariantOutput* out) const override; | 44 void getInvariantOutputColor(GrInitInvariantOutput* out) const override; |
45 | 45 |
46 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override; | 46 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 bool fHasLocalCoords; | 89 bool fHasLocalCoords; |
90 int fVertexCount; | 90 int fVertexCount; |
91 int fIndexCount; | 91 int fIndexCount; |
92 }; | 92 }; |
93 | 93 |
94 BatchTracker fBatch; | 94 BatchTracker fBatch; |
95 SkSTArray<1, Geometry, true> fGeoData; | 95 SkSTArray<1, Geometry, true> fGeoData; |
96 }; | 96 }; |
97 | 97 |
98 #endif | 98 #endif |
OLD | NEW |