Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: dm/DM.cpp

Issue 872993005: dm: allow multiple --images flags, allow single files (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698