Allow setting a scaleFactor in bench_pictures (and render_pictures).
In TiledPictureRenderer and CopyTilesRenderer, do a postTranslate so
the translate is not affected by the scale factor.
Likewise, use clipRegion for tiled renderer so it will be
unaffected by the scale factor.
Respect the viewport for record, playbackCreation, and pipe renderers.
Review URL: https://codereview.appspot.com/6947072
git-svn-id: http://skia.googlecode.com/svn/trunk@6853 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index d43e1c4..3a58eea 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -30,7 +30,7 @@
" | tile width height]\n"
" [--pipe]\n"
" [--multi count]\n"
-" [--viewport width height]\n"
+" [--viewport width height][--scale sf]\n"
" [--device bitmap"
#if SK_SUPPORT_GPU
" | gpu"
@@ -76,6 +76,7 @@
" --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"
+" --scale sf : Scale drawing by sf.\n"
" --pipe: Benchmark SkGPipe rendering. Currently incompatible with \"mode\".\n");
SkDebugf(
" --device bitmap"
@@ -189,6 +190,7 @@
const char* mode = NULL;
SkISize viewport;
viewport.setEmpty();
+ SkScalar scaleFactor = SK_Scalar1;
for (++argv; argv < stop; ++argv) {
if (0 == strcmp(*argv, "--mode")) {
if (renderer != NULL) {
@@ -255,6 +257,14 @@
exit(-1);
}
viewport.fHeight = atoi(*argv);
+ } else if (0 == strcmp(*argv, "--scale")) {
+ ++argv;
+ if (argv >= stop) {
+ SkDebugf("Missing scaleFactor for --scale\n");
+ usage(argv0);
+ exit(-1);
+ }
+ scaleFactor = atof(*argv);
} else if (0 == strcmp(*argv, "--tiles")) {
++argv;
if (argv >= stop) {
@@ -460,6 +470,7 @@
}
renderer->setViewport(viewport);
+ renderer->setScaleFactor(scaleFactor);
renderer->setDeviceType(deviceType);
}