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

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

Issue 1278043003: Move AAFillRect into CPP for templatization (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 4 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 | « no previous file | src/gpu/batches/GrAAFillRectBatch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | src/gpu/batches/GrAAFillRectBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698