Skip the TIMESTAMP file.
Allows run_decoding_tests.py to pass the name of the folder, so
Android will not fail on account of the long adb command.
R=borenet@google.com
Review URL: https://codereview.chromium.org/18175008
git-svn-id: http://skia.googlecode.com/svn/trunk@9817 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/skimage_main.cpp b/tools/skimage_main.cpp
index 572f9f5..6cfc36c 100644
--- a/tools/skimage_main.cpp
+++ b/tools/skimage_main.cpp
@@ -489,6 +489,22 @@
}
}
+/**
+ * Return true if the filename represents an image.
+ */
+static bool is_image_file(const char* filename) {
+ const char* gImageExtensions[] = {
+ ".png", ".PNG", ".jpg", ".JPG", ".jpeg", ".JPEG", ".bmp", ".BMP",
+ ".webp", ".WEBP", ".ico", ".ICO", ".wbmp", ".WBMP", ".gif", ".GIF"
+ };
+ for (size_t i = 0; i < SK_ARRAY_COUNT(gImageExtensions); ++i) {
+ if (SkStrEndsWith(filename, gImageExtensions[i])) {
+ return true;
+ }
+ }
+ return false;
+}
+
int tool_main(int argc, char** argv);
int tool_main(int argc, char** argv) {
SkCommandLineFlags::SetUsage("Decode files, and optionally write the results to files.");
@@ -528,10 +544,13 @@
SkOSFile::Iter iter(dir);
SkString filename;
while (iter.next(&filename)) {
+ if (!is_image_file(filename.c_str())) {
+ continue;
+ }
SkString fullname = SkOSPath::SkPathJoin(dir, filename.c_str());
decodeFileAndWrite(fullname.c_str(), outDirPtr);
}
- } else if (sk_exists(readPath)) {
+ } else if (sk_exists(readPath) && is_image_file(readPath)) {
decodeFileAndWrite(readPath, outDirPtr);
}
}