Reland "In GrSkSLFP, always use a coord transform"
This reverts commit fd7fd960be695290dffe126d006fcbea80852527.
Change-Id: Id0f39dfd906f24e5c5eb054a28fc8e96ef73835e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267036
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/effects/GrSkSLFP.cpp b/src/gpu/effects/GrSkSLFP.cpp
index 309f8a3..c10bac4 100644
--- a/src/gpu/effects/GrSkSLFP.cpp
+++ b/src/gpu/effects/GrSkSLFP.cpp
@@ -91,9 +91,8 @@
}
}
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
- SkString coords = args.fTransformedCoords.count()
- ? fragBuilder->ensureCoords2D(args.fTransformedCoords[0].fVaryingPoint)
- : SkString("sk_FragCoord");
+ SkASSERT(args.fTransformedCoords.count() == 1);
+ SkString coords = fragBuilder->ensureCoords2D(args.fTransformedCoords[0].fVaryingPoint);
std::vector<SkString> childNames;
for (int i = 0; i < this->numChildProcessors(); ++i) {
childNames.push_back(this->invokeChild(i, args));
@@ -179,8 +178,8 @@
, fInputs(std::move(inputs)) {
if (matrix) {
fCoordTransform = GrCoordTransform(*matrix);
- this->addCoordTransform(&fCoordTransform);
}
+ this->addCoordTransform(&fCoordTransform);
}
GrSkSLFP::GrSkSLFP(const GrSkSLFP& other)
@@ -189,10 +188,9 @@
, fEffect(other.fEffect)
, fName(other.fName)
, fInputs(other.fInputs) {
- if (other.numCoordTransforms()) {
- fCoordTransform = other.fCoordTransform;
- this->addCoordTransform(&fCoordTransform);
- }
+ SkASSERT(other.numCoordTransforms() == 1);
+ fCoordTransform = other.fCoordTransform;
+ this->addCoordTransform(&fCoordTransform);
}
const char* GrSkSLFP::name() const {