Chromium Code Reviews| Index: src/gpu/GrGeometryProcessor.h |
| diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h |
| index f3ec0b5af349d8d1793ca5b5902b9167bdfb1423..8a2ad28789f91fd33251a097a2c4624f77ed5e53 100644 |
| --- a/src/gpu/GrGeometryProcessor.h |
| +++ b/src/gpu/GrGeometryProcessor.h |
| @@ -90,6 +90,8 @@ enum GrGPInput { |
| */ |
| class GrPrimitiveProcessor : public GrProcessor { |
| public: |
| + virtual const SkMatrix& localMatrix() const = 0; |
|
bsalomon
2014/12/19 14:15:53
Why not just have the base class own a protected m
|
| + |
| /* |
| * This struct allows the optstate to communicate requirements to the GrPrimitiveProcessor. |
| */ |
| @@ -161,13 +163,16 @@ class GrGeometryProcessor : public GrPrimitiveProcessor { |
| public: |
| // TODO the Hint can be handled in a much more clean way when we have deferred geometry or |
| // atleast bundles |
| - GrGeometryProcessor(GrColor color, bool opaqueVertexColors = false) |
| + GrGeometryProcessor(GrColor color, |
| + bool opaqueVertexColors = false, |
| + const SkMatrix& localMatrix = SkMatrix::I()) |
| : fVertexStride(0) |
| , fColor(color) |
| , fOpaqueVertexColors(opaqueVertexColors) |
| , fWillUseGeoShader(false) |
| , fHasVertexColor(false) |
| - , fHasLocalCoords(false) {} |
| + , fHasLocalCoords(false) |
| + , fLocalMatrix(localMatrix) {} |
| /* |
| * This is a safeguard to prevent GPs from going beyond platform specific attribute limits. |
| @@ -217,6 +222,11 @@ public: |
| return false; |
| } |
| + // TODO let the GP itself make this call |
| + if (!fLocalMatrix.cheapEqualTo(other.localMatrix())) { |
| + return false; |
| + } |
| + |
| // TODO this equality test should really be broken up, some of this can live on the batch |
| // tracker test and some of this should be in bundles |
| if (!this->onIsEqual(other)) { |
| @@ -230,6 +240,7 @@ public: |
| // TODO we can remove color from the GrGeometryProcessor base class once we have bundles of |
| // primitive data |
| GrColor color() const { return fColor; } |
| + const SkMatrix& localMatrix() const SK_OVERRIDE { return fLocalMatrix; } |
| // TODO this is a total hack until the gp can do deferred geometry |
| bool hasVertexColor() const { return fHasVertexColor; } |
| @@ -304,6 +315,7 @@ private: |
| bool fWillUseGeoShader; |
| bool fHasVertexColor; |
| bool fHasLocalCoords; |
| + SkMatrix fLocalMatrix; |
|
bsalomon
2014/12/19 14:15:53
move to primproc?
|
| typedef GrProcessor INHERITED; |
| }; |
| @@ -314,8 +326,8 @@ private: |
| */ |
| class GrPathProcessor : public GrPrimitiveProcessor { |
| public: |
| - static GrPathProcessor* Create(GrColor color) { |
| - return SkNEW_ARGS(GrPathProcessor, (color)); |
| + static GrPathProcessor* Create(GrColor color, const SkMatrix& localMatrix = SkMatrix::I()) { |
| + return SkNEW_ARGS(GrPathProcessor, (color, localMatrix)); |
| } |
| void initBatchTracker(GrBatchTracker*, const InitBT&) const SK_OVERRIDE; |
| @@ -327,6 +339,7 @@ public: |
| const char* name() const SK_OVERRIDE { return "PathProcessor"; } |
| GrColor color() const { return fColor; } |
| + const SkMatrix& localMatrix() const SK_OVERRIDE { return fLocalMatrix; } |
| void getInvariantOutputColor(GrInitInvariantOutput* out) const SK_OVERRIDE; |
| void getInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE; |
| @@ -338,8 +351,9 @@ public: |
| virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE; |
| private: |
| - GrPathProcessor(GrColor color); |
| + GrPathProcessor(GrColor color, const SkMatrix& localMatrix); |
| GrColor fColor; |
| + SkMatrix fLocalMatrix; |
| typedef GrProcessor INHERITED; |
| }; |