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

Unified Diff: dm/DM.cpp

Issue 270543004: DM: Add --skps. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: reed Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dm/DMCpuGMTask.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DM.cpp
diff --git a/dm/DM.cpp b/dm/DM.cpp
index becdc50bcd3649f458c9423aaa8af487a7aa036d..f4eefa685cda8296f28c9338d59885136a4928ce 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -5,6 +5,7 @@
#include "SkCommandLineFlags.h"
#include "SkForceLinking.h"
#include "SkGraphics.h"
+#include "SkPicture.h"
#include "SkString.h"
#include "Test.h"
#include "gm.h"
@@ -14,6 +15,7 @@
#include "DMGpuGMTask.h"
#include "DMGpuSupport.h"
#include "DMReporter.h"
+#include "DMSKPTask.h"
#include "DMTask.h"
#include "DMTaskRunner.h"
#include "DMTestTask.h"
@@ -43,6 +45,7 @@ DEFINE_string(match, "", "[~][^]substring[$] [...] of GM name to run.\n"
DEFINE_string(config, "565 8888 gpu nonrendering",
"Options: 565 8888 gpu nonrendering msaa4 msaa16 nvprmsaa4 nvprmsaa16 gpunull gpudebug angle mesa");
DEFINE_bool(leaks, false, "Print leaked instance-counted objects at exit?");
+DEFINE_string(skps, "", "Directory to read skps from.");
DEFINE_bool(gms, true, "Run GMs?");
DEFINE_bool(benches, true, "Run benches? Does not run GMs-as-benches.");
@@ -143,6 +146,35 @@ static void kick_off_tests(const SkTDArray<TestRegistry::Factory>& tests,
}
}
+static void kick_off_skps(DM::Reporter* reporter, DM::TaskRunner* tasks) {
+ if (FLAGS_skps.isEmpty()) {
+ return;
+ }
+
+ SkOSFile::Iter it(FLAGS_skps[0], ".skp");
+ SkString filename;
+ while (it.next(&filename)) {
+ if (SkCommandLineFlags::ShouldSkip(FLAGS_match, filename.c_str())) {
+ continue;
+ }
+
+ const SkString path = SkOSPath::SkPathJoin(FLAGS_skps[0], filename.c_str());
+
+ SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path.c_str()));
+ if (stream.get() == NULL) {
+ SkDebugf("Could not read %s.\n", path.c_str());
+ exit(1);
+ }
+ SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(stream.get()));
+ if (pic.get() == NULL) {
+ SkDebugf("Could not read %s as an SkPicture.\n", path.c_str());
+ exit(1);
+ }
+
+ tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic.detach(), filename)));
+ }
+}
+
static void report_failures(const DM::Reporter& reporter) {
SkTArray<SkString> failures;
reporter.getFailures(&failures);
@@ -215,6 +247,7 @@ int tool_main(int argc, char** argv) {
kick_off_gms(gms, configs, *expectations, &reporter, &tasks);
kick_off_benches(benches, configs, &reporter, &tasks);
kick_off_tests(tests, &reporter, &tasks);
+ kick_off_skps(&reporter, &tasks);
tasks.wait();
SkDebugf("\n");
« no previous file with comments | « no previous file | dm/DMCpuGMTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698