aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-20 15:13:04 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-20 15:13:04 +0000
commit0a89c90d18ab5082f2fde5076ce422aac493bb00 (patch)
treed452e5b901b8519c27d5b17e4ca2c44f7db570e7 /samplecode
parentd5c9e996dff7169cd6bfbf5c6d1543fca512c1a5 (diff)
reverting to 3437
git-svn-id: http://skia.googlecode.com/svn/trunk@3439 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleApp.cpp54
1 files changed, 15 insertions, 39 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index c93bae8e57..d40a670e3a 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -590,44 +590,7 @@ static inline SampleWindow::DeviceType cycle_devicetype(SampleWindow::DeviceType
return gCT[ct];
}
-static void usage(const char * argv0) {
- SkDebugf("%s [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) {
-
- const char* resourcePath = NULL;
- fCurrIndex = -1;
-
- const char* const commandName = argv[0];
- char* const* stop = argv + argc;
- for (++argv; argv < stop; ++argv) {
- if (strcmp(*argv, "-i") == 0) {
- argv++;
- if (argv < stop && **argv) {
- resourcePath = *argv;
- }
- } else {
- fCurrIndex = findByTitle(*argv);
- if (fCurrIndex < 0) {
- fprintf(stderr, "Unknown sample \"%s\"\n", *argv);
- }
- }
- }
-
- if (fCurrIndex < 0) {
- SkString title;
- if (readTitleFromPrefs(&title)) {
- fCurrIndex = findByTitle(title.c_str());
- }
- }
-
- if (fCurrIndex < 0) {
- fCurrIndex = 0;
- }
-
gSampleWindow = this;
#ifdef PIPE_FILE
@@ -731,8 +694,6 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
this->setVisibleP(true);
this->setClipToBounds(false);
- skiagm::GM::SetResourcePath(resourcePath);
-
SkGMRegistyToSampleRegistry();
{
const SkViewRegister* reg = SkViewRegister::Head();
@@ -741,7 +702,22 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
reg = reg->next();
}
}
+ fCurrIndex = 0;
+ if (argc > 1) {
+ fCurrIndex = findByTitle(argv[1]);
+ if (fCurrIndex < 0) {
+ fprintf(stderr, "Unknown sample \"%s\"\n", argv[1]);
+ }
+ } else {
+ SkString title;
+ if (readTitleFromPrefs(&title)) {
+ fCurrIndex = findByTitle(title.c_str());
+ }
+ }
+ if (fCurrIndex < 0) {
+ fCurrIndex = 0;
+ }
this->loadView((*fSamples[fCurrIndex])());
fPDFData = NULL;