[skif] Fix inset=0 case for new Magnifier
The new magnifier was not guarding division by 0 when calculating the
inverse of the inset in `make_magnifier_shader`. That said, the visual
effect of this shader when the inset is 0 is that there is no lens
distortion. This can be equivalently represented by just applying a
rect-to-rect transform from the `srcRect` to `lensBounds`, which should
be more efficient.
I updated the SkSL-disabled behavior to always perform the transform
optimization as if inset were 0, which is better than the no-op it
used to do.
Chromium currently only uses an inset of 0. Due to the adaptation of
the lensBounds and srcRect based on what the child filter produces,
it's not reasonable to remove this filter entirely in favor of
`SkMatrixTransformImageFilter`, but the inset=0 optimization should
make performance equivalent. Now that all backends work off of a
runtime effect, the maintenance burden for the inset>0 case is fairly
minimal.
Updates the magnifier bounds GM to test inset=0 and tweaks the
bounds visualization to hide less of the distored area and show the
expected inset corner curve.
Bug: chromium:1425773
Change-Id: I547bdd9638cc34904f3de4ad0048542998161b86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/696797
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
3 files changed