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

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

Issue 1301823002: Put drawPath in GrBatch. (Closed) Base URL: https://skia.googlesource.com/skia.git@nvprbatch
Patch Set: update 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/GrReorderCommandBuilder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrDrawPathBatch.h
diff --git a/src/gpu/batches/GrDrawPathBatch.h b/src/gpu/batches/GrDrawPathBatch.h
new file mode 100644
index 0000000000000000000000000000000000000000..e60a6602f0587d32dedd8655ce53d1c6061b6748
--- /dev/null
+++ b/src/gpu/batches/GrDrawPathBatch.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 GrDrawPathBatch_DEFINED
+#define GrDrawPathBatch_DEFINED
+
+#include "GrDrawBatch.h"
+#include "GrGpu.h"
+#include "GrPath.h"
+#include "GrPathRendering.h"
+#include "GrPathProcessor.h"
+
+class GrDrawPathBatch final : public GrDrawBatch {
+public:
+ // This must return the concrete type because we install the stencil settings late :(
+ static GrDrawPathBatch* Create(const GrPathProcessor* primProc, const GrPath* path) {
+ return SkNEW_ARGS(GrDrawPathBatch, (primProc, path));
+ }
+
+ const char* name() const override { return "DrawPath"; }
+
+ SkString dumpInfo() const override {
+ SkString string;
+ string.printf("PATH: 0x%p", fPath.get());
+ return string;
+ }
+
+ virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const {
+ fPrimitiveProcessor->getInvariantOutputColor(out);
+ }
+
+ virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const {
+ fPrimitiveProcessor->getInvariantOutputCoverage(out);
+ }
+
+ void setStencilSettings(const GrStencilSettings& stencil) { fStencilSettings = stencil; }
+
+private:
+ GrBatchTracker* tracker() { return reinterpret_cast<GrBatchTracker*>(&fWhatchamacallit); }
+ GrDrawPathBatch(const GrPathProcessor* primProc, const GrPath* path)
+ : fPrimitiveProcessor(primProc)
+ , fPath(path) {
+ fBounds = path->getBounds();
+ primProc->viewMatrix().mapRect(&fBounds);
+ this->initClassID<GrDrawPathBatch>();
+ }
+
+ virtual void initBatchTracker(const GrPipelineOptimizations& opts) {
+ fPrimitiveProcessor->initBatchTracker(this->tracker(), opts);
+ }
+
+ bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return false; }
+
+ void onPrepare(GrBatchFlushState*) override {}
+
+ void onDraw(GrBatchFlushState* state) override {
+ GrProgramDesc desc;
+ state->gpu()->buildProgramDesc(&desc, *fPrimitiveProcessor.get(),
+ *this->pipeline(), *this->tracker());
+ GrPathRendering::DrawPathArgs args(fPrimitiveProcessor.get(), this->pipeline(),
+ &desc, this->tracker(), &fStencilSettings);
+ state->gpu()->pathRendering()->drawPath(args, fPath.get());
+ }
+
+ GrPendingProgramElement<const GrPathProcessor> fPrimitiveProcessor;
+ PathBatchTracker fWhatchamacallit; // TODO: delete this
+ GrStencilSettings fStencilSettings;
+ GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
+};
+
+#endif
« no previous file with comments | « src/gpu/GrReorderCommandBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698