Support Canvas Clip on Blit Framebuffer

The previous fix to blit framebuffer didn't take cases where
the canvas had a clip applied into account. Fix and update
the unit test to add this case.

Bug: 658277
Change-Id: If3a9d2c8ddf955164cf529c9d6036618f957e426
Reviewed-on: https://skia-review.googlesource.com/11300
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp
index 2a96f86..193c37d 100644
--- a/tests/BlendTest.cpp
+++ b/tests/BlendTest.cpp
@@ -123,19 +123,22 @@
         SkIPoint inPoint;
     } allRectsAndPoints[3] = {
             {SkRect::MakeXYWH(0, 0, 5, 5), SkIPoint::Make(7, 7), SkIPoint::Make(2, 2)},
-            {SkRect::MakeXYWH(2, 2, 5, 5), SkIPoint::Make(0, 0), SkIPoint::Make(4, 4)},
+            {SkRect::MakeXYWH(2, 2, 5, 5), SkIPoint::Make(1, 1), SkIPoint::Make(4, 4)},
             {SkRect::MakeXYWH(5, 5, 5, 5), SkIPoint::Make(2, 2), SkIPoint::Make(7, 7)},
     };
 
     struct TestCase {
         RectAndSamplePoint rectAndPoints;
+        SkRect clip;
         int sampleCnt;
     };
     std::vector<TestCase> testCases;
 
     for (int sampleCnt : {0, 4}) {
         for (auto rectAndPoints : allRectsAndPoints) {
-            testCases.push_back({rectAndPoints, sampleCnt});
+            for (auto clip : {SkRect::MakeXYWH(0, 0, 10, 10), SkRect::MakeXYWH(1, 1, 8, 8)}) {
+                testCases.push_back({rectAndPoints, clip, sampleCnt});
+            }
         }
     }
 
@@ -159,6 +162,7 @@
 
         // Fill our canvas with 0xFFFF80
         SkCanvas* canvas = surface->getCanvas();
+        canvas->clipRect(testCase.clip, false);
         SkPaint black_paint;
         black_paint.setColor(SkColorSetRGB(0xFF, 0xFF, 0x80));
         canvas->drawRect(SkRect::MakeXYWH(0, 0, kWidth, kHeight), black_paint);