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

Side by Side Diff: tools/VisualBench/VisualBenchmarkStream.cpp

Issue 1498043002: Create a skeleton VisualDebugModule (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak Created 5 years 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 | « tools/VisualBench/VisualBenchmarkStream.h ('k') | tools/VisualBench/VisualDebugModule.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 2015 Google Inc. 2 * Copyright 2015 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 8
9 #include <VisualBench/VisualBenchmarkStream.h> 9 #include <VisualBench/VisualBenchmarkStream.h>
10 #include <VisualBench/WrappedBenchmark.h> 10 #include <VisualBench/WrappedBenchmark.h>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (GrContext* context = canvas->getGrContext()) { 65 if (GrContext* context = canvas->getGrContext()) {
66 context->flush(); 66 context->flush();
67 } 67 }
68 #endif 68 #endif
69 } 69 }
70 } 70 }
71 SkPath fPath; 71 SkPath fPath;
72 SkRect fPerlinRect; 72 SkRect fPerlinRect;
73 }; 73 };
74 74
75 VisualBenchmarkStream::VisualBenchmarkStream(const SkSurfaceProps& surfaceProps) 75 VisualBenchmarkStream::VisualBenchmarkStream(const SkSurfaceProps& surfaceProps, bool justSKP)
76 : fSurfaceProps(surfaceProps) 76 : fSurfaceProps(surfaceProps)
77 , fBenches(BenchRegistry::Head()) 77 , fBenches(BenchRegistry::Head())
78 , fGMs(skiagm::GMRegistry::Head()) 78 , fGMs(skiagm::GMRegistry::Head())
79 , fSourceType(nullptr) 79 , fSourceType(nullptr)
80 , fBenchType(nullptr) 80 , fBenchType(nullptr)
81 , fCurrentSKP(0) 81 , fCurrentSKP(0)
82 , fIsWarmedUp(false) { 82 , fIsWarmedUp(false) {
83 for (int i = 0; i < FLAGS_skps.count(); i++) { 83 for (int i = 0; i < FLAGS_skps.count(); i++) {
84 if (SkStrEndsWith(FLAGS_skps[i], ".skp")) { 84 if (SkStrEndsWith(FLAGS_skps[i], ".skp")) {
85 fSKPs.push_back() = FLAGS_skps[i]; 85 fSKPs.push_back() = FLAGS_skps[i];
86 } else { 86 } else {
87 SkOSFile::Iter it(FLAGS_skps[i], ".skp"); 87 SkOSFile::Iter it(FLAGS_skps[i], ".skp");
88 SkString path; 88 SkString path;
89 while (it.next(&path)) { 89 while (it.next(&path)) {
90 fSKPs.push_back() = SkOSPath::Join(FLAGS_skps[0], path.c_str()); 90 fSKPs.push_back() = SkOSPath::Join(FLAGS_skps[0], path.c_str());
91 } 91 }
92 } 92 }
93 } 93 }
94 94
95 if (justSKP) {
96 fGMs = nullptr;
97 fBenches = nullptr;
98 }
99
95 // seed with an initial benchmark 100 // seed with an initial benchmark
96 // NOTE the initial benchmark will not have preTimingHooks called, but that is okay because 101 // NOTE the initial benchmark will not have preTimingHooks called, but that is okay because
97 // it is the warmupbench 102 // it is the warmupbench
98 this->next(); 103 this->next();
99 } 104 }
100 105
101 bool VisualBenchmarkStream::ReadPicture(const char* path, SkAutoTUnref<SkPicture >* pic) { 106 bool VisualBenchmarkStream::ReadPicture(const char* path, SkAutoTUnref<SkPicture >* pic) {
102 // Not strictly necessary, as it will be checked again later, 107 // Not strictly necessary, as it will be checked again later,
103 // but helps to avoid a lot of pointless work if we're going to skip it. 108 // but helps to avoid a lot of pointless work if we're going to skip it.
104 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, path)) { 109 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, path)) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 180 }
176 181
177 SkString name = SkOSPath::Basename(path.c_str()); 182 SkString name = SkOSPath::Basename(path.c_str());
178 fSourceType = "skp"; 183 fSourceType = "skp";
179 fBenchType = "playback"; 184 fBenchType = "playback";
180 return new VisualSKPBench(name.c_str(), pic.get()); 185 return new VisualSKPBench(name.c_str(), pic.get());
181 } 186 }
182 187
183 return nullptr; 188 return nullptr;
184 } 189 }
OLDNEW
« no previous file with comments | « tools/VisualBench/VisualBenchmarkStream.h ('k') | tools/VisualBench/VisualDebugModule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698