aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrTInstanceBatch.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/batches/GrTInstanceBatch.h')
-rw-r--r--src/gpu/batches/GrTInstanceBatch.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gpu/batches/GrTInstanceBatch.h b/src/gpu/batches/GrTInstanceBatch.h
index 014ec125fe..b4bc0c084f 100644
--- a/src/gpu/batches/GrTInstanceBatch.h
+++ b/src/gpu/batches/GrTInstanceBatch.h
@@ -26,6 +26,8 @@
*
* void SetBounds(const Geometry& seedGeometry, SkRect* outBounds)
*
+ * void UpdateBoundsAfterAppend(const Geometry& lastGeometry, SkRect* currentBounds)
+ *
* bool CanCombine(const Geometry& mine, const Geometry& theirs,
* const GrPipelineOptimizations&)
*
@@ -64,21 +66,20 @@ public:
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
- // to avoid even the initial copy of the struct, we have a getter for the first item which
- // is used to seed the batch with its initial geometry. After seeding, the client should call
- // init() so the Batch can initialize itself
- Geometry* geometry() { return &fGeoData[0]; }
+ // After seeding, the client should call init() so the Batch can initialize itself
void init() {
const Geometry& geo = fGeoData[0];
Impl::SetBounds(geo, &fBounds);
}
-private:
- GrTInstanceBatch() : INHERITED(ClassID()) {
- // Push back an initial geometry
- fGeoData.push_back();
+ void updateBoundsAfterAppend() {
+ const Geometry& geo = fGeoData.back();
+ Impl::UpdateBoundsAfterAppend(geo, &fBounds);
}
+private:
+ GrTInstanceBatch() : INHERITED(ClassID()) {}
+
void onPrepareDraws(Target* target) override {
SkAutoTUnref<const GrGeometryProcessor> gp(Impl::CreateGP(this->seedGeometry(), fOpts));
if (!gp) {