Added the option to enable GPU rendering on render_ and bench_pictures.

git-svn-id: http://skia.googlecode.com/svn/trunk@5183 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index e1a1eff..48139ce 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -23,7 +23,12 @@
     SkDebugf("\n"
 "Usage: \n"
 "     %s <input>... <outputDir> \n"
-"     [--mode pipe | simple | tile width[%] height[%]]"
+"     [--mode pipe | simple | tile width[%] height[%]]\n"
+"     [--device bitmap"
+#if SK_SUPPORT_GPU
+" | gpu"
+#endif
+"]"
 , argv0);
     SkDebugf("\n\n");
     SkDebugf(
@@ -41,6 +46,19 @@
     SkDebugf(
 "                     tile width[%] height[%], Do a simple render using tiles\n"
 "                                              with the given dimensions.\n");
+    SkDebugf("\n");
+    SkDebugf(
+"     --device bitmap"
+#if SK_SUPPORT_GPU
+" | gpu"
+#endif
+": Use the corresponding device. Default is bitmap.\n");
+    SkDebugf(
+"                     bitmap, Render to a bitmap.\n");
+    SkDebugf(
+#if SK_SUPPORT_GPU
+"                     gpu, Render to the GPU.\n");
+#endif
 }
 
 static void make_output_filepath(SkString* path, const SkString& dir,
@@ -129,6 +147,9 @@
     const char* argv0 = argv[0];
     char* const* stop = argv + argc;
 
+    sk_tools::PictureRenderer::SkDeviceTypes deviceType =
+        sk_tools::PictureRenderer::kBitmap_DeviceType;
+
     for (++argv; argv < stop; ++argv) {
         if (0 == strcmp(*argv, "--mode")) {
             SkDELETE(renderer);
@@ -202,6 +223,28 @@
                 usage(argv0);
                 exit(-1);
             }
+        } else if (0 == strcmp(*argv, "--device")) {
+            ++argv;
+            if (argv >= stop) {
+                SkDebugf("Missing mode for --deivce\n");
+                usage(argv0);
+                exit(-1);
+            }
+
+            if (0 == strcmp(*argv, "bitmap")) {
+                deviceType = sk_tools::PictureRenderer::kBitmap_DeviceType;
+            }
+#if SK_SUPPORT_GPU
+            else if (0 == strcmp(*argv, "gpu")) {
+                deviceType = sk_tools::PictureRenderer::kGPU_DeviceType;
+            }
+#endif
+            else {
+                SkDebugf("%s is not a valid mode for --device\n", *argv);
+                usage(argv0);
+                exit(-1);
+            }
+
         } else if ((0 == strcmp(*argv, "-h")) || (0 == strcmp(*argv, "--help"))) {
             SkDELETE(renderer);
             usage(argv0);
@@ -221,7 +264,7 @@
         renderer = SkNEW(sk_tools::SimplePictureRenderer);
     }
 
-    renderer->setUseGpuDevice();
+    renderer->setDeviceType(deviceType);
 }
 
 int main(int argc, char* const argv[]) {