diff options
Diffstat (limited to 'src/gpu/glsl')
-rw-r--r-- | src/gpu/glsl/GrGLSLGeometryProcessor.h | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.h b/src/gpu/glsl/GrGLSLGeometryProcessor.h index 72f00f1509..00652a5b99 100644 --- a/src/gpu/glsl/GrGLSLGeometryProcessor.h +++ b/src/gpu/glsl/GrGLSLGeometryProcessor.h @@ -27,18 +27,25 @@ public: const GrGLSLProgramDataManager& pdman, int index, const SkTArray<const GrCoordTransform*, true>& transforms) override { - this->setTransformDataMatrix(SkMatrix::I(), pdman, index, transforms); + this->setTransformDataHelper(SkMatrix::I(), pdman, index, transforms); } protected: - // A helper which subclasses can use if needed - template <class GeometryProcessor> - void setTransformDataHelper(const GrPrimitiveProcessor& primProc, + // A helper which subclasses can use if needed and used above in the default setTransformData(). + void setTransformDataHelper(const SkMatrix& localMatrix, const GrGLSLProgramDataManager& pdman, int index, const SkTArray<const GrCoordTransform*, true>& transforms) { - const GeometryProcessor& gp = primProc.cast<GeometryProcessor>(); - this->setTransformDataMatrix(gp.localMatrix(), pdman, index, transforms); + SkSTArray<2, UniformTransform, true>& procTransforms = fInstalledTransforms[index]; + int numTransforms = transforms.count(); + for (int t = 0; t < numTransforms; ++t) { + SkASSERT(procTransforms[t].fHandle.isValid()); + const SkMatrix& transform = GetTransformMatrix(localMatrix, *transforms[t]); + if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) { + pdman.setSkMatrix(procTransforms[t].fHandle.toIndex(), transform); + procTransforms[t].fCurrentValue = transform; + } + } } // Emit a uniform matrix for each coord transform. @@ -96,22 +103,6 @@ protected: } private: - void setTransformDataMatrix(const SkMatrix& localMatrix, - const GrGLSLProgramDataManager& pdman, - int index, - const SkTArray<const GrCoordTransform*, true>& transforms) { - SkSTArray<2, UniformTransform, true>& procTransforms = fInstalledTransforms[index]; - int numTransforms = transforms.count(); - for (int t = 0; t < numTransforms; ++t) { - SkASSERT(procTransforms[t].fHandle.isValid()); - const SkMatrix& transform = GetTransformMatrix(localMatrix, *transforms[t]); - if (!procTransforms[t].fCurrentValue.cheapEqualTo(transform)) { - pdman.setSkMatrix(procTransforms[t].fHandle.toIndex(), transform); - procTransforms[t].fCurrentValue = transform; - } - } - } - virtual void onEmitCode(EmitArgs&, GrGPArgs*) = 0; struct UniformTransform : public Transform { |