+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#import <UIKit/UIKit.h>
#include "SkApplication.h"
signal(SIGPIPE, SIG_IGN);
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
application_init();
+
// Identify the documents directory
NSArray *dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docsDir = [dirPaths objectAtIndex:0];
- const char *d = [docsDir UTF8String];
- IOS_launch_type launchType = set_cmd_line_args(argc, argv, d);
- int retVal = launchType == kApplication__iOSLaunchType
- ? UIApplicationMain(argc, argv, nil, nil) : (int) launchType;
+ NSString *resourceDir = [docsDir stringByAppendingString:@"/resources"];
+ const char *d = [resourceDir UTF8String];
+
+ // change to the dcouments directory. To allow the 'writePath' flag to use relative paths.
+ NSFileManager *filemgr = [NSFileManager defaultManager];
+ int retVal = 99;
+ if ([filemgr changeCurrentDirectoryPath: docsDir] == YES)
+ {
+ IOS_launch_type launchType = set_cmd_line_args(argc, argv, d);
+ retVal = launchType == kApplication__iOSLaunchType
+ ? UIApplicationMain(argc, argv, nil, nil) : (int) launchType;
+ }
application_term();
+ [filemgr release];
[pool release];
return retVal;
}
#include "SkGr.h"
#endif
-enum { kDefaultCacheSize = 128 * 1024 * 1024 };
+#ifdef SK_BUILD_FOR_IOS
+ enum { kDefaultCacheSize = 2 * 1024 * 1024 };
+#else
+ enum { kDefaultCacheSize = 128 * 1024 * 1024 };
+#endif
static int32_t next_image_filter_unique_id() {
static int32_t gImageFilterUniqueID;
test_peeking_stream(r, bufferedStream, bufferSize);
}
+// This test uses file system operations that don't work out of the
+// box on iOS. It's likely that we don't need them on iOS. Ignoring for now.
+// TODO(stephana): Re-evaluate if we need this in the future.
+#ifndef SK_BUILD_FOR_IOS
DEF_TEST(StreamPeek, reporter) {
// Test a memory stream.
const char gAbcs[] = "abcdefghijklmnopqrstuvwxyz";
test_peeking_front_buffered_stream(reporter, memStream, i);
}
}
+#endif
#include "ProcStats.h"
-#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_ANDROID)
+#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) || defined(SK_BUILD_FOR_ANDROID)
#include <sys/resource.h>
int sk_tools::getMaxResidentSetSizeMB() {
struct rusage ru;
int sk_tools::getMaxResidentSetSizeMB() { return -1; }
#endif
-#if defined(SK_BUILD_FOR_MAC)
+#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
#include <mach/mach.h>
int sk_tools::getCurrResidentSetSizeMB() {
mach_task_basic_info info;