[skif] Skip auto saveLayer for most drawImageRect() calls
Unifies SkCanvas::drawImage and drawImageRect, so onDrawImage() can
be deleted once staging has been completed.
Previously, there were lots of requirements for a drawImage call to
skip an auto-saveLayer when there was an image filter:
1. Only drawImage, not drawImageRect, even when it had a trivial src
2. Integer-aligned transform
3. No paint alpha or color filter
4. The canvas had to be clipped to a pixel-aligned rectangle exactly
matching the size of the image.
Now, drawImageRect and simple drawImageSet calls can also take
advantage of eliding a layer. This relies on
FilterResult::MakeFromImage to re-wrap the image as an SkSpecialImage
w/o a layer when possible or automatically draw the image subset when
needed. The logic is opaque to SkCanvas, so once FilterResult operates
on float src and dst rects, even more cases will avoid a renderpass.
Now, so long as the src is pixel aligned, the transform can be deferred.
Similarly, alpha and any color filter can be deferred.
Bug: b/40040587
Bug: b/40042366
Change-Id: I79c3318bb9e1714cd3b9e2985005070b7dfaa1d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/761378
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
3 files changed