aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils
diff options
context:
space:
mode:
authorGravatar yangsu@google.com <yangsu@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-24 17:20:50 +0000
committerGravatar yangsu@google.com <yangsu@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-24 17:20:50 +0000
commit1a2b4c1586596311fc56e002bbe2c5daa2aa2c4d (patch)
tree648eb8209c102f33473955786b76b9fa60f663d5 /include/utils
parent1c18ca3ca2bf562e8d4c7a3816eee33ec240b55c (diff)
Added utility functions and iOS ports of SkWindow, SkOSFile, SkFontHost, and SkImageDecoder
the iOSSampleApp in experimental currently includes all the following files but only uses SkOSWindow_iOS and SkOSFile_iOS http://codereview.appspot.com/4657047/ git-svn-id: http://skia.googlecode.com/svn/trunk@1706 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/utils')
-rwxr-xr-xinclude/utils/ios/SkStream_NSData.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/utils/ios/SkStream_NSData.h b/include/utils/ios/SkStream_NSData.h
new file mode 100755
index 0000000000..af0004f991
--- /dev/null
+++ b/include/utils/ios/SkStream_NSData.h
@@ -0,0 +1,34 @@
+#ifndef SkStream_NSData_DEFINED
+#define SkStream_NSData_DEFINED
+
+#import <UIKit/UIKit.h>
+#include "SkStream.h"
+
+/** Returns an NSData with a copy of the stream's data. The caller must call
+ retain if it intends to keep the data object beyond the current stack-frame
+ (i.e. internally we're calling [NSData dataWithBytes...]
+ */
+NSData* NSData_dataWithStream(SkStream* stream);
+
+/** Returns an NSData from the named resource (from main bundle).
+ The caller must call retain if it intends to keep the data object beyond
+ the current stack-frame
+ (i.e. internally we're calling [NSData dataWithContentsOfMappedFile...]
+ */
+NSData* NSData_dataFromResource(const char name[], const char suffix[]);
+
+/** Wrap a stream around NSData.
+ */
+class SkStream_NSData : public SkMemoryStream {
+public:
+ SkStream_NSData(NSData* data);
+ virtual ~SkStream_NSData();
+
+ static SkStream_NSData* CreateFromResource(const char name[],
+ const char suffix[]);
+
+private:
+ NSData* fNSData;
+};
+
+#endif