diff options
author | 2015-05-15 07:56:07 -0700 | |
---|---|---|
committer | 2015-05-15 07:56:07 -0700 | |
commit | e3ababe44315452cd33b96a18ce316ede09ff3c3 (patch) | |
tree | e7ba40200bc0ab12d3ad1bb2f013904599399638 /src/gpu/effects/GrDashingEffect.cpp | |
parent | c77f6af7c3ca08c94b882ccb2fbd61e6bae7ea42 (diff) |
remove localmatrix from GrGeometryProcessor base class
BUG=skia:
Review URL: https://codereview.chromium.org/1131513005
Diffstat (limited to 'src/gpu/effects/GrDashingEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrDashingEffect.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index 860475524b..05aa277b5e 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -785,6 +785,8 @@ public: GrColor color() const { return fColor; } + const SkMatrix& localMatrix() const { return fLocalMatrix; } + virtual void getGLProcessorKey(const GrBatchTracker&, const GrGLSLCaps&, GrProcessorKeyBuilder* b) const override; @@ -798,6 +800,7 @@ private: DashingCircleEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix); GrColor fColor; + SkMatrix fLocalMatrix; DashAAMode fAAMode; const Attribute* fInPosition; const Attribute* fInDashParams; @@ -825,6 +828,13 @@ public: const GrPrimitiveProcessor&, const GrBatchTracker&) override; + void setTransformData(const GrPrimitiveProcessor& primProc, + const GrGLProgramDataManager& pdman, + int index, + const SkTArray<const GrCoordTransform*, true>& transforms) override { + this->setTransformDataHelper<DashingCircleEffect>(primProc, pdman, index, transforms); + } + private: UniformHandle fParamUniform; UniformHandle fColorUniform; @@ -910,7 +920,7 @@ void GLDashingCircleEffect::GenKey(const GrGeometryProcessor& gp, const DashingCircleBatchTracker& local = bt.cast<DashingCircleBatchTracker>(); const DashingCircleEffect& dce = gp.cast<DashingCircleEffect>(); uint32_t key = 0; - key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 : 0x0; + key |= local.fUsesLocalCoords && dce.localMatrix().hasPerspective() ? 0x1 : 0x0; key |= dce.aaMode() << 8; b->add32(key << 16 | local.fInputColorType); } @@ -937,8 +947,8 @@ GrGLPrimitiveProcessor* DashingCircleEffect::createGLInstance(const GrBatchTrack DashingCircleEffect::DashingCircleEffect(GrColor color, DashAAMode aaMode, const SkMatrix& localMatrix) - : INHERITED(localMatrix) - , fColor(color) + : fColor(color) + , fLocalMatrix(localMatrix) , fAAMode(aaMode) { this->initClassID<DashingCircleEffect>(); fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType)); @@ -1003,6 +1013,8 @@ public: GrColor color() const { return fColor; } + const SkMatrix& localMatrix() const { return fLocalMatrix; } + virtual void getGLProcessorKey(const GrBatchTracker& bt, const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; @@ -1016,6 +1028,7 @@ private: DashingLineEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix); GrColor fColor; + SkMatrix fLocalMatrix; DashAAMode fAAMode; const Attribute* fInPosition; const Attribute* fInDashParams; @@ -1043,6 +1056,13 @@ public: const GrPrimitiveProcessor&, const GrBatchTracker&) override; + void setTransformData(const GrPrimitiveProcessor& primProc, + const GrGLProgramDataManager& pdman, + int index, + const SkTArray<const GrCoordTransform*, true>& transforms) override { + this->setTransformDataHelper<DashingLineEffect>(primProc, pdman, index, transforms); + } + private: GrColor fColor; UniformHandle fColorUniform; @@ -1140,7 +1160,7 @@ void GLDashingLineEffect::GenKey(const GrGeometryProcessor& gp, const DashingLineBatchTracker& local = bt.cast<DashingLineBatchTracker>(); const DashingLineEffect& de = gp.cast<DashingLineEffect>(); uint32_t key = 0; - key |= local.fUsesLocalCoords && gp.localMatrix().hasPerspective() ? 0x1 : 0x0; + key |= local.fUsesLocalCoords && de.localMatrix().hasPerspective() ? 0x1 : 0x0; key |= de.aaMode() << 8; b->add32(key << 16 | local.fInputColorType); } @@ -1167,8 +1187,8 @@ GrGLPrimitiveProcessor* DashingLineEffect::createGLInstance(const GrBatchTracker DashingLineEffect::DashingLineEffect(GrColor color, DashAAMode aaMode, const SkMatrix& localMatrix) - : INHERITED(localMatrix) - , fColor(color) + : fColor(color) + , fLocalMatrix(localMatrix) , fAAMode(aaMode) { this->initClassID<DashingLineEffect>(); fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType)); |