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

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

Issue 1282723004: move Stroke Rect and AAFill Rect to their own file (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « src/gpu/GrAARectRenderer.cpp ('k') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..c852eb100201f8f9d97185bc144c9618c711be20
--- /dev/null
+++ b/src/gpu/batches/GrAAFillRectBatch.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#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;
+ };
+
+ static GrBatch* Create(const Geometry& geometry) {
+ return SkNEW_ARGS(GrAAFillRectBatch, (geometry));
+ }
+
+ const char* name() const override { return "AAFillRectBatch"; }
+
+ 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 GrPipelineInfo& init) 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 | « src/gpu/GrAARectRenderer.cpp ('k') | src/gpu/batches/GrAAFillRectBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698