Privatize GrBatch subclass overrides
Review URL: https://codereview.chromium.org/1301663002
This commit is contained in:
parent
cf9c475903
commit
e46f9feb44
@ -761,6 +761,8 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -929,7 +931,6 @@ public:
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
AAConvexPathBatch(const Geometry& geometry) {
|
||||
this->initClassID<AAConvexPathBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
|
@ -139,6 +139,7 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
private:
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -273,7 +274,6 @@ public:
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
AADistanceFieldPathBatch(const Geometry& geometry, GrColor color, const SkMatrix& viewMatrix,
|
||||
GrBatchAtlas* atlas,
|
||||
PathCache* pathCache, PathDataList* pathList) {
|
||||
|
@ -694,6 +694,7 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
private:
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -711,7 +712,6 @@ public:
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
void onPrepareDraws(Target*) override;
|
||||
|
||||
typedef SkTArray<SkPoint, true> PtArray;
|
||||
|
@ -139,6 +139,7 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
private:
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -254,7 +255,6 @@ public:
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
AAFlatteningConvexPathBatch(const Geometry& geometry) {
|
||||
this->initClassID<AAFlatteningConvexPathBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
|
@ -1488,6 +1488,28 @@ public:
|
||||
return batch;
|
||||
}
|
||||
|
||||
// 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]; }
|
||||
|
||||
void init() {
|
||||
const Geometry& geo = fGeoData[0];
|
||||
fBatch.fColor = geo.fColor;
|
||||
fBatch.fViewMatrix = geo.fBlob->fViewMatrix;
|
||||
|
||||
// We don't yet position distance field text on the cpu, so we have to map the vertex bounds
|
||||
// into device space
|
||||
const Run& run = geo.fBlob->fRuns[geo.fRun];
|
||||
if (run.fSubRunInfo[geo.fSubRun].fDrawAsDistanceFields) {
|
||||
SkRect bounds = run.fVertexBounds;
|
||||
fBatch.fViewMatrix.mapRect(&bounds);
|
||||
this->setBounds(bounds);
|
||||
} else {
|
||||
this->setBounds(run.fVertexBounds);
|
||||
}
|
||||
}
|
||||
|
||||
const char* name() const override { return "TextBatch"; }
|
||||
|
||||
void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
|
||||
@ -1514,6 +1536,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -1762,28 +1785,6 @@ public:
|
||||
this->flush(target, &flushInfo);
|
||||
}
|
||||
|
||||
// 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]; }
|
||||
void init() {
|
||||
const Geometry& geo = fGeoData[0];
|
||||
fBatch.fColor = geo.fColor;
|
||||
fBatch.fViewMatrix = geo.fBlob->fViewMatrix;
|
||||
|
||||
// We don't yet position distance field text on the cpu, so we have to map the vertex bounds
|
||||
// into device space
|
||||
const Run& run = geo.fBlob->fRuns[geo.fRun];
|
||||
if (run.fSubRunInfo[geo.fSubRun].fDrawAsDistanceFields) {
|
||||
SkRect bounds = run.fVertexBounds;
|
||||
fBatch.fViewMatrix.mapRect(&bounds);
|
||||
this->setBounds(bounds);
|
||||
} else {
|
||||
this->setBounds(run.fVertexBounds);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
TextBatch() {} // initialized in factory functions.
|
||||
|
||||
~TextBatch() {
|
||||
|
@ -234,6 +234,7 @@ public:
|
||||
out->setKnownSingleComponent(this->coverage());
|
||||
}
|
||||
|
||||
private:
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -375,7 +376,6 @@ public:
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix& viewMatrix,
|
||||
bool isHairline, const SkRect& devBounds) {
|
||||
this->initClassID<DefaultPathBatch>();
|
||||
|
@ -651,6 +651,7 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
private:
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -727,7 +728,6 @@ public:
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
CircleBatch(const Geometry& geometry) {
|
||||
this->initClassID<CircleBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
@ -869,6 +869,7 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
private:
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsCoverage()) {
|
||||
@ -950,7 +951,6 @@ public:
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
EllipseBatch(const Geometry& geometry) {
|
||||
this->initClassID<EllipseBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
@ -1137,6 +1137,8 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -1209,7 +1211,6 @@ public:
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) {
|
||||
this->initClassID<DIEllipseBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
@ -1488,6 +1489,7 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
private:
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -1586,7 +1588,6 @@ public:
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
RRectCircleRendererBatch(const Geometry& geometry) {
|
||||
this->initClassID<RRectCircleRendererBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
@ -1664,6 +1665,7 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
private:
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -1772,7 +1774,6 @@ public:
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
RRectEllipseRendererBatch(const Geometry& geometry) {
|
||||
this->initClassID<RRectEllipseRendererBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
|
@ -1405,6 +1405,7 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
private:
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -1570,7 +1571,6 @@ public:
|
||||
|
||||
bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return false; }
|
||||
|
||||
private:
|
||||
TessellatingPathBatch(const GrColor& color,
|
||||
const SkPath& path,
|
||||
const GrStrokeInfo& stroke,
|
||||
|
@ -97,6 +97,32 @@ public:
|
||||
fBatch.fCanTweakAlphaForCoverage = opt.canTweakAlphaForCoverage();
|
||||
}
|
||||
|
||||
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]; }
|
||||
void init() {
|
||||
const Geometry& geo = fGeoData[0];
|
||||
this->setBounds(geo.fDevRect);
|
||||
}
|
||||
|
||||
private:
|
||||
AAFillRectBatch() {
|
||||
this->initClassID<AAFillRectBatch<Base>>();
|
||||
|
||||
// Push back an initial geometry
|
||||
fGeoData.push_back();
|
||||
}
|
||||
|
||||
GrColor color() const { return fBatch.fColor; }
|
||||
bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
|
||||
bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCoverage; }
|
||||
bool colorIgnored() const { return fBatch.fColorIgnored; }
|
||||
const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
|
||||
bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
|
||||
|
||||
void onPrepareDraws(Target* target) override {
|
||||
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
|
||||
|
||||
@ -137,33 +163,6 @@ public:
|
||||
helper.recordDraw(target);
|
||||
}
|
||||
|
||||
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]; }
|
||||
void init() {
|
||||
const Geometry& geo = fGeoData[0];
|
||||
this->setBounds(geo.fDevRect);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
AAFillRectBatch() {
|
||||
this->initClassID<AAFillRectBatch<Base>>();
|
||||
|
||||
// Push back an initial geometry
|
||||
fGeoData.push_back();
|
||||
}
|
||||
|
||||
GrColor color() const { return fBatch.fColor; }
|
||||
bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
|
||||
bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCoverage; }
|
||||
bool colorIgnored() const { return fBatch.fColorIgnored; }
|
||||
const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
|
||||
bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
|
||||
|
||||
bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
|
||||
AAFillRectBatch* that = t->cast<AAFillRectBatch>();
|
||||
if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
|
||||
|
@ -43,7 +43,6 @@ static const GrGeometryProcessor* create_stroke_rect_gp(bool tweakAlphaForCovera
|
||||
return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
|
||||
}
|
||||
|
||||
|
||||
void GrAAStrokeRectBatch::initBatchTracker(const GrPipelineOptimizations& opt) {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
|
@ -42,12 +42,11 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
void onPrepareDraws(Target*) override;
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
GrAAStrokeRectBatch(const Geometry& geometry, const SkMatrix& viewMatrix) {
|
||||
this->initClassID<GrAAStrokeRectBatch>();
|
||||
|
@ -44,6 +44,26 @@ public:
|
||||
out->setKnownSingleComponent(0xff);
|
||||
}
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
BWFillRectBatch(const Geometry& geometry) {
|
||||
this->initClassID<BWFillRectBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
|
||||
fBounds = geometry.fRect;
|
||||
geometry.fViewMatrix.mapRect(&fBounds);
|
||||
}
|
||||
|
||||
GrColor color() const { return fBatch.fColor; }
|
||||
bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
|
||||
bool colorIgnored() const { return fBatch.fColorIgnored; }
|
||||
const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
|
||||
const SkMatrix& localMatrix() const { return fGeoData[0].fLocalMatrix; }
|
||||
bool hasLocalRect() const { return fGeoData[0].fHasLocalRect; }
|
||||
bool hasLocalMatrix() const { return fGeoData[0].fHasLocalMatrix; }
|
||||
bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
|
||||
|
||||
void initBatchTracker(const GrPipelineOptimizations& init) override {
|
||||
// Handle any color overrides
|
||||
if (!init.readsColor()) {
|
||||
@ -113,26 +133,6 @@ public:
|
||||
helper.recordDraw(target);
|
||||
}
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
BWFillRectBatch(const Geometry& geometry) {
|
||||
this->initClassID<BWFillRectBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
|
||||
fBounds = geometry.fRect;
|
||||
geometry.fViewMatrix.mapRect(&fBounds);
|
||||
}
|
||||
|
||||
GrColor color() const { return fBatch.fColor; }
|
||||
bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
|
||||
bool colorIgnored() const { return fBatch.fColorIgnored; }
|
||||
const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; }
|
||||
const SkMatrix& localMatrix() const { return fGeoData[0].fLocalMatrix; }
|
||||
bool hasLocalRect() const { return fGeoData[0].fHasLocalRect; }
|
||||
bool hasLocalMatrix() const { return fGeoData[0].fHasLocalMatrix; }
|
||||
bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
|
||||
|
||||
bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
|
||||
BWFillRectBatch* that = t->cast<BWFillRectBatch>();
|
||||
if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
|
||||
|
@ -40,17 +40,17 @@ public:
|
||||
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
out->setKnownSingleComponent(0xff);
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
|
||||
private:
|
||||
void onPrepareDraws(Target*) override;
|
||||
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
GrDrawAtlasBatch(const Geometry& geometry, const SkMatrix& viewMatrix, int spriteCount,
|
||||
const SkRSXform* xforms, const SkRect* rects, const SkColor* colors);
|
||||
|
||||
|
||||
GrColor color() const { return fColor; }
|
||||
bool colorIgnored() const { return fColorIgnored; }
|
||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||
|
@ -45,12 +45,11 @@ public:
|
||||
|
||||
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override;
|
||||
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
void onPrepareDraws(Target*) override;
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
GrDrawVerticesBatch(const Geometry& geometry, GrPrimitiveType primitiveType,
|
||||
const SkMatrix& viewMatrix,
|
||||
|
@ -36,10 +36,9 @@ public:
|
||||
out->setKnownSingleComponent(0xff);
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
private:
|
||||
void onPrepareDraws(Target*) override;
|
||||
void initBatchTracker(const GrPipelineOptimizations&) override;
|
||||
|
||||
GrStrokeRectBatch(const Geometry& geometry, bool snapToPixelCenters);
|
||||
|
||||
|
@ -272,6 +272,29 @@ public:
|
||||
out->setUnknownSingleComponent();
|
||||
}
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
DashBatch(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode, bool fullDash) {
|
||||
this->initClassID<DashBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
|
||||
fBatch.fAAMode = aaMode;
|
||||
fBatch.fCap = cap;
|
||||
fBatch.fFullDash = fullDash;
|
||||
|
||||
// compute bounds
|
||||
SkScalar halfStrokeWidth = 0.5f * geometry.fSrcStrokeWidth;
|
||||
SkScalar xBloat = SkPaint::kButt_Cap == cap ? 0 : halfStrokeWidth;
|
||||
fBounds.set(geometry.fPtsRot[0], geometry.fPtsRot[1]);
|
||||
fBounds.outset(xBloat, halfStrokeWidth);
|
||||
|
||||
// Note, we actually create the combined matrix here, and save the work
|
||||
SkMatrix& combinedMatrix = fGeoData[0].fSrcRotInv;
|
||||
combinedMatrix.postConcat(geometry.fViewMatrix);
|
||||
combinedMatrix.mapRect(&fBounds);
|
||||
}
|
||||
|
||||
void initBatchTracker(const GrPipelineOptimizations& opt) override {
|
||||
// Handle any color overrides
|
||||
if (!opt.readsColor()) {
|
||||
@ -594,29 +617,6 @@ public:
|
||||
helper.recordDraw(target);
|
||||
}
|
||||
|
||||
SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
|
||||
|
||||
private:
|
||||
DashBatch(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode, bool fullDash) {
|
||||
this->initClassID<DashBatch>();
|
||||
fGeoData.push_back(geometry);
|
||||
|
||||
fBatch.fAAMode = aaMode;
|
||||
fBatch.fCap = cap;
|
||||
fBatch.fFullDash = fullDash;
|
||||
|
||||
// compute bounds
|
||||
SkScalar halfStrokeWidth = 0.5f * geometry.fSrcStrokeWidth;
|
||||
SkScalar xBloat = SkPaint::kButt_Cap == cap ? 0 : halfStrokeWidth;
|
||||
fBounds.set(geometry.fPtsRot[0], geometry.fPtsRot[1]);
|
||||
fBounds.outset(xBloat, halfStrokeWidth);
|
||||
|
||||
// Note, we actually create the combined matrix here, and save the work
|
||||
SkMatrix& combinedMatrix = fGeoData[0].fSrcRotInv;
|
||||
combinedMatrix.postConcat(geometry.fViewMatrix);
|
||||
combinedMatrix.mapRect(&fBounds);
|
||||
}
|
||||
|
||||
bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
|
||||
DashBatch* that = t->cast<DashBatch>();
|
||||
if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
|
||||
|
Loading…
Reference in New Issue
Block a user