Allow bench_pictures to have its viewport set on the command line.
Instead of drawing the entire (potentially very large) picture, only
draw one viewport's worth.
example:
bench_pictures <skp directory> --viewport 640 480
BUG=https://code.google.com/p/skia/issues/detail?id=1007
Review URL: https://codereview.appspot.com/6943052
git-svn-id: http://skia.googlecode.com/svn/trunk@6799 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 250058e..d43e1c4 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -30,6 +30,7 @@
" | tile width height]\n"
" [--pipe]\n"
" [--multi count]\n"
+" [--viewport width height]\n"
" [--device bitmap"
#if SK_SUPPORT_GPU
" | gpu"
@@ -74,6 +75,7 @@
SkDebugf(
" --multi count : Set the number of threads for multi threaded drawing. Must be greater\n"
" than 1. Only works with tiled rendering.\n"
+" --viewport width height : Set the viewport.\n"
" --pipe: Benchmark SkGPipe rendering. Currently incompatible with \"mode\".\n");
SkDebugf(
" --device bitmap"
@@ -185,7 +187,8 @@
const char* xTilesString = NULL;
const char* yTilesString = NULL;
const char* mode = NULL;
-
+ SkISize viewport;
+ viewport.setEmpty();
for (++argv; argv < stop; ++argv) {
if (0 == strcmp(*argv, "--mode")) {
if (renderer != NULL) {
@@ -237,6 +240,21 @@
usage(argv0);
exit(-1);
}
+ } else if (0 == strcmp(*argv, "--viewport")) {
+ ++argv;
+ if (argv >= stop) {
+ SkDebugf("Missing width for --viewport\n");
+ usage(argv0);
+ exit(-1);
+ }
+ viewport.fWidth = atoi(*argv);
+ ++argv;
+ if (argv >= stop) {
+ SkDebugf("Missing height for --viewport\n");
+ usage(argv0);
+ exit(-1);
+ }
+ viewport.fHeight = atoi(*argv);
} else if (0 == strcmp(*argv, "--tiles")) {
++argv;
if (argv >= stop) {
@@ -441,6 +459,7 @@
renderer = SkNEW(sk_tools::SimplePictureRenderer);
}
+ renderer->setViewport(viewport);
renderer->setDeviceType(deviceType);
}