aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops/GrDrawOp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/ops/GrDrawOp.cpp')
-rw-r--r--src/gpu/ops/GrDrawOp.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gpu/ops/GrDrawOp.cpp b/src/gpu/ops/GrDrawOp.cpp
new file mode 100644
index 0000000000..3abf2ceba1
--- /dev/null
+++ b/src/gpu/ops/GrDrawOp.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrDrawOp.h"
+
+GrDrawOp::GrDrawOp(uint32_t classID) : INHERITED(classID), fPipelineInstalled(false) { }
+
+GrDrawOp::~GrDrawOp() {
+ if (fPipelineInstalled) {
+ this->pipeline()->~GrPipeline();
+ }
+}
+
+void GrDrawOp::getPipelineOptimizations(GrPipelineOptimizations* opt) const {
+ GrInitInvariantOutput color;
+ GrInitInvariantOutput coverage;
+ this->computePipelineOptimizations(&color, &coverage, &opt->fOverrides);
+ opt->fColorPOI.initUsingInvariantOutput(color);
+ opt->fCoveragePOI.initUsingInvariantOutput(coverage);
+}
+
+bool GrDrawOp::installPipeline(const GrPipeline::CreateArgs& args) {
+ GrXPOverridesForBatch overrides;
+ void* location = fPipelineStorage.get();
+ if (!GrPipeline::CreateAt(location, args, &overrides)) {
+ return false;
+ }
+ fPipelineInstalled = true;
+ this->initBatchTracker(overrides);
+ return true;
+}