Index: src/gpu/batches/GrAAFillRectBatch.h |
diff --git a/src/gpu/batches/GrAAFillRectBatch.h b/src/gpu/batches/GrAAFillRectBatch.h |
index fdce84cbc76c4e24b966bf764671c28217c0a4e7..6ce8f513fed19b172fffae708086ea5bb6257f89 100644 |
--- a/src/gpu/batches/GrAAFillRectBatch.h |
+++ b/src/gpu/batches/GrAAFillRectBatch.h |
@@ -8,84 +8,19 @@ |
#ifndef GrAAFillRectBatch_DEFINED |
#define GrAAFillRectBatch_DEFINED |
-#include "GrBatch.h" |
#include "GrColor.h" |
-#include "GrTypes.h" |
-#include "SkMatrix.h" |
-#include "SkRect.h" |
-class GrAAFillRectBatch : public GrBatch { |
-public: |
- struct Geometry { |
- GrColor fColor; |
- SkMatrix fViewMatrix; |
- SkRect fRect; |
- SkRect fDevRect; |
- }; |
+class GrBatch; |
+class SkMatrix; |
+struct SkRect; |
- static GrBatch* Create(const Geometry& geometry) { |
- return SkNEW_ARGS(GrAAFillRectBatch, (geometry)); |
- } |
+namespace GrAAFillRectBatch { |
- const char* name() const override { return "AAFillRectBatch"; } |
+GrBatch* Create(GrColor color, |
+ const SkMatrix& viewMatrix, |
+ const SkRect& rect, |
+ const SkRect& devRect); |
- void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
- // When this is called on a batch, there is only one geometry bundle |
- out->setKnownFourComponents(fGeoData[0].fColor); |
- } |
- |
- void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
- out->setUnknownSingleComponent(); |
- } |
- |
- void initBatchTracker(const GrPipelineOptimizations&) override; |
- |
- void generateGeometry(GrBatchTarget* batchTarget) override; |
- |
- SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
- |
-private: |
- GrAAFillRectBatch(const Geometry& geometry) { |
- this->initClassID<GrAAFillRectBatch>(); |
- fGeoData.push_back(geometry); |
- |
- this->setBounds(geometry.fDevRect); |
- } |
- |
- static const int kNumAAFillRectsInIndexBuffer = 256; |
- static const int kVertsPerAAFillRect = 8; |
- static const int kIndicesPerAAFillRect = 30; |
- |
- const GrIndexBuffer* getIndexBuffer(GrResourceProvider* resourceProvider); |
- |
- 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) override; |
- |
- void generateAAFillRectGeometry(void* vertices, |
- size_t offset, |
- size_t vertexStride, |
- GrColor color, |
- const SkMatrix& viewMatrix, |
- const SkRect& rect, |
- const SkRect& devRect, |
- bool tweakAlphaForCoverage) const; |
- |
- struct BatchTracker { |
- GrColor fColor; |
- bool fUsesLocalCoords; |
- bool fColorIgnored; |
- bool fCoverageIgnored; |
- bool fCanTweakAlphaForCoverage; |
- }; |
- |
- BatchTracker fBatch; |
- SkSTArray<1, Geometry, true> fGeoData; |
}; |
#endif |