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

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

Issue 1301203002: Revert "fill rect batch refactor into separate batches" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/GrBWFillRectBatch.cpp ('k') | no next file » | 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
11 #include "GrVertexBatch.h" 11 #include "GrVertexBatch.h"
12 12
13 #include "GrBatchFlushState.h" 13 #include "GrBatchFlushState.h"
14 14
15 /** 15 /**
16 * GrTInstanceBatch is an optional template to help with writing batches 16 * GrTInstanceBatch is an optional template to help with writing batches
17 * To use this template, The 'Impl' must define the following statics: 17 * To use this template, The 'Impl' must define the following statics:
18 * A Geometry struct 18 * A Geometry struct
19 * 19 *
20 * static const int kVertsPerInstance 20 * static const int kVertsPerInstance
21 * static const int kIndicesPerInstance 21 * static const int kIndicesPerInstance
22 * 22 *
23 * const char* Name() 23 * const char* Name()
24 * 24 *
25 * void SetBounds(const Geometry& seedGeometry, SkRect* outBounds)
26 *
27 * bool CanCombine(const Geometry& mine, const Geometry& theirs, 25 * bool CanCombine(const Geometry& mine, const Geometry& theirs,
28 * const GrPipelineOptimizations&) 26 * const GrPipelineOptimizations&)
29 * 27 *
30 * const GrGeometryProcessor* CreateGP(const Geometry& seedGeometry, 28 * const GrGeometryProcessor* CreateGP(const Geometry& seedGeometry,
31 * const GrPipelineOptimizations& opts) 29 * const GrPipelineOptimizations& opts)
32 * 30 *
33 * const GrIndexBuffer* GetIndexBuffer(GrResourceProvider*) 31 * const GrIndexBuffer* GetIndexBuffer(GrResourceProvider*)
34 * 32 *
35 * Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo, 33 * Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo,
36 * const GrPipelineOptimizations& opts) 34 * const GrPipelineOptimizations& opts)
(...skipping 24 matching lines...) Expand all
61 } 59 }
62 60
63 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 61 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
64 62
65 // to avoid even the initial copy of the struct, we have a getter for the fi rst item which 63 // to avoid even the initial copy of the struct, we have a getter for the fi rst item which
66 // is used to seed the batch with its initial geometry. After seeding, the client should call 64 // is used to seed the batch with its initial geometry. After seeding, the client should call
67 // init() so the Batch can initialize itself 65 // init() so the Batch can initialize itself
68 Geometry* geometry() { return &fGeoData[0]; } 66 Geometry* geometry() { return &fGeoData[0]; }
69 void init() { 67 void init() {
70 const Geometry& geo = fGeoData[0]; 68 const Geometry& geo = fGeoData[0];
71 Impl::SetBounds(geo, &fBounds); 69 this->setBounds(geo.fDevRect);
72 } 70 }
73 71
74 private: 72 private:
75 GrTInstanceBatch() { 73 GrTInstanceBatch() {
76 this->initClassID<GrTInstanceBatch<Impl>>(); 74 this->initClassID<GrTInstanceBatch<Impl>>();
77 75
78 // Push back an initial geometry 76 // Push back an initial geometry
79 fGeoData.push_back(); 77 fGeoData.push_back();
80 } 78 }
81 79
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ; 130 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()) ;
133 this->joinBounds(that->bounds()); 131 this->joinBounds(that->bounds());
134 return true; 132 return true;
135 } 133 }
136 134
137 GrPipelineOptimizations fOpts; 135 GrPipelineOptimizations fOpts;
138 SkSTArray<1, Geometry, true> fGeoData; 136 SkSTArray<1, Geometry, true> fGeoData;
139 }; 137 };
140 138
141 #endif 139 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrBWFillRectBatch.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698