Index: src/gpu/batches/GrTInstanceBatch.h |
diff --git a/src/gpu/batches/GrTInstanceBatch.h b/src/gpu/batches/GrTInstanceBatch.h |
index 014ec125fe6ae894d2a1317839046298b79615bb..b4bc0c084f903b62756025db077bef2cc0c2d0dc 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) { |