Index: dm/DM.cpp |
diff --git a/dm/DM.cpp b/dm/DM.cpp |
index 25a12637887c8ecfc403c93ec1dac66948f321f9..e23e56bb2e8103ccb6ee92facb736c84ca722a39 100644 |
--- a/dm/DM.cpp |
+++ b/dm/DM.cpp |
@@ -518,29 +518,19 @@ static void gather_srcs() { |
push_src("skp", "", new SKPSrc(path)); |
} |
} |
- 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]; |
- if (sk_isdir(flag)) { |
- 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", "decode", new ImageSrc(path)); // Decode entire image |
- push_codec_srcs(path); |
- if (brd_supported(exts[j])) { |
- push_brd_srcs(path); |
- } |
- } |
- } |
- } else if (sk_exists(flag)) { |
- // assume that FLAGS_images[i] is a valid image if it is a file. |
- push_src("image", "decode", new ImageSrc(flag)); // Decode entire image. |
- push_codec_srcs(flag); |
- push_brd_srcs(flag); |
+ |
+ SkTArray<SkString> images; |
+ SkCommonFlags::collectImages(&images); |
+ for (auto image : images) { |
+ push_src("image", "decode", new ImageSrc(image)); // Decode entire image |
+ push_codec_srcs(image); |
+ const char* ext = ""; |
+ int index = image.findLastOf('.'); |
+ if (index >= 0 && (size_t) ++index < image.size()) { |
+ ext = &image.c_str()[index]; |
+ } |
+ if (brd_supported(ext)) { |
scroggo
2016/01/22 17:54:59
This behavior is slightly different. We used to on
|
+ push_brd_srcs(image); |
} |
} |
} |