Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: dm/DM.cpp

Issue 1933753002: Add ColorCodecSrc for testing/comparison on color corrected decodes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bench/nanobench.cpp ('k') | dm/DMSrcSink.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 }; 755 };
756 756
757 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { 757 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) {
758 if (0 == strcmp(exts[i], ext)) { 758 if (0 == strcmp(exts[i], ext)) {
759 return true; 759 return true;
760 } 760 }
761 } 761 }
762 return false; 762 return false;
763 } 763 }
764 764
765 static void push_color_codec_srcs(Path path) {
766 ColorCodecSrc* src = new ColorCodecSrc(path, ColorCodecSrc::kBaseline_Mode);
scroggo 2016/04/29 15:36:51 Given that this is only two lines and only called
msarett 2016/04/29 16:37:24 Done.
767 push_src("image", "color_codec_baseline", src);
768 }
769
765 static bool gather_srcs() { 770 static bool gather_srcs() {
766 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex t()) { 771 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex t()) {
767 push_src("gm", "", new GMSrc(r->factory())); 772 push_src("gm", "", new GMSrc(r->factory()));
768 } 773 }
769 for (int i = 0; i < FLAGS_skps.count(); i++) { 774 for (int i = 0; i < FLAGS_skps.count(); i++) {
770 const char* path = FLAGS_skps[i]; 775 const char* path = FLAGS_skps[i];
771 if (sk_isdir(path)) { 776 if (sk_isdir(path)) {
772 SkOSFile::Iter it(path, "skp"); 777 SkOSFile::Iter it(path, "skp");
773 for (SkString file; it.next(&file); ) { 778 for (SkString file; it.next(&file); ) {
774 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str() ))); 779 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str() )));
775 } 780 }
776 } else { 781 } else {
777 push_src("skp", "", new SKPSrc(path)); 782 push_src("skp", "", new SKPSrc(path));
778 } 783 }
779 } 784 }
780 785
781 SkTArray<SkString> images; 786 SkTArray<SkString> images;
782 if (!CollectImages(&images)) { 787 if (!CollectImages(FLAGS_images, &images)) {
783 return false; 788 return false;
784 } 789 }
785 790
786 for (auto image : images) { 791 for (auto image : images) {
787 push_codec_srcs(image); 792 push_codec_srcs(image);
788 if (FLAGS_simpleCodec) { 793 if (FLAGS_simpleCodec) {
789 continue; 794 continue;
790 } 795 }
791 796
792 const char* ext = strrchr(image.c_str(), '.'); 797 const char* ext = strrchr(image.c_str(), '.');
793 if (ext && brd_supported(ext+1)) { 798 if (ext && brd_supported(ext+1)) {
794 push_brd_srcs(image); 799 push_brd_srcs(image);
795 } 800 }
796 } 801 }
797 802
803 SkTArray<SkString> colorImages;
804 if (!CollectImages(FLAGS_colorImages, &colorImages)) {
805 return false;
806 }
807
808 for (auto colorImage : colorImages) {
809 push_color_codec_srcs(colorImage);
810 }
811
798 return true; 812 return true;
799 } 813 }
800 814
801 static void push_sink(const SkCommandLineConfig& config, Sink* s) { 815 static void push_sink(const SkCommandLineConfig& config, Sink* s) {
802 SkAutoTDelete<Sink> sink(s); 816 SkAutoTDelete<Sink> sink(s);
803 817
804 // Try a simple Src as a canary. If it fails, skip this sink. 818 // Try a simple Src as a canary. If it fails, skip this sink.
805 struct : public Src { 819 struct : public Src {
806 Error draw(SkCanvas* c) const override { 820 Error draw(SkCanvas* c) const override {
807 c->drawRect(SkRect::MakeWH(1,1), SkPaint()); 821 c->drawRect(SkRect::MakeWH(1,1), SkPaint());
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 #endif 1447 #endif
1434 } 1448 }
1435 } // namespace skiatest 1449 } // namespace skiatest
1436 1450
1437 #if !defined(SK_BUILD_FOR_IOS) 1451 #if !defined(SK_BUILD_FOR_IOS)
1438 int main(int argc, char** argv) { 1452 int main(int argc, char** argv) {
1439 SkCommandLineFlags::Parse(argc, argv); 1453 SkCommandLineFlags::Parse(argc, argv);
1440 return dm_main(); 1454 return dm_main();
1441 } 1455 }
1442 #endif 1456 #endif
OLDNEW
« no previous file with comments | « bench/nanobench.cpp ('k') | dm/DMSrcSink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698