Index: src/gpu/GrPathProcessor.h |
diff --git a/src/gpu/GrPathProcessor.h b/src/gpu/GrPathProcessor.h |
index 39b0b7afef3b55ded9c3d0c3d0e9ba45b5b711fd..e34d0cefbe5d2302ceb707dd32d6883902d4b561 100644 |
--- a/src/gpu/GrPathProcessor.h |
+++ b/src/gpu/GrPathProcessor.h |
@@ -37,8 +37,10 @@ public: |
const char* name() const override { return "PathProcessor"; } |
- const SkMatrix& viewMatrix() const { return fViewMatrix; } |
GrColor color() const { return fColor; } |
+ const SkMatrix& viewMatrix() const { return fViewMatrix; } |
+ const SkMatrix& localMatrix() const { return fLocalMatrix; } |
+ |
void getInvariantOutputColor(GrInitInvariantOutput* out) const override; |
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override; |
@@ -54,10 +56,44 @@ public: |
private: |
GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& localMatrix); |
+ |
+ /* |
+ * CanCombineOutput will return true if two draws are 'batchable' from a color perspective. |
+ * TODO is this really necessary? |
+ */ |
+ static bool CanCombineOutput(GrGPInput left, GrColor lColor, GrGPInput right, GrColor rColor) { |
+ if (left != right) { |
+ return false; |
+ } |
+ |
+ if (kUniform_GrGPInput == left && lColor != rColor) { |
+ return false; |
+ } |
+ |
+ return true; |
+ } |
+ |
+ static bool CanCombineLocalMatrices(const GrPrimitiveProcessor& l, |
+ bool leftUsesLocalCoords, |
+ const GrPrimitiveProcessor& r, |
+ bool rightUsesLocalCoords) { |
+ if (leftUsesLocalCoords != rightUsesLocalCoords) { |
+ return false; |
+ } |
+ |
+ const GrPathProcessor& left = l.cast<GrPathProcessor>(); |
+ const GrPathProcessor& right = r.cast<GrPathProcessor>(); |
+ if (leftUsesLocalCoords && !left.localMatrix().cheapEqualTo(right.localMatrix())) { |
+ return false; |
+ } |
+ return true; |
+ } |
+ |
bool hasExplicitLocalCoords() const override { return false; } |
- const SkMatrix fViewMatrix; |
GrColor fColor; |
+ const SkMatrix fViewMatrix; |
+ const SkMatrix fLocalMatrix; |
typedef GrPrimitiveProcessor INHERITED; |
}; |