OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "CrashHandler.h" | 8 #include "CrashHandler.h" |
9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 const char* path = FLAGS_skps[i]; | 511 const char* path = FLAGS_skps[i]; |
512 if (sk_isdir(path)) { | 512 if (sk_isdir(path)) { |
513 SkOSFile::Iter it(path, "skp"); | 513 SkOSFile::Iter it(path, "skp"); |
514 for (SkString file; it.next(&file); ) { | 514 for (SkString file; it.next(&file); ) { |
515 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str() ))); | 515 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str() ))); |
516 } | 516 } |
517 } else { | 517 } else { |
518 push_src("skp", "", new SKPSrc(path)); | 518 push_src("skp", "", new SKPSrc(path)); |
519 } | 519 } |
520 } | 520 } |
521 static const char* const exts[] = { | 521 |
522 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico" , | 522 SkTArray<SkString> images; |
523 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO" , | 523 SkCommonFlags::collectImages(&images); |
524 }; | 524 for (auto image : images) { |
525 for (int i = 0; i < FLAGS_images.count(); i++) { | 525 push_src("image", "decode", new ImageSrc(image)); // Decode entire image |
526 const char* flag = FLAGS_images[i]; | 526 push_codec_srcs(image); |
527 if (sk_isdir(flag)) { | 527 const char* ext = ""; |
528 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { | 528 int index = image.findLastOf('.'); |
529 SkOSFile::Iter it(flag, exts[j]); | 529 if (index >= 0 && (size_t) ++index < image.size()) { |
530 for (SkString file; it.next(&file); ) { | 530 ext = &image.c_str()[index]; |
531 SkString path = SkOSPath::Join(flag, file.c_str()); | 531 } |
532 push_src("image", "decode", new ImageSrc(path)); // Decode e ntire image | 532 if (brd_supported(ext)) { |
scroggo
2016/01/22 17:54:59
This behavior is slightly different. We used to on
| |
533 push_codec_srcs(path); | 533 push_brd_srcs(image); |
534 if (brd_supported(exts[j])) { | |
535 push_brd_srcs(path); | |
536 } | |
537 } | |
538 } | |
539 } else if (sk_exists(flag)) { | |
540 // assume that FLAGS_images[i] is a valid image if it is a file. | |
541 push_src("image", "decode", new ImageSrc(flag)); // Decode entire im age. | |
542 push_codec_srcs(flag); | |
543 push_brd_srcs(flag); | |
544 } | 534 } |
545 } | 535 } |
546 } | 536 } |
547 | 537 |
548 static void push_sink(const SkCommandLineConfig& config, Sink* s) { | 538 static void push_sink(const SkCommandLineConfig& config, Sink* s) { |
549 SkAutoTDelete<Sink> sink(s); | 539 SkAutoTDelete<Sink> sink(s); |
550 | 540 |
551 // Try a simple Src as a canary. If it fails, skip this sink. | 541 // Try a simple Src as a canary. If it fails, skip this sink. |
552 struct : public Src { | 542 struct : public Src { |
553 Error draw(SkCanvas* c) const override { | 543 Error draw(SkCanvas* c) const override { |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1244 Reporter* reporter, | 1234 Reporter* reporter, |
1245 GrContextFactory* fac tory); | 1235 GrContextFactory* fac tory); |
1246 } // namespace skiatest | 1236 } // namespace skiatest |
1247 | 1237 |
1248 #if !defined(SK_BUILD_FOR_IOS) | 1238 #if !defined(SK_BUILD_FOR_IOS) |
1249 int main(int argc, char** argv) { | 1239 int main(int argc, char** argv) { |
1250 SkCommandLineFlags::Parse(argc, argv); | 1240 SkCommandLineFlags::Parse(argc, argv); |
1251 return dm_main(); | 1241 return dm_main(); |
1252 } | 1242 } |
1253 #endif | 1243 #endif |
OLD | NEW |