aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-10-18 10:57:02 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-18 17:25:56 +0000
commit1d014105ac8e5968b6d260745c807ab45dfee956 (patch)
treeeb7c785afabb6757a5c7e5901a96b2cb0ff7f556 /samplecode
parentc9080c8846d4cfe01fc2b1caad8c9500c32ea5d2 (diff)
Add a SampleApp flag to automate keystrokes on startup
This is a quick-and-dirty solution to select color mode, backend, etc. from the command line. e.g. 'out/Debug/SampleApp --keys CCd' for opengl and srgb Bug: skia: Change-Id: I61f9e0fd4209a5fadb585c02c71984398f2f0860 Reviewed-on: https://skia-review.googlesource.com/61482 Reviewed-by: Yuqian Li <liyuqian@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleApp.cpp10
-rw-r--r--samplecode/SamplePathFinder.cpp10
2 files changed, 10 insertions, 10 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 6a5d1fedb6..7f6a58812f 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -764,6 +764,7 @@ DEFINE_int32(measureMS, 0, "Number of miliseconds to measure the FPS before clos
"If it's 0, we won't measure the FPS or close SampleApp automatically.");
DEFINE_int32(width, 1024, "Width of the window");
DEFINE_int32(height, 768, "Height of the window");
+DEFINE_string(keys, "", "List of chars to automate keystrokes for on startup.");
#include "SkTaskGroup.h"
@@ -2534,7 +2535,14 @@ SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
if (false) { // avoid bit rot, suppress warning
test();
}
- return new SampleWindow(hwnd, argc, argv, nullptr);
+ SkOSWindow* window = new SampleWindow(hwnd, argc, argv, nullptr);
+ for (int i = 0; i < FLAGS_keys.count(); ++i) {
+ const char* keys = FLAGS_keys[i];
+ while (char keystroke = *keys++) {
+ window->handleChar(keystroke);
+ }
+ }
+ return window;
}
#ifdef SK_BUILD_FOR_IOS
diff --git a/samplecode/SamplePathFinder.cpp b/samplecode/SamplePathFinder.cpp
index 18d200bad1..7c7dca1576 100644
--- a/samplecode/SamplePathFinder.cpp
+++ b/samplecode/SamplePathFinder.cpp
@@ -16,8 +16,6 @@
#include "SkStream.h"
#include <stack>
-DEFINE_string(pathfinderTrail, "", "List of keystrokes to execute upon loading a pathfinder.");
-
/**
* This is a simple utility designed to extract the paths from an SKP file and then isolate a single
* one of them. Use the 'x' and 'X' keys to guide a binary search:
@@ -58,12 +56,6 @@ public:
}
pic->playback(this);
}
- for (int i = 0; i < FLAGS_pathfinderTrail.count(); ++i) {
- const char* key = FLAGS_pathfinderTrail[i];
- while (*key) {
- this->handleKeystroke(*key++);
- }
- }
}
~PathFinderView() override {}
@@ -132,7 +124,7 @@ private:
case 'D':
SkDebugf("SampleApp --pathfinder %s", fFilename.c_str());
if (!fTrail.empty()) {
- SkDebugf(" --pathfinderTrail ", fFilename.c_str());
+ SkDebugf(" --keys ");
for (char ch : fTrail) {
SkDebugf("%c", ch);
}