Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #include "CrashHandler.h" | 1 #include "CrashHandler.h" |
| 2 #include "DMJsonWriter.h" | 2 #include "DMJsonWriter.h" |
| 3 #include "DMSrcSink.h" | 3 #include "DMSrcSink.h" |
| 4 #include "DMSrcSinkAndroid.h" | 4 #include "DMSrcSinkAndroid.h" |
| 5 #include "OverwriteLine.h" | 5 #include "OverwriteLine.h" |
| 6 #include "ProcStats.h" | 6 #include "ProcStats.h" |
| 7 #include "SkBBHFactory.h" | 7 #include "SkBBHFactory.h" |
| 8 #include "SkChecksum.h" | 8 #include "SkChecksum.h" |
| 9 #include "SkCommonFlags.h" | 9 #include "SkCommonFlags.h" |
| 10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
| 11 #include "SkGraphics.h" | 11 #include "SkGraphics.h" |
| 12 #include "SkInstCnt.h" | 12 #include "SkInstCnt.h" |
| 13 #include "SkMD5.h" | 13 #include "SkMD5.h" |
| 14 #include "SkOSFile.h" | 14 #include "SkOSFile.h" |
| 15 #include "SkTHash.h" | 15 #include "SkTHash.h" |
| 16 #include "SkTaskGroup.h" | 16 #include "SkTaskGroup.h" |
| 17 #include "SkThreadUtils.h" | 17 #include "SkThreadUtils.h" |
| 18 #include "Test.h" | 18 #include "Test.h" |
| 19 #include "Timer.h" | 19 #include "Timer.h" |
| 20 | 20 |
| 21 DEFINE_string(src, "tests gm skp image subset", "Source types to test."); | 21 DEFINE_string(src, "tests gm skp image subset codec", "Source types to test."); |
| 22 DEFINE_bool(nameByHash, false, | 22 DEFINE_bool(nameByHash, false, |
| 23 "If true, write to FLAGS_writePath[0]/<hash>.png instead of " | 23 "If true, write to FLAGS_writePath[0]/<hash>.png instead of " |
| 24 "to FLAGS_writePath[0]/<config>/<sourceType>/<name>.png"); | 24 "to FLAGS_writePath[0]/<config>/<sourceType>/<name>.png"); |
| 25 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); | 25 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); |
| 26 DEFINE_string(matrix, "1 0 0 1", | 26 DEFINE_string(matrix, "1 0 0 1", |
| 27 "2x2 scale+skew matrix to apply or upright when using " | 27 "2x2 scale+skew matrix to apply or upright when using " |
| 28 "'matrix' or 'upright' in config."); | 28 "'matrix' or 'upright' in config."); |
| 29 DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?"); | 29 DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?"); |
| 30 | 30 |
| 31 DEFINE_string(blacklist, "", | 31 DEFINE_string(blacklist, "", |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 static void push_src(const char* tag, Src* s) { | 120 static void push_src(const char* tag, Src* s) { |
| 121 SkAutoTDelete<Src> src(s); | 121 SkAutoTDelete<Src> src(s); |
| 122 if (FLAGS_src.contains(tag) && | 122 if (FLAGS_src.contains(tag) && |
| 123 !SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) { | 123 !SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) { |
| 124 Tagged<Src>& s = gSrcs.push_back(); | 124 Tagged<Src>& s = gSrcs.push_back(); |
| 125 s.reset(src.detach()); | 125 s.reset(src.detach()); |
| 126 s.tag = tag; | 126 s.tag = tag; |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 static bool codec_supported(const char* ext) { | |
| 131 // FIXME: Once other versions of SkCodec are available, we can add them to t his | |
| 132 // list (and eventually we can remove this check once they are all supported ). | |
| 133 return strcmp(ext, "png") == 0 || strcmp(ext, "PNG") == 0; | |
| 134 } | |
| 135 | |
| 130 static void gather_srcs() { | 136 static void gather_srcs() { |
| 131 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex t()) { | 137 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex t()) { |
| 132 push_src("gm", new GMSrc(r->factory())); | 138 push_src("gm", new GMSrc(r->factory())); |
| 133 } | 139 } |
| 134 for (int i = 0; i < FLAGS_skps.count(); i++) { | 140 for (int i = 0; i < FLAGS_skps.count(); i++) { |
| 135 const char* path = FLAGS_skps[i]; | 141 const char* path = FLAGS_skps[i]; |
| 136 if (sk_isdir(path)) { | 142 if (sk_isdir(path)) { |
| 137 SkOSFile::Iter it(path, "skp"); | 143 SkOSFile::Iter it(path, "skp"); |
| 138 for (SkString file; it.next(&file); ) { | 144 for (SkString file; it.next(&file); ) { |
| 139 push_src("skp", new SKPSrc(SkOSPath::Join(path, file.c_str()))); | 145 push_src("skp", new SKPSrc(SkOSPath::Join(path, file.c_str()))); |
| 140 } | 146 } |
| 141 } else { | 147 } else { |
| 142 push_src("skp", new SKPSrc(path)); | 148 push_src("skp", new SKPSrc(path)); |
| 143 } | 149 } |
| 144 } | 150 } |
| 145 static const char* const exts[] = { | 151 static const char* const exts[] = { |
| 146 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico" , | 152 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico" , |
| 147 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO" , | 153 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO" , |
| 148 }; | 154 }; |
| 149 for (int i = 0; i < FLAGS_images.count(); i++) { | 155 for (int i = 0; i < FLAGS_images.count(); i++) { |
| 150 const char* flag = FLAGS_images[i]; | 156 const char* flag = FLAGS_images[i]; |
| 151 if (sk_isdir(flag)) { | 157 if (sk_isdir(flag)) { |
| 152 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { | 158 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { |
| 153 SkOSFile::Iter it(flag, exts[j]); | 159 SkOSFile::Iter it(flag, exts[j]); |
| 154 for (SkString file; it.next(&file); ) { | 160 for (SkString file; it.next(&file); ) { |
| 155 SkString path = SkOSPath::Join(flag, file.c_str()); | 161 SkString path = SkOSPath::Join(flag, file.c_str()); |
| 156 push_src("image", new ImageSrc(path)); // Decode entire image. | 162 push_src("image", new ImageSrc(path)); // Decode entire image. |
| 157 push_src("subset", new ImageSrc(path, 2)); // Decode into 2 x 2 subsets | 163 push_src("subset", new ImageSrc(path, 2)); // Decode into 2 x 2 subsets |
| 164 if (codec_supported(exts[j])) { | |
| 165 push_src("codec", new CodecSrc(path)); // Decode wit h SkCodec. | |
| 166 } | |
| 158 } | 167 } |
| 159 } | 168 } |
| 160 } else if (sk_exists(flag)) { | 169 } else if (sk_exists(flag)) { |
| 161 // assume that FLAGS_images[i] is a valid image if it is a file. | 170 // assume that FLAGS_images[i] is a valid image if it is a file. |
| 162 push_src("image", new ImageSrc(flag)); // Decode entire image. | 171 push_src("image", new ImageSrc(flag)); // Decode entire image. |
| 163 push_src("subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subs ets | 172 push_src("subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subs ets |
| 173 push_src("codec", new CodecSrc(flag)); // Decode with SkCodec. | |
|
mtklein
2015/03/17 20:24:15
Want to check the extension here too?
scroggo
2015/03/19 12:57:54
I thought about it, but this case is different:
We
| |
| 164 } | 174 } |
| 165 } | 175 } |
| 166 } | 176 } |
| 167 | 177 |
| 168 static GrGLStandard get_gpu_api() { | 178 static GrGLStandard get_gpu_api() { |
| 169 if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; } | 179 if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; } |
| 170 if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; } | 180 if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; } |
| 171 return kNone_GrGLStandard; | 181 return kNone_GrGLStandard; |
| 172 } | 182 } |
| 173 | 183 |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 } | 611 } |
| 602 return 0; | 612 return 0; |
| 603 } | 613 } |
| 604 | 614 |
| 605 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 615 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 606 int main(int argc, char** argv) { | 616 int main(int argc, char** argv) { |
| 607 SkCommandLineFlags::Parse(argc, argv); | 617 SkCommandLineFlags::Parse(argc, argv); |
| 608 return dm_main(); | 618 return dm_main(); |
| 609 } | 619 } |
| 610 #endif | 620 #endif |
| OLD | NEW |