Make GrTextureOp disable filtering/aa in more cases.

Previously we didn't do this at all for multiple-texture ops.

Improve the test detecting when filtering can be disabled.

Make draw_image_set GM create tiles with pixel of overlap for correct
filtering.

Add draw_image_set_rect_to_rect to exercise filtering/aa disablement
in combination with tiling.

Makes SkGpuDevice filter out inverted src rects (as is done implicitly
in SkBaseDevice by relying on drawImageRect).

Puts GrTextureOp::fFilter in bitfield.

Change-Id: Iee96cb54d665877c7f4aee422a3a7af2b249b1d6
Reviewed-on: https://skia-review.googlesource.com/c/161641
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 5e8cfca..9df0734 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1473,6 +1473,14 @@
         }
     };
     for (int i = 0; i < count; ++i) {
+        // The default SkBaseDevice implementation is based on drawImageRect which does not allow
+        // non-sorted src rects. TODO: Decide this is OK or make sure we handle it.
+        if (!set[i].fSrcRect.isSorted()) {
+            draw();
+            base = i + 1;
+            n = 0;
+            continue;
+        }
         textures[i].fProxy =
                 as_IB(set[i].fImage.get())
                         ->asTextureProxyRef(fContext.get(), GrSamplerState::ClampBilerp(), nullptr,
@@ -1486,12 +1494,13 @@
             draw();
             base = i + 1;
             n = 0;
-        } else if (n > 0 &&
-                   (textures[i].fProxy->textureType() != textures[base].fProxy->textureType() ||
-                    textures[i].fProxy->config() != textures[base].fProxy->config() ||
-                    set[i].fImage->alphaType() != set[base].fImage->alphaType() ||
-                    !SkColorSpace::Equals(set[i].fImage->colorSpace(),
-                                          set[base].fImage->colorSpace()))) {
+            continue;
+        }
+        if (n > 0 &&
+            (textures[i].fProxy->textureType() != textures[base].fProxy->textureType() ||
+             textures[i].fProxy->config() != textures[base].fProxy->config() ||
+             set[i].fImage->alphaType() != set[base].fImage->alphaType() ||
+             !SkColorSpace::Equals(set[i].fImage->colorSpace(), set[base].fImage->colorSpace()))) {
             draw();
             base = i;
             n = 1;