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

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

Issue 1353683003: Move StrokeRectBatches into .cpp files (Closed) Base URL: https://skia.googlesource.com/skia.git@statics
Patch Set: tweaks 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
Index: src/gpu/batches/GrAAStrokeRectBatch.h
diff --git a/src/gpu/batches/GrAAStrokeRectBatch.h b/src/gpu/batches/GrAAStrokeRectBatch.h
index fad5bd9d8df8293fe8465a4207a7ccb39ad787d8..20205a19c38a8007898f5df2e62ff883ce482bd7 100644
--- a/src/gpu/batches/GrAAStrokeRectBatch.h
+++ b/src/gpu/batches/GrAAStrokeRectBatch.h
@@ -16,100 +16,15 @@
class GrResourceProvider;
-class GrAAStrokeRectBatch : public GrVertexBatch {
-public:
- DEFINE_BATCH_CLASS_ID
+namespace GrAAStrokeRectBatch {
- // TODO support AA rotated stroke rects by copying around view matrices
- struct Geometry {
- GrColor fColor;
- SkRect fDevOutside;
- SkRect fDevOutsideAssist;
- SkRect fDevInside;
- bool fMiterStroke;
- };
+GrDrawBatch* Create(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& devOutside,
+ const SkRect& devOutsideAssist,
+ const SkRect& devInside,
+ bool miterStroke);
- static GrDrawBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix) {
- return new GrAAStrokeRectBatch(geometry, viewMatrix);
- }
-
- const char* name() const override { return "AAStrokeRect"; }
-
- 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();
- }
-
- SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
-
-private:
- void onPrepareDraws(Target*) override;
- void initBatchTracker(const GrPipelineOptimizations&) override;
-
- GrAAStrokeRectBatch(const Geometry& geometry, const SkMatrix& viewMatrix)
- : INHERITED(ClassID()) {
- fBatch.fViewMatrix = viewMatrix;
- fGeoData.push_back(geometry);
-
- // If we have miterstroke then we inset devOutside and outset devOutsideAssist, so we need
- // the join for proper bounds
- fBounds = geometry.fDevOutside;
- fBounds.join(geometry.fDevOutsideAssist);
- }
-
-
- static const int kMiterIndexCnt = 3 * 24;
- static const int kMiterVertexCnt = 16;
- static const int kNumMiterRectsInIndexBuffer = 256;
-
- static const int kBevelIndexCnt = 48 + 36 + 24;
- static const int kBevelVertexCnt = 24;
- static const int kNumBevelRectsInIndexBuffer = 256;
-
- static const GrIndexBuffer* GetIndexBuffer(GrResourceProvider* resourceProvider,
- bool miterStroke);
-
- 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 fBatch.fViewMatrix; }
- bool miterStroke() const { return fBatch.fMiterStroke; }
- bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
-
- bool onCombineIfPossible(GrBatch* t, const GrCaps&) override;
-
- void generateAAStrokeRectGeometry(void* vertices,
- size_t offset,
- size_t vertexStride,
- int outerVertexNum,
- int innerVertexNum,
- GrColor color,
- const SkRect& devOutside,
- const SkRect& devOutsideAssist,
- const SkRect& devInside,
- bool miterStroke,
- bool tweakAlphaForCoverage) const;
-
- struct BatchTracker {
- SkMatrix fViewMatrix;
- GrColor fColor;
- bool fUsesLocalCoords;
- bool fColorIgnored;
- bool fCoverageIgnored;
- bool fMiterStroke;
- bool fCanTweakAlphaForCoverage;
- };
-
- BatchTracker fBatch;
- SkSTArray<1, Geometry, true> fGeoData;
-
- typedef GrVertexBatch INHERITED;
};
-
#endif

Powered by Google App Engine
This is Rietveld 408576698