Added "--list" command line option to SampleApp
http://codereview.appspot.com/6161043/
committed on behalf of Guanqun
git-svn-id: http://skia.googlecode.com/svn/trunk@3835 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 213a39f..05f9c82 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -691,6 +691,7 @@
fCurrIndex = findByTitle(*argv);
if (fCurrIndex < 0) {
fprintf(stderr, "Unknown sample \"%s\"\n", *argv);
+ listTitles();
}
}
} else if (strcmp(*argv, "--msaa") == 0) {
@@ -698,6 +699,8 @@
if (argv < stop && **argv) {
fMSAASampleCount = atoi(*argv);
}
+ } else if (strcmp(*argv, "--list") == 0) {
+ listTitles();
}
else {
usage(commandName);
@@ -873,6 +876,14 @@
return -1;
}
+void SampleWindow::listTitles() {
+ int count = fSamples.count();
+ SkDebugf("All Slides:\n");
+ for (int i = 0; i < count; i++) {
+ SkDebugf(" %s\n", getSampleTitle(i).c_str());
+ }
+}
+
static SkBitmap capture_bitmap(SkCanvas* canvas) {
SkBitmap bm;
const SkBitmap& src = canvas->getDevice()->accessBitmap(false);