Proposed SkCanvas API for preLoading textures to VRAM v2.0

This is an update to (Proposed SkCanvas API for preLoading textures to VRAM - https://codereview.chromium.org/192853002/). It takes into account in-person feedback on the initial proposal. The main feedback was to land this closer to where we will ultimately wind up with the reordered rendering capability (and don't have an SkCanvas entry point (yet)).

Committed: http://code.google.com/p/skia/source/detail?r=13810

R=reed@google.com, bsalomon@google.com

Author: robertphillips@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@13822 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index ebac9ca..466e31d 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -570,20 +570,19 @@
 }
 
 /**
- * Draw the specified playback to the canvas translated to rectangle provided, so that this mini
+ * Draw the specified picture to the canvas translated to rectangle provided, so that this mini
  * canvas represents the rectangle's portion of the overall picture.
  * Saves and restores so that the initial clip and matrix return to their state before this function
  * is called.
  */
-template<class T>
-static void DrawTileToCanvas(SkCanvas* canvas, const SkRect& tileRect, T* playback) {
+static void draw_tile_to_canvas(SkCanvas* canvas, const SkRect& tileRect, SkPicture* picture) {
     int saveCount = canvas->save();
     // Translate so that we draw the correct portion of the picture.
     // Perform a postTranslate so that the scaleFactor does not interfere with the positioning.
     SkMatrix mat(canvas->getTotalMatrix());
     mat.postTranslate(-tileRect.fLeft, -tileRect.fTop);
     canvas->setMatrix(mat);
-    playback->draw(canvas);
+    canvas->drawPicture(*picture);
     canvas->restoreToCount(saveCount);
     canvas->flush();
 }
@@ -621,7 +620,7 @@
 
 void TiledPictureRenderer::drawCurrentTile() {
     SkASSERT(fCurrentTileOffset >= 0 && fCurrentTileOffset < fTileRects.count());
-    DrawTileToCanvas(fCanvas, fTileRects[fCurrentTileOffset], fPicture);
+    draw_tile_to_canvas(fCanvas, fTileRects[fCurrentTileOffset], fPicture);
 }
 
 bool TiledPictureRenderer::render(const SkString* path, SkBitmap** out) {
@@ -638,7 +637,7 @@
     }
     bool success = true;
     for (int i = 0; i < fTileRects.count(); ++i) {
-        DrawTileToCanvas(fCanvas, fTileRects[i], fPicture);
+        draw_tile_to_canvas(fCanvas, fTileRects[i], fPicture);
         if (NULL != path) {
             success &= writeAppendNumber(fCanvas, path, i, fJsonSummaryPtr);
         }
@@ -722,7 +721,7 @@
         }
 
         for (int i = fStart; i < fEnd; i++) {
-            DrawTileToCanvas(fCanvas, fRects[i], fClone);
+            draw_tile_to_canvas(fCanvas, fRects[i], fClone);
             if ((fPath != NULL) && !writeAppendNumber(fCanvas, fPath, i, fJsonSummaryPtr)
                 && fSuccess != NULL) {
                 *fSuccess = false;