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

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

Issue 1274013003: Move GrDrawAtlasBatch to separate file (Closed) Base URL: https://skia.googlesource.com/skia.git@drawAtlas-08-06
Patch Set: Move to batches dir 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/GrDrawContext.cpp ('k') | src/gpu/batches/GrDrawAtlasBatch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrDrawAtlasBatch.h
diff --git a/src/gpu/batches/GrDrawAtlasBatch.h b/src/gpu/batches/GrDrawAtlasBatch.h
new file mode 100644
index 0000000000000000000000000000000000000000..3a47b718cf9130ff0f2a608261b74bbeecc64a29
--- /dev/null
+++ b/src/gpu/batches/GrDrawAtlasBatch.h
@@ -0,0 +1,75 @@
+/*
+ * 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 GrDrawAtlasBatch_DEFINED
+#define GrDrawAtlasBatch_DEFINED
+
+#include "GrBatch.h"
+#include "GrColor.h"
+#include "GrDefaultGeoProcFactory.h"
+
+class GrDrawAtlasBatch : public GrBatch {
+public:
+ struct Geometry {
+ GrColor fColor;
+ SkTDArray<SkPoint> fPositions;
+ SkTDArray<GrColor> fColors;
+ SkTDArray<SkPoint> fLocalCoords;
+ };
+
+ static GrBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix,
+ const SkPoint* positions, int vertexCount,
+ const GrColor* colors, const SkPoint* localCoords,
+ const SkRect& bounds) {
+ return SkNEW_ARGS(GrDrawAtlasBatch, (geometry, viewMatrix, positions,
+ vertexCount, colors, localCoords, bounds));
+ }
+
+ const char* name() const override { return "DrawAtlasBatch"; }
+
+ void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
+ // When this is called on a batch, there is only one geometry bundle
+ if (this->hasColors()) {
+ out->setUnknownFourComponents();
+ } else {
+ out->setKnownFourComponents(fGeoData[0].fColor);
+ }
+ }
+
+ void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
+ out->setKnownSingleComponent(0xff);
+ }
+
+ void initBatchTracker(const GrPipelineInfo& init) override;
+ void generateGeometry(GrBatchTarget* batchTarget) override;
+
+ SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
+
+private:
+ GrDrawAtlasBatch(const Geometry& geometry, const SkMatrix& viewMatrix,
+ const SkPoint* positions, int vertexCount,
+ const GrColor* colors, const SkPoint* localCoords, const SkRect& bounds);
+
+ GrColor color() const { return fColor; }
+ bool colorIgnored() const { return fColorIgnored; }
+ const SkMatrix& viewMatrix() const { return fViewMatrix; }
+ bool hasColors() const { return fHasColors; }
+ int vertexCount() const { return fVertexCount; }
+ bool coverageIgnored() const { return fCoverageIgnored; }
+
+ bool onCombineIfPossible(GrBatch* t) override;
+ SkSTArray<1, Geometry, true> fGeoData;
+
+ SkMatrix fViewMatrix;
+ GrColor fColor;
+ int fVertexCount;
+ bool fColorIgnored;
+ bool fCoverageIgnored;
+ bool fHasColors;
+};
+
+#endif
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/batches/GrDrawAtlasBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698