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

Unified Diff: src/gpu/GrPendingFragmentStage.h

Issue 739673002: Create GrOptDrawState before recording draw in GrInOrderDrawBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove unused function in pendingprogramelement Created 6 years, 1 month 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/GrOptDrawState.cpp ('k') | src/gpu/GrPendingProgramElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPendingFragmentStage.h
diff --git a/src/gpu/GrPendingFragmentStage.h b/src/gpu/GrPendingFragmentStage.h
new file mode 100644
index 0000000000000000000000000000000000000000..6c61029eca5a4767b4946754af22c0893ba2839f
--- /dev/null
+++ b/src/gpu/GrPendingFragmentStage.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrPendingProcessorStage_DEFINED
+#define GrPendingProcessorStage_DEFINED
+
+#include "GrFragmentStage.h"
+#include "GrCoordTransform.h"
+#include "GrFragmentProcessor.h"
+#include "GrPendingProgramElement.h"
+#include "SkMatrix.h"
+
+/**
+ * This a baked variant of GrFragmentStage, as recorded in GrOptDrawState.
+ */
+class GrPendingFragmentStage {
+public:
+ GrPendingFragmentStage(const GrFragmentStage& stage, bool ignoreMatrix)
+ : fProc(stage.getProcessor())
+ , fCoordChangeMatrix(ignoreMatrix ? SkMatrix::I() : stage.getCoordChangeMatrix()) {
+ }
+
+ GrPendingFragmentStage(const GrPendingFragmentStage& that) { *this = that; }
+
+ GrPendingFragmentStage& operator=(const GrPendingFragmentStage& that) {
+ fProc.reset(that.fProc.get());
+ fCoordChangeMatrix = that.fCoordChangeMatrix;
+ return *this;
+ }
+
+ bool operator==(const GrPendingFragmentStage& that) const {
+ return this->getProcessor()->isEqual(*that.getProcessor()) &&
+ fCoordChangeMatrix == that.fCoordChangeMatrix;
+ }
+
+ bool operator!=(const GrPendingFragmentStage& that) const { return !(*this == that); }
+
+ const SkMatrix& getCoordChangeMatrix() const { return fCoordChangeMatrix; }
+
+ /**
+ * For a coord transform on the fragment processor, does it or the coord change matrix (if
+ * relevant) contain perspective?
+ */
+ bool isPerspectiveCoordTransform(int matrixIndex) const {
+ const GrCoordTransform& coordTransform = this->getProcessor()->coordTransform(matrixIndex);
+ uint32_t type = coordTransform.getMatrix().getType();
+ if (kLocal_GrCoordSet == coordTransform.sourceCoords()) {
+ type |= this->getCoordChangeMatrix().getType();
+ }
+
+ return SkToBool(SkMatrix::kPerspective_Mask & type);
+ }
+
+ const char* name() const { return fProc->name(); }
+
+ const GrFragmentProcessor* getProcessor() const { return fProc.get(); }
+
+protected:
+ GrPendingProgramElement<const GrFragmentProcessor> fProc;
+ SkMatrix fCoordChangeMatrix;
+};
+#endif
« no previous file with comments | « src/gpu/GrOptDrawState.cpp ('k') | src/gpu/GrPendingProgramElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698