Fix non-zero special-image subsets in magnifier filter
This will let us re-land https://skia-review.googlesource.com/c/skia/+/237127
which makes non-zero subsets much more common. Confirmed that this CL and
the linked CL will now pass the CC unittests that caught the original failure.
Change-Id: Ic0393a574b2c19d92421a5deece81ab2ed70fc97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237899
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/effects/generated/GrMagnifierEffect.cpp b/src/gpu/effects/generated/GrMagnifierEffect.cpp
index 05f1602..0526e83 100644
--- a/src/gpu/effects/generated/GrMagnifierEffect.cpp
+++ b/src/gpu/effects/generated/GrMagnifierEffect.cpp
@@ -115,15 +115,17 @@
{
SkScalar y = bounds.y() * invH;
+ SkScalar hSign = 1.f;
if (srcProxy.origin() != kTopLeft_GrSurfaceOrigin) {
- y = 1.0f - bounds.height() * invH;
+ y = 1.0f - bounds.y() * invH;
+ hSign = -1.f;
}
pdman.set4f(boundsUniform,
bounds.x() * invW,
y,
SkIntToScalar(src.width()) / bounds.width(),
- SkIntToScalar(src.height()) / bounds.height());
+ hSign * SkIntToScalar(src.height()) / bounds.height());
}
}
UniformHandle boundsUniformVar;