Discard atlas after every MultiPictureDraw::draw

This is intended to prevent ghosting on tiled architectures.

This CL also defers creation of the atlas (and its texture) until it is actually needed.

Committed: https://skia.googlesource.com/skia/+/6d5b5455743414ddb11d2b8c1fe9d7959f2b853d

Review URL: https://codereview.chromium.org/678403002
diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h
index c772332..632cd00 100644
--- a/src/gpu/GrLayerCache.h
+++ b/src/gpu/GrLayerCache.h
@@ -18,6 +18,9 @@
 
 class SkPicture;
 
+// Set to 0 to disable caching of hoisted layers
+#define GR_CACHE_HOISTED_LAYERS 0
+
 // The layer cache listens for these messages to purge picture-related resources.
 struct GrPictureDeletedMessage {
     uint32_t pictureID;
@@ -249,6 +252,10 @@
         return width <= kPlotWidth && height <= kPlotHeight;
     }
 
+#if !GR_CACHE_HOISTED_LAYERS
+    void purgeAll();
+#endif
+
 private:
     static const int kAtlasTextureWidth = 1024;
     static const int kAtlasTextureHeight = 1024;
@@ -291,8 +298,6 @@
                                const SkIRect& bounds, const SkMatrix& ctm, 
                                const SkPaint* paint);
 
-    void purgeAll();
-
     // Remove all the layers (and unlock any resources) associated with 'pictureID'
     void purge(uint32_t pictureID);