Clip to perspective quad in viewer

For GMs that draw content outside the window, this ensures that fake
and real perspective look more similar.

Change-Id: I5fd2372a21a0b6c04cb33ddef4ff53aebda1c43d
Reviewed-on: https://skia-review.googlesource.com/129454
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index c549508..85a7298 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -1138,6 +1138,9 @@
     int count = slideCanvas->save();
     slideCanvas->clear(SK_ColorWHITE);
     slideCanvas->concat(computeMatrix());
+    if (kPerspective_Real == fPerspectiveMode) {
+        slideCanvas->clipRect(SkRect::MakeWH(fWindow->width(), fWindow->height()));
+    }
     // Time the painting logic of the slide
     fStatsLayer.beginTiming(fPaintTimer);
     OveridePaintFilterCanvas filterCanvas(slideCanvas, &fPaint, &fPaintOverrides);