Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: src/gpu/batches/GrTInstanceBatch.h

Issue 1345393003: Revert of add a ClassID function to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/batches/GrStrokeRectBatch.cpp ('k') | src/gpu/batches/GrTessellatingPathRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 22 matching lines...) Expand all
33 * const GrPipelineOptimizations& opts) 33 * const GrPipelineOptimizations& opts)
34 * 34 *
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 DEFINE_BATCH_CLASS_ID
44
45 typedef typename Impl::Geometry Geometry; 43 typedef typename Impl::Geometry Geometry;
46 44
47 static GrTInstanceBatch* Create() { return new GrTInstanceBatch; } 45 static GrTInstanceBatch* Create() { return new GrTInstanceBatch; }
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 }
(...skipping 12 matching lines...) Expand all
67 // to avoid even the initial copy of the struct, we have a getter for the fi rst item which 65 // to avoid even the initial copy of the struct, we have a getter for the fi rst item which
68 // is used to seed the batch with its initial geometry. After seeding, the client should call 66 // is used to seed the batch with its initial geometry. After seeding, the client should call
69 // init() so the Batch can initialize itself 67 // init() so the Batch can initialize itself
70 Geometry* geometry() { return &fGeoData[0]; } 68 Geometry* geometry() { return &fGeoData[0]; }
71 void init() { 69 void init() {
72 const Geometry& geo = fGeoData[0]; 70 const Geometry& geo = fGeoData[0];
73 Impl::SetBounds(geo, &fBounds); 71 Impl::SetBounds(geo, &fBounds);
74 } 72 }
75 73
76 private: 74 private:
77 GrTInstanceBatch() : INHERITED(ClassID()) { 75 GrTInstanceBatch() {
76 this->initClassID<GrTInstanceBatch<Impl>>();
77
78 // Push back an initial geometry 78 // Push back an initial geometry
79 fGeoData.push_back(); 79 fGeoData.push_back();
80 } 80 }
81 81
82 void onPrepareDraws(Target* target) override { 82 void onPrepareDraws(Target* target) override {
83 SkAutoTUnref<const GrGeometryProcessor> gp(Impl::CreateGP(this->seedGeom etry(), fOpts)); 83 SkAutoTUnref<const GrGeometryProcessor> gp(Impl::CreateGP(this->seedGeom etry(), fOpts));
84 if (!gp) { 84 if (!gp) {
85 SkDebugf("Couldn't create GrGeometryProcessor\n"); 85 SkDebugf("Couldn't create GrGeometryProcessor\n");
86 return; 86 return;
87 } 87 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 fOpts = that->fOpts; 129 fOpts = that->fOpts;
130 } 130 }
131 131
132 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ; 132 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
133 this->joinBounds(that->bounds()); 133 this->joinBounds(that->bounds());
134 return true; 134 return true;
135 } 135 }
136 136
137 GrPipelineOptimizations fOpts; 137 GrPipelineOptimizations fOpts;
138 SkSTArray<1, Geometry, true> fGeoData; 138 SkSTArray<1, Geometry, true> fGeoData;
139
140 typedef GrVertexBatch INHERITED;
141 }; 139 };
142 140
143 #endif 141 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrStrokeRectBatch.cpp ('k') | src/gpu/batches/GrTessellatingPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698