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

Side by Side Diff: dm/DM.cpp

Issue 978823002: Run CodecSrc DM. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Respond to comments. Created 5 years, 9 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 | « no previous file | 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 #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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 static void push_src(const char* tag, Src* s) { 141 static void push_src(const char* tag, Src* s) {
142 SkAutoTDelete<Src> src(s); 142 SkAutoTDelete<Src> src(s);
143 if (FLAGS_src.contains(tag) && 143 if (FLAGS_src.contains(tag) &&
144 !SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) { 144 !SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) {
145 Tagged<Src>& s = gSrcs.push_back(); 145 Tagged<Src>& s = gSrcs.push_back();
146 s.reset(src.detach()); 146 s.reset(src.detach());
147 s.tag = tag; 147 s.tag = tag;
148 } 148 }
149 } 149 }
150 150
151 static bool codec_supported(const char* ext) {
152 // FIXME: Once other versions of SkCodec are available, we can add them to t his
153 // list (and eventually we can remove this check once they are all supported ).
154 return strcmp(ext, "png") == 0 || strcmp(ext, "PNG") == 0;
155 }
156
151 static void gather_srcs() { 157 static void gather_srcs() {
152 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex t()) { 158 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex t()) {
153 push_src("gm", new GMSrc(r->factory())); 159 push_src("gm", new GMSrc(r->factory()));
154 } 160 }
155 for (int i = 0; i < FLAGS_skps.count(); i++) { 161 for (int i = 0; i < FLAGS_skps.count(); i++) {
156 const char* path = FLAGS_skps[i]; 162 const char* path = FLAGS_skps[i];
157 if (sk_isdir(path)) { 163 if (sk_isdir(path)) {
158 SkOSFile::Iter it(path, "skp"); 164 SkOSFile::Iter it(path, "skp");
159 for (SkString file; it.next(&file); ) { 165 for (SkString file; it.next(&file); ) {
160 push_src("skp", new SKPSrc(SkOSPath::Join(path, file.c_str()))); 166 push_src("skp", new SKPSrc(SkOSPath::Join(path, file.c_str())));
161 } 167 }
162 } else { 168 } else {
163 push_src("skp", new SKPSrc(path)); 169 push_src("skp", new SKPSrc(path));
164 } 170 }
165 } 171 }
166 static const char* const exts[] = { 172 static const char* const exts[] = {
167 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico" , 173 "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico" ,
168 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO" , 174 "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO" ,
169 }; 175 };
170 for (int i = 0; i < FLAGS_images.count(); i++) { 176 for (int i = 0; i < FLAGS_images.count(); i++) {
171 const char* flag = FLAGS_images[i]; 177 const char* flag = FLAGS_images[i];
172 if (sk_isdir(flag)) { 178 if (sk_isdir(flag)) {
173 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { 179 for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) {
174 SkOSFile::Iter it(flag, exts[j]); 180 SkOSFile::Iter it(flag, exts[j]);
175 for (SkString file; it.next(&file); ) { 181 for (SkString file; it.next(&file); ) {
176 SkString path = SkOSPath::Join(flag, file.c_str()); 182 SkString path = SkOSPath::Join(flag, file.c_str());
177 push_src("image", new ImageSrc(path)); // Decode entire image. 183 push_src("image", new ImageSrc(path)); // Decode entire image.
178 push_src("subset", new ImageSrc(path, 2)); // Decode into 2 x 2 subsets 184 push_src("subset", new ImageSrc(path, 2)); // Decode into 2 x 2 subsets
185 if (codec_supported(exts[j])) {
186 push_src("codec", new CodecSrc(path)); // Decode wit h SkCodec.
187 }
179 } 188 }
180 } 189 }
181 } else if (sk_exists(flag)) { 190 } else if (sk_exists(flag)) {
182 // assume that FLAGS_images[i] is a valid image if it is a file. 191 // assume that FLAGS_images[i] is a valid image if it is a file.
183 push_src("image", new ImageSrc(flag)); // Decode entire image. 192 push_src("image", new ImageSrc(flag)); // Decode entire image.
184 push_src("subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subs ets 193 push_src("subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subs ets
194 push_src("codec", new CodecSrc(flag)); // Decode with SkCodec.
185 } 195 }
186 } 196 }
187 } 197 }
188 198
189 static GrGLStandard get_gpu_api() { 199 static GrGLStandard get_gpu_api() {
190 if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; } 200 if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; }
191 if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; } 201 if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; }
192 return kNone_GrGLStandard; 202 return kNone_GrGLStandard;
193 } 203 }
194 204
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 } 642 }
633 return 0; 643 return 0;
634 } 644 }
635 645
636 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 646 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
637 int main(int argc, char** argv) { 647 int main(int argc, char** argv) {
638 SkCommandLineFlags::Parse(argc, argv); 648 SkCommandLineFlags::Parse(argc, argv);
639 return dm_main(); 649 return dm_main();
640 } 650 }
641 #endif 651 #endif
OLDNEW
« no previous file with comments | « no previous file | dm/DMSrcSink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698