aboutsummaryrefslogtreecommitdiff
path: root/samplecode/SampleApp.cpp
diff options
context:
space:
mode:
authorrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-20 14:51:47 +0000
committerrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-20 14:51:47 +0000
commitd5c9e996dff7169cd6bfbf5c6d1543fca512c1a5 (patch)
treec33f0ce090db0c651fe50f30c2979deebd68ea99 /samplecode/SampleApp.cpp
parent166e653f67f3fffc3846184a25ce45ab083f07a2 (diff)
Fix for CMYK jpeg decoding issue (69 - unable to read some jpeg files on android)
http://codereview.appspot.com/5785054/ git-svn-id: http://skia.googlecode.com/svn/trunk@3438 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SampleApp.cpp')
-rw-r--r--samplecode/SampleApp.cpp54
1 files changed, 39 insertions, 15 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index d40a670e3a..c93bae8e57 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -590,7 +590,44 @@ 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
@@ -694,6 +731,8 @@ 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();
@@ -702,22 +741,7 @@ 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;