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>
This commit is contained in:
Brian Osman 2018-05-22 16:56:40 -04:00 committed by Skia Commit-Bot
parent 4b6d4d0ecc
commit e19e23fa0c

View File

@ -1138,6 +1138,9 @@ void Viewer::drawSlide(SkCanvas* canvas) {
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);