Don't elide GrMatrixEffect if matrix is identity.

This ensures an effect setup code path that calls GrMatrix::Make()
doesn't produce an identity and non-identity shader variant.

Change-Id: I4d17395ed1b5bfd2bf9ceac68e85756c18eb2d2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396018
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2021-04-13 10:14:01 -04:00 committed by Skia Commit-Bot
parent 8ed8081e0c
commit 785a3262d1

View File

@ -37,9 +37,6 @@ private:
std::unique_ptr<GrFragmentProcessor> GrMatrixEffect::Make( std::unique_ptr<GrFragmentProcessor> GrMatrixEffect::Make(
const SkMatrix& matrix, std::unique_ptr<GrFragmentProcessor> child) { const SkMatrix& matrix, std::unique_ptr<GrFragmentProcessor> child) {
if (matrix.isIdentity()) {
return child;
}
if (child->classID() == kGrMatrixEffect_ClassID) { if (child->classID() == kGrMatrixEffect_ClassID) {
auto me = static_cast<GrMatrixEffect*>(child.get()); auto me = static_cast<GrMatrixEffect*>(child.get());
// registerChild's sample usage records whether the matrix used has perspective or not, // registerChild's sample usage records whether the matrix used has perspective or not,