| Index: tools/lua/lua_pictures.cpp
|
| diff --git a/tools/lua/lua_pictures.cpp b/tools/lua/lua_pictures.cpp
|
| index be66a7887def4fc9e53b0276ca672a58b18d4240..106948a8d3449e2867feeca8de1f8da9230e3c78 100644
|
| --- a/tools/lua/lua_pictures.cpp
|
| +++ b/tools/lua/lua_pictures.cpp
|
| @@ -33,7 +33,7 @@ static const char gSummarizeFunc[] = "sk_scrape_summarize";
|
| // PictureRenderingFlags.cpp
|
| extern bool lazy_decode_bitmap(const void* buffer, size_t size, SkBitmap*);
|
|
|
| -DEFINE_string2(skpPath, r, "", "Read .skp files from this dir");
|
| +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");
|
| @@ -116,15 +116,22 @@ int tool_main(int argc, char** argv) {
|
| }
|
|
|
| for (int i = 0; i < FLAGS_skpPath.count(); i ++) {
|
| - SkOSFile::Iter iter(FLAGS_skpPath[i], "skp");
|
| - SkString inputFilename;
|
| -
|
| - while (iter.next(&inputFilename)) {
|
| - SkString inputPath;
|
| - SkString inputAsSkString(FLAGS_skpPath[i]);
|
| - sk_tools::make_filepath(&inputPath, inputAsSkString, inputFilename);
|
| + SkTArray<SkString> paths;
|
| + if (sk_isdir(FLAGS_skpPath[i])) {
|
| + // Add all .skp in this directory.
|
| + const SkString directory(FLAGS_skpPath[i]);
|
| + SkString filename;
|
| + SkOSFile::Iter iter(FLAGS_skpPath[i], "skp");
|
| + while(iter.next(&filename)) {
|
| + sk_tools::make_filepath(&paths.push_back(), directory, filename);
|
| + }
|
| + } else {
|
| + // Add this as an .skp itself.
|
| + paths.push_back() = FLAGS_skpPath[i];
|
| + }
|
|
|
| - const char* path = inputPath.c_str();
|
| + for (int i = 0; i < paths.count(); i++) {
|
| + const char* path = paths[i].c_str();
|
| SkDebugf("scraping %s\n", path);
|
|
|
| SkAutoTUnref<SkPicture> pic(load_picture(path));
|
| @@ -133,9 +140,9 @@ int tool_main(int argc, char** argv) {
|
| new SkLuaCanvas(pic->width(), pic->height(),
|
| L.get(), gAccumulateFunc));
|
|
|
| - call_canvas(L.get(), canvas.get(), inputFilename.c_str(), gStartCanvasFunc);
|
| + call_canvas(L.get(), canvas.get(), path, gStartCanvasFunc);
|
| canvas->drawPicture(*pic);
|
| - call_canvas(L.get(), canvas.get(), inputFilename.c_str(), gEndCanvasFunc);
|
| + call_canvas(L.get(), canvas.get(), path, gEndCanvasFunc);
|
|
|
| } else {
|
| SkDebugf("failed to load\n");
|
|
|