Add quiet mode to lua_pictures.

This allows:

for i in {0..5}; do
    out/Debug/lua_pictures -q --skpPath $SKP_PATH -l $SCRIPT --modulo $i 6
done

to generate output similar to what telemetry will generate.

R=reed@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/197793007

git-svn-id: http://skia.googlecode.com/svn/trunk@13861 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-03-19 19:23:17 +00:00
parent b7b7eb32f4
commit bdc772ebbe

View File

@ -36,6 +36,7 @@ DEFINE_string2(skpPath, r, "", "Read this .skp file or .skp files from this dir"
DEFINE_string2(luaFile, l, "", "File containing lua script to run");
DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning");
DEFINE_string2(tailFunc, s, "", "Optional lua function to call at end");
DEFINE_bool2(quiet, q, false, "Silence all non-error related output");
static SkPicture* load_picture(const char path[]) {
SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
@ -97,7 +98,9 @@ int tool_main(int argc, char** argv) {
for (int i = 0; i < FLAGS_luaFile.count(); ++i) {
SkAutoDataUnref data(read_into_data(FLAGS_luaFile[i]));
SkDebugf("loading %s...\n", FLAGS_luaFile[i]);
if (!FLAGS_quiet) {
SkDebugf("loading %s...\n", FLAGS_luaFile[i]);
}
if (!L.runCode(data->data(), data->size())) {
SkDebugf("failed to load luaFile %s\n", FLAGS_luaFile[i]);
exit(-1);
@ -144,7 +147,9 @@ int tool_main(int argc, char** argv) {
moduloStr.printf("[%d.%d] ", i, moduloDivisor);
}
const char* path = paths[i].c_str();
SkDebugf("scraping %s %s\n", path, moduloStr.c_str());
if (!FLAGS_quiet) {
SkDebugf("scraping %s %s\n", path, moduloStr.c_str());
}
SkAutoTUnref<SkPicture> pic(load_picture(path));
if (pic.get()) {