aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--experimental/iOSSampleApp/Shared/skia_ios.mm24
-rw-r--r--src/core/SkImageFilter.cpp6
-rw-r--r--tests/StreamTest.cpp5
-rw-r--r--tools/ProcStats.cpp4
4 files changed, 32 insertions, 7 deletions
diff --git a/experimental/iOSSampleApp/Shared/skia_ios.mm b/experimental/iOSSampleApp/Shared/skia_ios.mm
index 45675fa61a..b8680c40e9 100644
--- a/experimental/iOSSampleApp/Shared/skia_ios.mm
+++ b/experimental/iOSSampleApp/Shared/skia_ios.mm
@@ -1,3 +1,9 @@
+/*
+ * 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"
@@ -5,14 +11,24 @@ int main(int argc, char *argv[]) {
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;
}
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index d51d9c8cd9..d4eaf65c5f 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -24,7 +24,11 @@
#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;
diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp
index 7a89c99c0c..776c201014 100644
--- a/tests/StreamTest.cpp
+++ b/tests/StreamTest.cpp
@@ -246,6 +246,10 @@ static void test_peeking_front_buffered_stream(skiatest::Reporter* r,
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";
@@ -265,3 +269,4 @@ DEF_TEST(StreamPeek, reporter) {
test_peeking_front_buffered_stream(reporter, memStream, i);
}
}
+#endif
diff --git a/tools/ProcStats.cpp b/tools/ProcStats.cpp
index 5c41213d4d..fc9da23011 100644
--- a/tools/ProcStats.cpp
+++ b/tools/ProcStats.cpp
@@ -7,7 +7,7 @@
#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;
@@ -30,7 +30,7 @@
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;