| Index: src/gpu/GrPathProcessor.cpp
|
| diff --git a/src/gpu/GrPathProcessor.cpp b/src/gpu/GrPathProcessor.cpp
|
| index aa776ec2fb0d8fa2920470a6c2add2f2027c409c..c90481b8da8cbc86bfb07687ec01d95c355f159b 100644
|
| --- a/src/gpu/GrPathProcessor.cpp
|
| +++ b/src/gpu/GrPathProcessor.cpp
|
| @@ -34,7 +34,7 @@ public:
|
| }
|
|
|
| // emit transforms
|
| - this->emitTransforms(args.fVaryingHandler, args.fTransformsIn, args.fTransformsOut);
|
| + this->emitTransforms(args.fVaryingHandler, args.fFPCoordTransformHandler);
|
|
|
| // Setup uniform color
|
| if (pathProc.overrides().readsColor()) {
|
| @@ -54,34 +54,30 @@ public:
|
| }
|
|
|
| void emitTransforms(GrGLSLVaryingHandler* varyingHandler,
|
| - const TransformsIn& tin,
|
| - TransformsOut* tout) {
|
| - tout->push_back_n(tin.count());
|
| - fInstalledTransforms.push_back_n(tin.count());
|
| - for (int i = 0; i < tin.count(); i++) {
|
| - const ProcCoords& coordTransforms = tin[i];
|
| - fInstalledTransforms[i].push_back_n(coordTransforms.count());
|
| - for (int t = 0; t < coordTransforms.count(); t++) {
|
| - GrSLType varyingType =
|
| - coordTransforms[t]->getMatrix().hasPerspective() ? kVec3f_GrSLType :
|
| - kVec2f_GrSLType;
|
| -
|
| - SkString strVaryingName("MatrixCoord");
|
| - strVaryingName.appendf("_%i_%i", i, t);
|
| - GrGLSLVertToFrag v(varyingType);
|
| - GrGLVaryingHandler* glVaryingHandler = (GrGLVaryingHandler*) varyingHandler;
|
| - fInstalledTransforms[i][t].fHandle =
|
| - glVaryingHandler->addPathProcessingVarying(strVaryingName.c_str(),
|
| - &v).toIndex();
|
| - fInstalledTransforms[i][t].fType = varyingType;
|
| -
|
| - (*tout)[i].emplace_back(SkString(v.fsIn()), varyingType);
|
| - }
|
| + FPCoordTransformHandler* transformHandler) {
|
| + int i = 0;
|
| + while (const GrCoordTransform* coordTransform = transformHandler->nextCoordTransform()) {
|
| + GrSLType varyingType =
|
| + coordTransform->getMatrix().hasPerspective() ? kVec3f_GrSLType
|
| + : kVec2f_GrSLType;
|
| +
|
| + SkString strVaryingName;
|
| + strVaryingName.printf("TransformedCoord_%d", i);
|
| + GrGLSLVertToFrag v(varyingType);
|
| + GrGLVaryingHandler* glVaryingHandler = (GrGLVaryingHandler*) varyingHandler;
|
| + fInstalledTransforms.push_back().fHandle =
|
| + glVaryingHandler->addPathProcessingVarying(strVaryingName.c_str(),
|
| + &v).toIndex();
|
| + fInstalledTransforms.back().fType = varyingType;
|
| +
|
| + transformHandler->specifyCoordsForCurrCoordTransform(SkString(v.fsIn()), varyingType);
|
| + ++i;
|
| }
|
| }
|
|
|
| void setData(const GrGLSLProgramDataManager& pd,
|
| - const GrPrimitiveProcessor& primProc) override {
|
| + const GrPrimitiveProcessor& primProc,
|
| + FPCoordTransformIter&& transformIter) override {
|
| const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
|
| if (pathProc.overrides().readsColor() && pathProc.color() != fColor) {
|
| float c[4];
|
| @@ -89,28 +85,21 @@ public:
|
| pd.set4fv(fColorUniform, 1, c);
|
| fColor = pathProc.color();
|
| }
|
| - }
|
|
|
| - void setTransformData(const GrPrimitiveProcessor& primProc,
|
| - const GrGLSLProgramDataManager& pdman,
|
| - int index,
|
| - const SkTArray<const GrCoordTransform*, true>& coordTransforms) override {
|
| - const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
|
| - SkTArray<TransformVarying, true>& transforms = fInstalledTransforms[index];
|
| - int numTransforms = transforms.count();
|
| - for (int t = 0; t < numTransforms; ++t) {
|
| - SkASSERT(transforms[t].fHandle.isValid());
|
| - const SkMatrix& transform = GetTransformMatrix(pathProc.localMatrix(),
|
| - *coordTransforms[t]);
|
| - if (transforms[t].fCurrentValue.cheapEqualTo(transform)) {
|
| + int t = 0;
|
| + while (const GrCoordTransform* coordTransform = transformIter.next()) {
|
| + SkASSERT(fInstalledTransforms[t].fHandle.isValid());
|
| + const SkMatrix& m = GetTransformMatrix(pathProc.localMatrix(), *coordTransform);
|
| + if (fInstalledTransforms[t].fCurrentValue.cheapEqualTo(m)) {
|
| continue;
|
| }
|
| - transforms[t].fCurrentValue = transform;
|
| + fInstalledTransforms[t].fCurrentValue = m;
|
|
|
| - SkASSERT(transforms[t].fType == kVec2f_GrSLType ||
|
| - transforms[t].fType == kVec3f_GrSLType);
|
| - unsigned components = transforms[t].fType == kVec2f_GrSLType ? 2 : 3;
|
| - pdman.setPathFragmentInputTransform(transforms[t].fHandle, components, transform);
|
| + SkASSERT(fInstalledTransforms[t].fType == kVec2f_GrSLType ||
|
| + fInstalledTransforms[t].fType == kVec3f_GrSLType);
|
| + unsigned components = fInstalledTransforms[t].fType == kVec2f_GrSLType ? 2 : 3;
|
| + pd.setPathFragmentInputTransform(fInstalledTransforms[t].fHandle, components, m);
|
| + ++t;
|
| }
|
| }
|
|
|
| @@ -122,7 +111,7 @@ private:
|
| GrSLType fType = kVoid_GrSLType;
|
| };
|
|
|
| - SkSTArray<8, SkSTArray<2, TransformVarying, true> > fInstalledTransforms;
|
| + SkTArray<TransformVarying, true> fInstalledTransforms;
|
|
|
| UniformHandle fColorUniform;
|
| GrColor fColor;
|
|
|