| Index: src/gpu/glsl/GrGLSLGeometryProcessor.h
|
| diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.h b/src/gpu/glsl/GrGLSLGeometryProcessor.h
|
| index 6777620a880eed87d730fce8b0720f57c2a00d87..d1e715f78a7846c65935be341e6a3374a3a80f06 100644
|
| --- a/src/gpu/glsl/GrGLSLGeometryProcessor.h
|
| +++ b/src/gpu/glsl/GrGLSLGeometryProcessor.h
|
| @@ -22,11 +22,31 @@
|
| /* Any general emit code goes in the base class emitCode. Subclasses override onEmitCode */
|
| void emitCode(EmitArgs&) override;
|
|
|
| + // By default we use the identity matrix
|
| + void setTransformData(const GrPrimitiveProcessor&,
|
| + const GrGLSLProgramDataManager& pdman,
|
| + int index,
|
| + const SkTArray<const GrCoordTransform*, true>& transforms) override {
|
| + this->setTransformDataHelper(SkMatrix::I(), pdman, index, transforms);
|
| + }
|
| +
|
| protected:
|
| // A helper which subclasses can use if needed and used above in the default setTransformData().
|
| void setTransformDataHelper(const SkMatrix& localMatrix,
|
| const GrGLSLProgramDataManager& pdman,
|
| - FPCoordTransformIter*);
|
| + int index,
|
| + const SkTArray<const GrCoordTransform*, true>& transforms) {
|
| + SkTArray<TransformUniform, 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.
|
| void emitTransforms(GrGLSLVertexBuilder* vb,
|
| @@ -34,9 +54,10 @@
|
| GrGLSLUniformHandler* uniformHandler,
|
| const GrShaderVar& posVar,
|
| const char* localCoords,
|
| - FPCoordTransformHandler* handler) {
|
| + const TransformsIn& tin,
|
| + TransformsOut* tout) {
|
| this->emitTransforms(vb, varyingHandler, uniformHandler,
|
| - posVar, localCoords, SkMatrix::I(), handler);
|
| + posVar, localCoords, SkMatrix::I(), tin, tout);
|
| }
|
|
|
| // Emit pre-transformed coords as a vertex attribute per coord-transform.
|
| @@ -46,7 +67,8 @@
|
| const GrShaderVar& posVar,
|
| const char* localCoords,
|
| const SkMatrix& localMatrix,
|
| - FPCoordTransformHandler*);
|
| + const TransformsIn&,
|
| + TransformsOut*);
|
|
|
| struct GrGPArgs {
|
| // The variable used by a GP to store its position. It can be
|
| @@ -81,7 +103,7 @@
|
| SkMatrix fCurrentValue = SkMatrix::InvalidMatrix();
|
| };
|
|
|
| - SkTArray<TransformUniform, true> fInstalledTransforms;
|
| + SkSTArray<8, SkSTArray<2, TransformUniform, true> > fInstalledTransforms;
|
|
|
| typedef GrGLSLPrimitiveProcessor INHERITED;
|
| };
|
|
|