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 GrTInstanceBatch_DEFINED | 8 #ifndef GrTInstanceBatch_DEFINED |
9 #define GrTInstanceBatch_DEFINED | 9 #define GrTInstanceBatch_DEFINED |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 * const GrIndexBuffer* GetIndexBuffer(GrResourceProvider*) | 35 * const GrIndexBuffer* GetIndexBuffer(GrResourceProvider*) |
36 * | 36 * |
37 * Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo, | 37 * Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo, |
38 * const GrPipelineOptimizations& opts) | 38 * const GrPipelineOptimizations& opts) |
39 */ | 39 */ |
40 template <typename Impl> | 40 template <typename Impl> |
41 class GrTInstanceBatch : public GrVertexBatch { | 41 class GrTInstanceBatch : public GrVertexBatch { |
42 public: | 42 public: |
43 typedef typename Impl::Geometry Geometry; | 43 typedef typename Impl::Geometry Geometry; |
44 | 44 |
45 static GrTInstanceBatch* Create() { | 45 static GrTInstanceBatch* Create() { return new GrTInstanceBatch; } |
46 return SkNEW(GrTInstanceBatch); | |
47 } | |
48 | 46 |
49 const char* name() const override { return Impl::Name(); } | 47 const char* name() const override { return Impl::Name(); } |
50 | 48 |
51 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 49 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
52 // When this is called on a batch, there is only one geometry bundle | 50 // When this is called on a batch, there is only one geometry bundle |
53 out->setKnownFourComponents(fGeoData[0].fColor); | 51 out->setKnownFourComponents(fGeoData[0].fColor); |
54 } | 52 } |
55 | 53 |
56 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 54 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
57 Impl::InitInvariantOutputCoverage(out); | 55 Impl::InitInvariantOutputCoverage(out); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; | 132 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; |
135 this->joinBounds(that->bounds()); | 133 this->joinBounds(that->bounds()); |
136 return true; | 134 return true; |
137 } | 135 } |
138 | 136 |
139 GrPipelineOptimizations fOpts; | 137 GrPipelineOptimizations fOpts; |
140 SkSTArray<1, Geometry, true> fGeoData; | 138 SkSTArray<1, Geometry, true> fGeoData; |
141 }; | 139 }; |
142 | 140 |
143 #endif | 141 #endif |
OLD | NEW |