aboutsummaryrefslogtreecommitdiff
path: root/samplecode/SampleApp.cpp
diff options
context:
space:
mode:
authorcsmartdalton <csmartdalton@google.com>2017-03-27 12:32:29 -0600
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2017-03-27 19:19:19 +0000
commit8c67909e0443d0419edbb3743fed57df063850f6 (patch)
treecb184d9cbe07503590132f85787b227feb0febfb /samplecode/SampleApp.cpp
parentb338484d23d6fa4d6726361440962e75ec5855e0 (diff)
Add a simple tool for isolating a path from an SKP
BUG=skia: Change-Id: I5ca9bbd43919e3f65ea940847c68f85cc78dfeda Reviewed-on: https://skia-review.googlesource.com/10130 Commit-Queue: Chris Dalton <csmartdalton@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'samplecode/SampleApp.cpp')
-rw-r--r--samplecode/SampleApp.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 6b9a888651..bd7d567575 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -91,6 +91,17 @@ public:
}
};
+extern SampleView* CreateSamplePathFinderView(const char filename[]);
+
+class PathFinderFactory : public SkViewFactory {
+ SkString fFilename;
+public:
+ PathFinderFactory(const SkString& filename) : fFilename(filename) {}
+ SkView* operator() () const override {
+ return CreateSamplePathFinderView(fFilename.c_str());
+ }
+};
+
extern SampleView* CreateSampleSVGFileView(const SkString& filename);
class SVGFileFactory : public SkViewFactory {
@@ -726,6 +737,7 @@ static void restrict_samples(SkTDArray<const SkViewFactory*>& factories, const S
DEFINE_string(slide, "", "Start on this sample.");
DEFINE_string(pictureDir, "", "Read pictures from here.");
DEFINE_string(picture, "", "Path to single picture.");
+DEFINE_string(pathfinder, "", "SKP file with a single path to isolate.");
DEFINE_string(svg, "", "Path to single SVG file.");
DEFINE_string(svgDir, "", "Read SVGs from here.");
DEFINE_string(sequence, "", "Path to file containing the desired samples/gms to show.");
@@ -765,6 +777,11 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fCurrIndex = fSamples.count();
*fSamples.append() = new PictFileFactory(path);
}
+ if (!FLAGS_pathfinder.isEmpty()) {
+ SkString path(FLAGS_pathfinder[0]);
+ fCurrIndex = fSamples.count();
+ *fSamples.append() = new PathFinderFactory(path);
+ }
if (!FLAGS_svg.isEmpty()) {
SkString path(FLAGS_svg[0]);
fCurrIndex = fSamples.count();