Index: dm/DM.cpp |
diff --git a/dm/DM.cpp b/dm/DM.cpp |
index dd4e48fc5dd116cacee09ad87806182b2bd53564..15c1cfa5c9425f49b830e1d3b6551993a811a7e2 100644 |
--- a/dm/DM.cpp |
+++ b/dm/DM.cpp |
@@ -133,18 +133,25 @@ static void gather_srcs() { |
push_src("skp", new SKPSrc(SkString(path))); |
} |
} |
- if (!FLAGS_images.isEmpty()) { |
- const char* exts[] = { |
- "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico", |
- "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO", |
- }; |
- for (size_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { |
- SkOSFile::Iter it(FLAGS_images[0], exts[i]); |
- for (SkString file; it.next(&file); ) { |
- SkString path = SkOSPath::Join(FLAGS_images[0], file.c_str()); |
- push_src("image", new ImageSrc(path)); // Decode entire image. |
- push_src("image", new ImageSrc(path, 5)); // Decode 5 random subsets. |
+ static const char* const exts[] = { |
+ "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico", |
+ "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO", |
+ }; |
+ for (int i = 0; i < FLAGS_images.count(); i++) { |
+ const char* flag = FLAGS_images[i]; |
scroggo
2015/01/30 17:57:22
nit: flag -> path
|
+ if (sk_isdir(flag)) { |
scroggo
2015/01/30 17:57:22
I was trying to imagine how to make this share cod
|
+ for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { |
+ SkOSFile::Iter it(flag, exts[j]); |
+ for (SkString file; it.next(&file); ) { |
+ SkString path = SkOSPath::Join(flag, file.c_str()); |
+ push_src("image", new ImageSrc(path)); // Decode entire image. |
+ push_src("image", new ImageSrc(path, 5)); // Decode 5 random subsets. |
+ } |
} |
+ } else if (sk_exists(flag)) { |
+ // assume that FLAGS_images[i] is a valid image if it is a file. |
+ push_src("image", new ImageSrc(SkString(flag))); // Decode entire image. |
+ push_src("image", new ImageSrc(SkString(flag), 5)); // Decode 5 random subsets. |
} |
} |
} |