| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 }; | 512 }; |
| 513 | 513 |
| 514 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { | 514 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { |
| 515 if (0 == strcmp(exts[i], ext)) { | 515 if (0 == strcmp(exts[i], ext)) { |
| 516 return true; | 516 return true; |
| 517 } | 517 } |
| 518 } | 518 } |
| 519 return false; | 519 return false; |
| 520 } | 520 } |
| 521 | 521 |
| 522 static bool is_raw(const SkString& file) { | |
| 523 static const char* const exts[] = { | |
| 524 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", | |
| 525 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", | |
| 526 }; | |
| 527 | |
| 528 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { | |
| 529 if (file.endsWith(exts[i])) { | |
| 530 return true; | |
| 531 } | |
| 532 } | |
| 533 return false; | |
| 534 } | |
| 535 | |
| 536 static void gather_srcs() { | 522 static void gather_srcs() { |
| 537 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex
t()) { | 523 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex
t()) { |
| 538 push_src("gm", "", new GMSrc(r->factory())); | 524 push_src("gm", "", new GMSrc(r->factory())); |
| 539 } | 525 } |
| 540 for (int i = 0; i < FLAGS_skps.count(); i++) { | 526 for (int i = 0; i < FLAGS_skps.count(); i++) { |
| 541 const char* path = FLAGS_skps[i]; | 527 const char* path = FLAGS_skps[i]; |
| 542 if (sk_isdir(path)) { | 528 if (sk_isdir(path)) { |
| 543 SkOSFile::Iter it(path, "skp"); | 529 SkOSFile::Iter it(path, "skp"); |
| 544 for (SkString file; it.next(&file); ) { | 530 for (SkString file; it.next(&file); ) { |
| 545 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str()
))); | 531 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str()
))); |
| 546 } | 532 } |
| 547 } else { | 533 } else { |
| 548 push_src("skp", "", new SKPSrc(path)); | 534 push_src("skp", "", new SKPSrc(path)); |
| 549 } | 535 } |
| 550 } | 536 } |
| 551 static const char* const exts[] = { | 537 static const char* const exts[] = { |
| 552 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico"
, | 538 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico"
, |
| 553 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO"
, | 539 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO"
, |
| 554 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", | 540 "arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", |
| 555 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", | 541 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW", |
| 556 }; | 542 }; |
| 557 for (int i = 0; i < FLAGS_images.count(); i++) { | 543 for (int i = 0; i < FLAGS_images.count(); i++) { |
| 558 const char* flag = FLAGS_images[i]; | 544 const char* flag = FLAGS_images[i]; |
| 559 if (sk_isdir(flag)) { | 545 if (sk_isdir(flag)) { |
| 560 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { | 546 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { |
| 561 SkOSFile::Iter it(flag, exts[j]); | 547 SkOSFile::Iter it(flag, exts[j]); |
| 562 for (SkString file; it.next(&file); ) { | 548 for (SkString file; it.next(&file); ) { |
| 563 SkString path = SkOSPath::Join(flag, file.c_str()); | 549 SkString path = SkOSPath::Join(flag, file.c_str()); |
| 564 if (!is_raw(file)) { | |
| 565 push_src("image", "decode", new ImageSrc(path)); // Deco
de entire image | |
| 566 } | |
| 567 push_codec_srcs(path); | 550 push_codec_srcs(path); |
| 568 if (brd_supported(exts[j])) { | 551 if (brd_supported(exts[j])) { |
| 569 push_brd_srcs(path); | 552 push_brd_srcs(path); |
| 570 } | 553 } |
| 571 } | 554 } |
| 572 } | 555 } |
| 573 } else if (sk_exists(flag)) { | 556 } else if (sk_exists(flag)) { |
| 574 // assume that FLAGS_images[i] is a valid image if it is a file. | 557 // assume that FLAGS_images[i] is a valid image if it is a file. |
| 575 if (!is_raw(SkString(flag))) { | |
| 576 push_src("image", "decode", new ImageSrc(flag)); // Decode entir
e image. | |
| 577 } | |
| 578 push_codec_srcs(flag); | 558 push_codec_srcs(flag); |
| 579 push_brd_srcs(flag); | 559 push_brd_srcs(flag); |
| 580 } | 560 } |
| 581 } | 561 } |
| 582 } | 562 } |
| 583 | 563 |
| 584 static void push_sink(const SkCommandLineConfig& config, Sink* s) { | 564 static void push_sink(const SkCommandLineConfig& config, Sink* s) { |
| 585 SkAutoTDelete<Sink> sink(s); | 565 SkAutoTDelete<Sink> sink(s); |
| 586 | 566 |
| 587 // Try a simple Src as a canary. If it fails, skip this sink. | 567 // Try a simple Src as a canary. If it fails, skip this sink. |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 Reporter* reporter, | 1261 Reporter* reporter, |
| 1282 GrContextFactory* fac
tory); | 1262 GrContextFactory* fac
tory); |
| 1283 } // namespace skiatest | 1263 } // namespace skiatest |
| 1284 | 1264 |
| 1285 #if !defined(SK_BUILD_FOR_IOS) | 1265 #if !defined(SK_BUILD_FOR_IOS) |
| 1286 int main(int argc, char** argv) { | 1266 int main(int argc, char** argv) { |
| 1287 SkCommandLineFlags::Parse(argc, argv); | 1267 SkCommandLineFlags::Parse(argc, argv); |
| 1288 return dm_main(); | 1268 return dm_main(); |
| 1289 } | 1269 } |
| 1290 #endif | 1270 #endif |
| OLD | NEW |