diff options
Diffstat (limited to 'samplecode/SampleApp.cpp')
-rw-r--r-- | samplecode/SampleApp.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index c93bae8e57..b2af16a8f6 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -591,13 +591,22 @@ static inline SampleWindow::DeviceType cycle_devicetype(SampleWindow::DeviceType } static void usage(const char * argv0) { - SkDebugf("%s [sampleName] [-i resourcePath]\n", argv0); + SkDebugf("%s [--slide sampleName] [-i resourcePath]\n", argv0); SkDebugf(" sampleName: sample at which to start.\n"); SkDebugf(" resourcePath: directory that stores image resources.\n"); } SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* devManager) : INHERITED(hwnd) { + SkGMRegistyToSampleRegistry(); + { + const SkViewRegister* reg = SkViewRegister::Head(); + while (reg) { + *fSamples.append() = reg->factory(); + reg = reg->next(); + } + } + const char* resourcePath = NULL; fCurrIndex = -1; @@ -609,11 +618,16 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev if (argv < stop && **argv) { resourcePath = *argv; } - } else { - fCurrIndex = findByTitle(*argv); - if (fCurrIndex < 0) { - fprintf(stderr, "Unknown sample \"%s\"\n", *argv); + } else if (strcmp(*argv, "--slide") == 0) { + argv++; + if (argv < stop && **argv) { + fCurrIndex = findByTitle(*argv); + if (fCurrIndex < 0) { + fprintf(stderr, "Unknown sample \"%s\"\n", *argv); + } } + } else { + usage(commandName); } } @@ -733,15 +747,6 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev skiagm::GM::SetResourcePath(resourcePath); - SkGMRegistyToSampleRegistry(); - { - const SkViewRegister* reg = SkViewRegister::Head(); - while (reg) { - *fSamples.append() = reg->factory(); - reg = reg->next(); - } - } - this->loadView((*fSamples[fCurrIndex])()); fPDFData = NULL; |