add clip to PictureRenderer to better mimic Chromium's rendering method
authorrobertphillips <robertphillips@google.com>
Fri, 28 Nov 2014 15:42:16 +0000 (07:42 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 28 Nov 2014 15:42:16 +0000 (07:42 -0800)
Since Chromium uses separate canvases when rendering tiles they get an implicit clip. This adds an explicit clip since the PictureRenderer reuses the same canvas.

Review URL: https://codereview.chromium.org/739303005

tools/PictureRenderer.cpp

index f2fd6b7..33766e9 100644 (file)
@@ -618,6 +618,7 @@ static void draw_tile_to_canvas(SkCanvas* canvas,
     SkMatrix mat(canvas->getTotalMatrix());
     mat.postTranslate(-SkIntToScalar(tileRect.fLeft), -SkIntToScalar(tileRect.fTop));
     canvas->setMatrix(mat);
+    canvas->clipRect(SkRect::Make(tileRect));
     canvas->clear(SK_ColorTRANSPARENT); // Not every picture covers the entirety of every tile
     canvas->drawPicture(picture);
     canvas->restoreToCount(saveCount);