Reduce overdraw in MultiPictureDraw Sierpinski GM
authorrobertphillips <robertphillips@google.com>
Fri, 3 Oct 2014 14:29:20 +0000 (07:29 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 3 Oct 2014 14:29:20 +0000 (07:29 -0700)
As written, all the layers in the MPD Sierpinski GM are full screen. This CL bounds each layer to reduce overdraw.

This CL will cause differences in:

multipicturedraw_sierpinski_simple
multipicturedraw_sierpinski_tiled

but they are/will be suppressed in: (Don't turn on dither for saveLayers which have no paint - https://codereview.chromium.org/619363002/)

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

gm/multipicturedraw.cpp

index 9a3f1a8..afa83e5 100644 (file)
@@ -155,6 +155,9 @@ static const SkPicture* make_tri_picture() {
 
     SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kPicWidth),
                                                SkIntToScalar(kPicHeight));
+    SkRect r = tri.getBounds();
+    r.outset(2.0f, 2.0f);       // outset for stroke
+    canvas->clipRect(r);
     // The saveLayer/restore block is to exercise layer hoisting
     canvas->saveLayer(NULL, NULL);
         canvas->drawPath(tri, fill);