Index: experimental/iOSSampleApp/SkSampleUIView.mm |
diff --git a/experimental/iOSSampleApp/SkSampleUIView.mm b/experimental/iOSSampleApp/SkSampleUIView.mm |
index f442f5a0741fd2405cfa5a8f4b12b64eced7e1e9..3d82627f3b786b3fc3e4239dc5cbd3ddbc28da7a 100644 |
--- a/experimental/iOSSampleApp/SkSampleUIView.mm |
+++ b/experimental/iOSSampleApp/SkSampleUIView.mm |
@@ -316,12 +316,27 @@ static FPSState gFPS; |
fRasterLayer.actions = newActions; |
[newActions release]; |
+ // rebuild argc and argv from process info |
+ NSArray* arguments = [[NSProcessInfo processInfo] arguments]; |
+ int argc = [arguments count]; |
+ char** argv = new char*[argc]; |
+ for (int i = 0; i < argc; ++i) { |
+ NSString* arg = [arguments objectAtIndex:i]; |
+ int strlen = [arg lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; |
+ argv[i] = new char[strlen+1]; |
+ [arg getCString:argv[i] maxLength:strlen+1 encoding:NSUTF8StringEncoding]; |
+ } |
+ |
fDevManager = new SkiOSDeviceManager(fGL.fFramebuffer); |
- static char* kDummyArgv = const_cast<char*>("dummyExecutableName"); |
- fWind = new SampleWindow(self, 1, &kDummyArgv, fDevManager); |
+ fWind = new SampleWindow(self, argc, argv, fDevManager); |
fWind->resize(self.frame.size.width, self.frame.size.height, |
kN32_SkColorType); |
+ |
+ for (int i = 0; i < argc; ++i) { |
+ delete [] argv[i]; |
+ } |
+ delete [] argv; |
} |
return self; |
} |