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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 }; | 496 }; |
497 | 497 |
498 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { | 498 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { |
499 if (0 == strcmp(exts[i], ext)) { | 499 if (0 == strcmp(exts[i], ext)) { |
500 return true; | 500 return true; |
501 } | 501 } |
502 } | 502 } |
503 return false; | 503 return false; |
504 } | 504 } |
505 | 505 |
506 static bool is_raw(const SkString& file) { | |
507 static const char* const exts[] = { | |
508 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", | |
509 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", | |
510 }; | |
511 | |
512 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { | |
513 if (file.endsWith(exts[i])) { | |
514 return true; | |
515 } | |
516 } | |
517 return false; | |
518 } | |
519 | |
520 static void gather_srcs() { | 506 static void gather_srcs() { |
521 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex
t()) { | 507 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex
t()) { |
522 push_src("gm", "", new GMSrc(r->factory())); | 508 push_src("gm", "", new GMSrc(r->factory())); |
523 } | 509 } |
524 for (int i = 0; i < FLAGS_skps.count(); i++) { | 510 for (int i = 0; i < FLAGS_skps.count(); i++) { |
525 const char* path = FLAGS_skps[i]; | 511 const char* path = FLAGS_skps[i]; |
526 if (sk_isdir(path)) { | 512 if (sk_isdir(path)) { |
527 SkOSFile::Iter it(path, "skp"); | 513 SkOSFile::Iter it(path, "skp"); |
528 for (SkString file; it.next(&file); ) { | 514 for (SkString file; it.next(&file); ) { |
529 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str()
))); | 515 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str()
))); |
530 } | 516 } |
531 } else { | 517 } else { |
532 push_src("skp", "", new SKPSrc(path)); | 518 push_src("skp", "", new SKPSrc(path)); |
533 } | 519 } |
534 } | 520 } |
535 static const char* const exts[] = { | 521 static const char* const exts[] = { |
536 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico"
, | 522 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico"
, |
537 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO"
, | 523 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO"
, |
538 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", | |
539 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", | |
540 }; | 524 }; |
541 for (int i = 0; i < FLAGS_images.count(); i++) { | 525 for (int i = 0; i < FLAGS_images.count(); i++) { |
542 const char* flag = FLAGS_images[i]; | 526 const char* flag = FLAGS_images[i]; |
543 if (sk_isdir(flag)) { | 527 if (sk_isdir(flag)) { |
544 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { | 528 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { |
545 SkOSFile::Iter it(flag, exts[j]); | 529 SkOSFile::Iter it(flag, exts[j]); |
546 for (SkString file; it.next(&file); ) { | 530 for (SkString file; it.next(&file); ) { |
547 SkString path = SkOSPath::Join(flag, file.c_str()); | 531 SkString path = SkOSPath::Join(flag, file.c_str()); |
548 if (!is_raw(file)) { | 532 push_src("image", "decode", new ImageSrc(path)); // Decode e
ntire image |
549 push_src("image", "decode", new ImageSrc(path)); // Deco
de entire image | |
550 } | |
551 push_codec_srcs(path); | 533 push_codec_srcs(path); |
552 if (brd_supported(exts[j])) { | 534 if (brd_supported(exts[j])) { |
553 push_brd_srcs(path); | 535 push_brd_srcs(path); |
554 } | 536 } |
555 } | 537 } |
556 } | 538 } |
557 } else if (sk_exists(flag)) { | 539 } else if (sk_exists(flag)) { |
558 // assume that FLAGS_images[i] is a valid image if it is a file. | 540 // assume that FLAGS_images[i] is a valid image if it is a file. |
559 if (!is_raw(SkString(flag))) { | 541 push_src("image", "decode", new ImageSrc(flag)); // Decode entire im
age. |
560 push_src("image", "decode", new ImageSrc(flag)); // Decode entir
e image. | |
561 } | |
562 push_codec_srcs(flag); | 542 push_codec_srcs(flag); |
563 push_brd_srcs(flag); | 543 push_brd_srcs(flag); |
564 } | 544 } |
565 } | 545 } |
566 } | 546 } |
567 | 547 |
568 static void push_sink(const SkCommandLineConfig& config, Sink* s) { | 548 static void push_sink(const SkCommandLineConfig& config, Sink* s) { |
569 SkAutoTDelete<Sink> sink(s); | 549 SkAutoTDelete<Sink> sink(s); |
570 | 550 |
571 // Try a simple Src as a canary. If it fails, skip this sink. | 551 // Try a simple Src as a canary. If it fails, skip this sink. |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 Reporter* reporter, | 1244 Reporter* reporter, |
1265 GrContextFactory* fac
tory); | 1245 GrContextFactory* fac
tory); |
1266 } // namespace skiatest | 1246 } // namespace skiatest |
1267 | 1247 |
1268 #if !defined(SK_BUILD_FOR_IOS) | 1248 #if !defined(SK_BUILD_FOR_IOS) |
1269 int main(int argc, char** argv) { | 1249 int main(int argc, char** argv) { |
1270 SkCommandLineFlags::Parse(argc, argv); | 1250 SkCommandLineFlags::Parse(argc, argv); |
1271 return dm_main(); | 1251 return dm_main(); |
1272 } | 1252 } |
1273 #endif | 1253 #endif |
OLD | NEW |