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

Unified Diff: include/gpu/GrFragmentStage.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 | « gyp/gpu.gypi ('k') | include/gpu/GrPaint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrFragmentStage.h
diff --git a/include/gpu/GrProcessorStage.h b/include/gpu/GrFragmentStage.h
similarity index 69%
rename from include/gpu/GrProcessorStage.h
rename to include/gpu/GrFragmentStage.h
index 0f24a30a32abb9cb4eb38666cdc9330f2a553111..8089e9fab7a7819b94502a1d6ee4285e6248ff5a 100644
--- a/include/gpu/GrProcessorStage.h
+++ b/include/gpu/GrFragmentStage.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2010 Google Inc.
*
@@ -6,23 +5,17 @@
* found in the LICENSE file.
*/
+#ifndef GrFragmentStage_DEFINED
+#define GrFragmentStage_DEFINED
-
-#ifndef GrProcessorStage_DEFINED
-#define GrProcessorStage_DEFINED
-
-#include "GrBackendProcessorFactory.h"
-#include "GrCoordTransform.h"
#include "GrFragmentProcessor.h"
-#include "GrProgramElementRef.h"
#include "SkMatrix.h"
-#include "SkShader.h"
-// TODO: Make two variations on this class: One for GrDrawState that only owns regular refs
-// and supports compatibility checks and changing local coords. The second is for GrOptDrawState,
-// is immutable, and only owns pending execution refs. This requries removing the common base
-// class from GrDrawState and GrOptDrawState called GrRODrawState and converting to GrOptDrawState
-// when draws are enqueued in the GrInOrderDrawBuffer.
+/**
+ * Wraps a GrFragmentProcessor. It also contains a coord change matrix. This matrix should be
+ * concat'ed with all the processor's coord transforms that apply to local coords, unless
+ * explicit local coords are provided with the draw.
+ */
class GrFragmentStage {
public:
explicit GrFragmentStage(const GrFragmentProcessor* proc)
@@ -35,9 +28,9 @@ public:
if (other.fCoordChangeMatrixSet) {
fCoordChangeMatrix = other.fCoordChangeMatrix;
}
- fProc.initAndRef(other.fProc);
+ fProc.reset(SkRef(other.fProc.get()));
}
-
+
static bool AreCompatible(const GrFragmentStage& a, const GrFragmentStage& b,
bool usingExplicitLocalCoords) {
SkASSERT(a.fProc.get());
@@ -129,33 +122,12 @@ public:
}
}
- bool isPerspectiveCoordTransform(int matrixIndex, bool useExplicitLocalCoords) const {
- const GrCoordTransform& coordTransform = this->getProcessor()->coordTransform(matrixIndex);
- SkMatrix::TypeMask type0 = coordTransform.getMatrix().getType();
- SkMatrix::TypeMask type1 = SkMatrix::kIdentity_Mask;
- if (kLocal_GrCoordSet == coordTransform.sourceCoords()) {
- type1 = useExplicitLocalCoords ?
- SkMatrix::kIdentity_Mask : this->getCoordChangeMatrix().getType();
- }
-
- int combinedTypes = type0 | type1;
- if (SkMatrix::kPerspective_Mask & combinedTypes) {
- return true;
- } else {
- return false;
- }
- }
-
- const char* name() const { return fProc->name(); }
-
const GrFragmentProcessor* getProcessor() const { return fProc.get(); }
- void convertToPendingExec() { fProc.convertToPendingExec(); }
-
protected:
- bool fCoordChangeMatrixSet;
- SkMatrix fCoordChangeMatrix;
- GrProgramElementRef<const GrFragmentProcessor> fProc;
+ bool fCoordChangeMatrixSet;
+ SkMatrix fCoordChangeMatrix;
+ SkAutoTUnref<const GrFragmentProcessor> fProc;
};
#endif
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/GrPaint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698