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

Unified Diff: src/gpu/batches/GrTInstanceBatch.h

Issue 1353553002: Create append methods in batch namespaces (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rob's feedback 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/batches/GrNonAAStrokeRectBatch.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « src/gpu/batches/GrNonAAStrokeRectBatch.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698