Revert r13810 (Proposed SkCanvas API for preLoading textures to VRAM v2.0)



git-svn-id: http://skia.googlecode.com/svn/trunk@13811 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 466e31d..ebac9ca 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -570,19 +570,20 @@
 }
 
 /**
- * Draw the specified picture to the canvas translated to rectangle provided, so that this mini
+ * Draw the specified playback 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.
  */
-static void draw_tile_to_canvas(SkCanvas* canvas, const SkRect& tileRect, SkPicture* picture) {
+template<class T>
+static void DrawTileToCanvas(SkCanvas* canvas, const SkRect& tileRect, T* playback) {
     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);
-    canvas->drawPicture(*picture);
+    playback->draw(canvas);
     canvas->restoreToCount(saveCount);
     canvas->flush();
 }
@@ -620,7 +621,7 @@
 
 void TiledPictureRenderer::drawCurrentTile() {
     SkASSERT(fCurrentTileOffset >= 0 && fCurrentTileOffset < fTileRects.count());
-    draw_tile_to_canvas(fCanvas, fTileRects[fCurrentTileOffset], fPicture);
+    DrawTileToCanvas(fCanvas, fTileRects[fCurrentTileOffset], fPicture);
 }
 
 bool TiledPictureRenderer::render(const SkString* path, SkBitmap** out) {
@@ -637,7 +638,7 @@
     }
     bool success = true;
     for (int i = 0; i < fTileRects.count(); ++i) {
-        draw_tile_to_canvas(fCanvas, fTileRects[i], fPicture);
+        DrawTileToCanvas(fCanvas, fTileRects[i], fPicture);
         if (NULL != path) {
             success &= writeAppendNumber(fCanvas, path, i, fJsonSummaryPtr);
         }
@@ -721,7 +722,7 @@
         }
 
         for (int i = fStart; i < fEnd; i++) {
-            draw_tile_to_canvas(fCanvas, fRects[i], fClone);
+            DrawTileToCanvas(fCanvas, fRects[i], fClone);
             if ((fPath != NULL) && !writeAppendNumber(fCanvas, fPath, i, fJsonSummaryPtr)
                 && fSuccess != NULL) {
                 *fSuccess = false;
diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h
index 010aadf..c3438c9 100644
--- a/tools/PictureRenderer.h
+++ b/tools/PictureRenderer.h
@@ -309,10 +309,6 @@
         }
     }
 
-    SkCanvas* getCanvas() {
-        return fCanvas;
-    }
-
     SkGLContextHelper* getGLContext() {
         GrContextFactory::GLContextType glContextType
                 = GrContextFactory::kNull_GLContextType;
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 245f995..f0609c9 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -44,8 +44,6 @@
 
 DEFINE_bool(bench_record, false, "If true, drop into an infinite loop of recording the picture.");
 
-DEFINE_bool(preprocess, false, "If true, perform device specific preprocessing before rendering.");
-
 static void make_output_filepath(SkString* path, const SkString& dir,
                                  const SkString& name) {
     sk_tools::make_filepath(path, dir, name);
@@ -190,13 +188,6 @@
              inputPath.c_str());
 
     renderer.init(picture);
-    
-    if (FLAGS_preprocess) {
-        if (NULL != renderer.getCanvas()) {
-            renderer.getCanvas()->EXPERIMENTAL_optimize(picture);
-        }
-    }
-
     renderer.setup();
 
     SkString* outputPath = NULL;