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