Enable automatic rescaling in bench_pictures
bench_pictures with "--device gpu" is failing because we're trying to allocate
too much GPU memory. Move the recently-added scaling code into picture_utils
and share it between render_pictures and bench_pictures.
Review URL: https://codereview.appspot.com/6495125
git-svn-id: http://skia.googlecode.com/svn/trunk@5543 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index 8edbb94..93b1cf9 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -109,17 +109,21 @@
return;
}
- SkPicture picture(&inputStream);
+ SkPicture* picture = SkNEW_ARGS(SkPicture, (&inputStream));
+ SkAutoTUnref<SkPicture> aur(picture);
SkString filename;
sk_tools::get_basename(&filename, inputPath);
SkString result;
- result.printf("running bench [%i %i] %s ", picture.width(), picture.height(),
- filename.c_str());
+ result.printf("running bench [%i %i] %s ", picture->width(),
+ picture->height(), filename.c_str());
gLogger.logProgress(result);
- benchmark.run(&picture);
+ // rescale to avoid memory issues allocating a very large offscreen
+ sk_tools::resize_if_needed(&aur);
+
+ benchmark.run(aur);
}
static void parse_commandline(int argc, char* const argv[], SkTArray<SkString>* inputs,