aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-03 18:22:28 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-03 18:22:28 +0000
commit7265e725555098637498db2f397623d7991ceb4b (patch)
treecb75b0544035ca485a6a69e62a4ab50210d12356
parent67a6db36110b3904f09488a08a08e58b3ca10fd8 (diff)
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
-rw-r--r--samplecode/SampleApp.cpp11
-rw-r--r--samplecode/SampleApp.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 213a39f0c4..05f9c82031 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -691,6 +691,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
fCurrIndex = findByTitle(*argv);
if (fCurrIndex < 0) {
fprintf(stderr, "Unknown sample \"%s\"\n", *argv);
+ listTitles();
}
}
} else if (strcmp(*argv, "--msaa") == 0) {
@@ -698,6 +699,8 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
if (argv < stop && **argv) {
fMSAASampleCount = atoi(*argv);
}
+ } else if (strcmp(*argv, "--list") == 0) {
+ listTitles();
}
else {
usage(commandName);
@@ -873,6 +876,14 @@ int SampleWindow::findByTitle(const char title[]) {
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);
diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h
index eb49236ba1..e587e1ff62 100644
--- a/samplecode/SampleApp.h
+++ b/samplecode/SampleApp.h
@@ -198,6 +198,7 @@ private:
void postAnimatingEvent();
void installDrawFilter(SkCanvas*);
int findByTitle(const char*);
+ void listTitles();
typedef SkOSWindow INHERITED;
};