Index: src/gpu/GrGeometryProcessor.h |
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h |
index 4801069005fdd21ccc4a9103e1f8b9fac4905059..66a01e8c829a0cdd10cad1383a7d87665dfdcefd 100644 |
--- a/src/gpu/GrGeometryProcessor.h |
+++ b/src/gpu/GrGeometryProcessor.h |
@@ -39,6 +39,20 @@ class GrGLCaps; |
class GrGLGeometryProcessor; |
class GrOptDrawState; |
+struct GrInitInvariantOutput; |
+ |
+/* |
+ * GrGeometryProcessors and GrPathProcessors may effect invariantColor |
+ */ |
+class GrPrimitiveProcessor : public GrProcessor { |
+public: |
+ virtual void computeOutputColor(GrInitInvariantOutput* out) const = 0; |
+ virtual void computeOutputCoverage(GrInitInvariantOutput* out) const = 0; |
+ |
+private: |
+ typedef GrProcessor INHERITED; |
+}; |
+ |
/** |
* A GrGeometryProcessor is used to perform computation in the vertex shader and |
* add support for custom vertex attributes. A GrGemeotryProcessor is typically |
@@ -49,7 +63,7 @@ class GrOptDrawState; |
* added to the vertex attribute array specified on the GrDrawState. |
* GrGeometryProcessor subclasses should be immutable after construction. |
*/ |
-class GrGeometryProcessor : public GrProcessor { |
+class GrGeometryProcessor : public GrPrimitiveProcessor { |
public: |
GrGeometryProcessor(GrColor color, uint8_t coverage = 0xff) |
: fVertexStride(0) |
@@ -139,7 +153,8 @@ public: |
bool hasVertexCoverage() const { return fHasVertexCoverage; } |
bool hasLocalCoords() const { return fHasLocalCoords; } |
- void computeInvariantColor(GrInvariantOutput* inout) const; |
+ virtual void computeOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE; |
+ virtual void computeOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE; |
protected: |
/** |
@@ -160,6 +175,9 @@ protected: |
void setHasVertexCoverage() { fHasVertexCoverage = true; } |
void setHasLocalCoords() { fHasLocalCoords = true; } |
+ virtual void onComputeOutputColor(GrInitInvariantOutput*) const {} |
+ virtual void onComputeOutputCoverage(GrInitInvariantOutput*) const = 0; |
+ |
private: |
virtual bool onIsEqual(const GrGeometryProcessor&) const = 0; |
@@ -174,4 +192,19 @@ private: |
typedef GrProcessor INHERITED; |
}; |
+ |
+/* |
+ * The path equivalent of the GP. Can only upload uniform color. |
+ */ |
+class GrPathProcessor : public GrProcessor { |
+public: |
+ GrPathProcessor(GrColor color) : fColor(color) {} |
+ virtual void computeOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE; |
+ virtual void computeOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE; |
+ |
+private: |
+ GrColor fColor; |
+ |
+ typedef GrProcessor INHERITED; |
+}; |
#endif |