Added SimpleiOSApp and updated iOSSampleApp

git-svn-id: http://skia.googlecode.com/svn/trunk@2202 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
yangsu@google.com 2011-08-30 19:14:13 +00:00
parent 22269ed461
commit 688823f5d3
20 changed files with 4665 additions and 468 deletions

View File

@ -0,0 +1,6 @@
#import <UIKit/UIKit.h>
#import "SkUIView.h"
@interface SimpleApp : SkUIView
- (id)initWithDefaults;
@end

View File

@ -0,0 +1,57 @@
#import "SkCanvas.h"
#import "SkPaint.h"
#import "SkWindow.h"
#include "SkGraphics.h"
#include "SkCGUtils.h"
class SkSampleView : public SkView {
public:
SkSampleView() {
this->setVisibleP(true);
this->setClipToBounds(false);
};
protected:
virtual void onDraw(SkCanvas* canvas) {
canvas->drawColor(0xFFFFFFFF);
SkPaint p;
p.setTextSize(20);
p.setAntiAlias(true);
canvas->drawText("Hello World!", 13, 50, 30, p);
SkRect r = {50, 50, 80, 80};
p.setColor(0xAA11EEAA);
canvas->drawRect(r, p);
}
private:
typedef SkView INHERITED;
};
void application_init() {
SkGraphics::Init();
SkEvent::Init();
}
void application_term() {
SkGraphics::Term();
SkEvent::Term();
}
class FillLayout : public SkView::Layout {
protected:
virtual void onLayoutChildren(SkView* parent) {
SkView* view = SkView::F2BIter(parent).next();
view->setSize(parent->width(), parent->height());
}
};
#import "SimpleApp.h"
@implementation SimpleApp
- (id)initWithDefaults {
if (self = [super initWithDefaults]) {
fWind = new SkOSWindow(self);
fWind->setLayout(new FillLayout, false);
fWind->attachChildToFront(new SkSampleView)->unref();
}
return self;
}
@end

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
<string>MainWindow_iPhone</string>
<key>NSMainNibFile~ipad</key>
<string>MainWindow_iPad</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
//
// Prefix header for all source files of the 'iosshell' target in the 'iosshell' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif

View File

@ -0,0 +1,18 @@
//
// AppDelegate_iPad.h
// iosshell
//
// Created by Yang Su on 6/30/11.
// Copyright 2011 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate_iPad : NSObject <UIApplicationDelegate> {
UIWindow *window;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end

View File

@ -0,0 +1,67 @@
//
// AppDelegate_iPad.m
// iosshell
//
// Created by Yang Su on 6/30/11.
// Copyright 2011 Google Inc. All rights reserved.
//
#import "AppDelegate_iPad.h"
@implementation AppDelegate_iPad
@synthesize window;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive.
*/
}
- (void)applicationWillTerminate:(UIApplication *)application {
/*
Called when the application is about to terminate.
*/
}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
/*
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
*/
}
- (void)dealloc {
[window release];
[super dealloc];
}
@end

View File

@ -0,0 +1,439 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1056</int>
<string key="IBDocument.SystemVersion">10K540</string>
<string key="IBDocument.InterfaceBuilderVersion">851</string>
<string key="IBDocument.AppKitVersion">1038.36</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">141</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBProxyObject" id="606714003">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
<object class="IBUIWindow" id="62075450">
<nil key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIView" id="470150200">
<reference key="NSNextResponder" ref="62075450"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 10}, {768, 1004}}</string>
<reference key="NSSuperview" ref="62075450"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
</object>
<string key="NSFrameSize">{768, 1024}</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
</object>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
<int key="IBUIStatusBarStyle">2</int>
</object>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<bool key="IBUIResizesToFullScreen">YES</bool>
</object>
<object class="IBUICustomObject" id="250404236">
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="250404236"/>
<reference key="destination" ref="62075450"/>
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="250404236"/>
</object>
<int key="connectionID">8</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="606714003"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="62075450"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="470150200"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="250404236"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="470150200"/>
<reference key="parent" ref="62075450"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>10.CustomClassName</string>
<string>10.IBPluginDependency</string>
<string>10.IBViewBoundsToFrameTransform</string>
<string>2.IBEditorWindowLastContentRect</string>
<string>2.IBPluginDependency</string>
<string>6.CustomClassName</string>
<string>6.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIApplication</string>
<string>UIResponder</string>
<string>SimpleApp</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAxHqAAA</bytes>
</object>
<string>{{903, 55}, {768, 1024}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>AppDelegate_iPad</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">12</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">AppDelegate_iPad</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">window</string>
<string key="NS.object.0">UIWindow</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">window</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">window</string>
<string key="candidateClassName">UIWindow</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">iPad/AppDelegate_iPad.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SimpleApp</string>
<string key="superclassName">SkUIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">SimpleApp.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SkUIView</string>
<string key="superclassName">UIView</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">fOptionsDelegate</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">fOptionsDelegate</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">fOptionsDelegate</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">../iOSSampleApp/Shared/SkUIView.h</string>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="786211723">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIApplication</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIApplication.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIResponder</string>
<string key="superclassName">NSObject</string>
<reference key="sourceIdentifier" ref="786211723"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISearchBar</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISearchDisplayController</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIPrintFormatter.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIWindow</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIWindow.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="1056" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3100" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../SimpleiOSApp.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">141</string>
</data>
</archive>

View File

@ -0,0 +1,18 @@
//
// AppDelegate_iPhone.h
// iosshell
//
// Created by Yang Su on 6/30/11.
// Copyright 2011 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate_iPhone : NSObject <UIApplicationDelegate> {
UIWindow *window;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end

View File

@ -0,0 +1,83 @@
//
// AppDelegate_iPhone.m
// iosshell
//
// Created by Yang Su on 6/30/11.
// Copyright 2011 Google Inc. All rights reserved.
//
#import "AppDelegate_iPhone.h"
@implementation AppDelegate_iPhone
@synthesize window;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}
- (void)applicationWillTerminate:(UIApplication *)application {
/*
Called when the application is about to terminate.
See also applicationDidEnterBackground:.
*/
}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
/*
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
*/
}
- (void)dealloc {
[window release];
[super dealloc];
}
@end

View File

@ -0,0 +1,449 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1056</int>
<string key="IBDocument.SystemVersion">10K540</string>
<string key="IBDocument.InterfaceBuilderVersion">851</string>
<string key="IBDocument.AppKitVersion">1038.36</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">141</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="450319686">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUICustomObject" id="987256611">
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIWindow" id="380026005">
<nil key="NSNextResponder"/>
<int key="NSvFlags">1316</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBUIView" id="268100401">
<reference key="NSNextResponder" ref="380026005"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{0, 10}, {320, 460}}</string>
<reference key="NSSuperview" ref="380026005"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="NSPSMatrix" key="NSFrameMatrix"/>
<string key="NSFrameSize">{320, 480}</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
</object>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIResizesToFullScreen">YES</bool>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="987256611"/>
</object>
<int key="connectionID">5</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="380026005"/>
</object>
<int key="connectionID">6</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="380026005"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="268100401"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="987256611"/>
<reference key="parent" ref="0"/>
<string key="objectName">App Delegate</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="450319686"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="268100401"/>
<reference key="parent" ref="380026005"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.CustomClassName</string>
<string>-2.CustomClassName</string>
<string>12.CustomClassName</string>
<string>12.IBPluginDependency</string>
<string>12.IBViewBoundsToFrameTransform</string>
<string>2.IBAttributePlaceholdersKey</string>
<string>2.IBEditorWindowLastContentRect</string>
<string>2.IBPluginDependency</string>
<string>2.UIWindow.visibleAtLaunch</string>
<string>4.CustomClassName</string>
<string>4.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UIApplication</string>
<string>UIResponder</string>
<string>SimpleApp</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABC6AAAxCbAAA</bytes>
</object>
<object class="NSMutableDictionary">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<string>{{520, 376}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<integer value="1"/>
<string>AppDelegate_iPhone</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">12</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">AppDelegate_iPhone</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">window</string>
<string key="NS.object.0">UIWindow</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">window</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">window</string>
<string key="candidateClassName">UIWindow</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">iPhone/AppDelegate_iPhone.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SimpleApp</string>
<string key="superclassName">SkUIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">SimpleApp.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SkUIView</string>
<string key="superclassName">UIView</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">fOptionsDelegate</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">fOptionsDelegate</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">fOptionsDelegate</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">../iOSSampleApp/Shared/SkUIView.h</string>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="565734826">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIApplication</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIApplication.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIResponder</string>
<string key="superclassName">NSObject</string>
<reference key="sourceIdentifier" ref="565734826"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISearchBar</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UISearchDisplayController</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIPrintFormatter.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIView</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIViewController</string>
<string key="superclassName">UIResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIWindow</string>
<string key="superclassName">UIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">UIKit.framework/Headers/UIWindow.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="1056" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
<integer value="3100" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../SimpleiOSApp.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">141</string>
</data>
</archive>

View File

@ -1,4 +1,3 @@
/*
* Copyright 2011 Google Inc.
*
@ -12,14 +11,9 @@
#import <OpenGLES/ES2/glext.h>
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
#include "SkMatrix.h"
#include "FlingState.h"
#include "SampleApp.h"
class SkiOSDeviceManager;
#include "SkWindow.h"
class SkOSWindow;
class SkEvent;
struct FPSState;
@class SkUIView;
@protocol SkUIViewOptionsDelegate <NSObject>
@ -30,37 +24,19 @@ struct FPSState;
@end
@interface SkUIView : UIView {
BOOL fRedrawRequestPending;
struct {
EAGLContext* fContext;
GLuint fRenderbuffer;
GLuint fStencilbuffer;
GLuint fFramebuffer;
GLint fWidth;
GLint fHeight;
} fGL;
NSString* fTitle;
UINavigationItem* fTitleItem;
CALayer* fRasterLayer;
CAEAGLLayer* fGLLayer;
FPSState* fFPSState;
SkOSWindow* fWind;
SkiOSDeviceManager* fDevManager;
id<SkUIViewOptionsDelegate> fOptionsDelegate;
}
@property (nonatomic, readonly) SkOSWindow *fWind;
@property (nonatomic, retain) UINavigationItem* fTitleItem;
@property (nonatomic, copy) NSString* fTitle;
@property (nonatomic, retain) CALayer* fRasterLayer;
@property (nonatomic, retain) CAEAGLLayer* fGLLayer;
@property (nonatomic, assign) id<SkUIViewOptionsDelegate> fOptionsDelegate;
- (id)initWithDefaults;
- (void)setUpWindow;
- (void)forceRedraw;
- (void)drawInRaster;
- (void)setSkTitle:(const char*)title;
- (void)onAddMenu:(const SkOSMenu*)menu;

View File

@ -1,406 +1,57 @@
#import "SkUIView.h"
//#define SKWIND_CONFIG SkBitmap::kRGB_565_Config
#define SKWIND_CONFIG SkBitmap::kARGB_8888_Config
#define SKGL_CONFIG kEAGLColorFormatRGB565
//#define SKGL_CONFIG kEAGLColorFormatRGBA8
#define FORCE_REDRAW
//#define USE_GL_1
#define USE_GL_2
#include "SkCanvas.h"
#include "GrContext.h"
#include "GrGLInterface.h"
#include "SkGpuDevice.h"
#include "SkCGUtils.h"
class SkiOSDeviceManager : public SampleWindow::DeviceManager {
public:
SkiOSDeviceManager() {
fGrContext = NULL;
fGrRenderTarget = NULL;
usingGL = false;
}
virtual ~SkiOSDeviceManager() {
SkSafeUnref(fGrContext);
SkSafeUnref(fGrRenderTarget);
}
virtual void init(SampleWindow* win) {
win->attachGL();
if (NULL == fGrContext) {
#ifdef USE_GL_1
fGrContext = GrContext::Create(kOpenGL_Fixed_GrEngine, NULL);
#else
fGrContext = GrContext::Create(kOpenGL_Shaders_GrEngine, NULL);
#endif
}
if (NULL == fGrContext) {
SkDebugf("Failed to setup 3D");
win->detachGL();
}
}
virtual bool supportsDeviceType(SampleWindow::DeviceType dType) {
switch (dType) {
case SampleWindow::kRaster_DeviceType:
case SampleWindow::kPicture_DeviceType: // fallthru
return true;
case SampleWindow::kGPU_DeviceType:
return NULL != fGrContext;
default:
return false;
}
}
virtual bool prepareCanvas(SampleWindow::DeviceType dType,
SkCanvas* canvas,
SampleWindow* win) {
if (SampleWindow::kGPU_DeviceType == dType) {
canvas->setDevice(new SkGpuDevice(fGrContext, fGrRenderTarget))->unref();
usingGL = true;
}
else {
//The clip needs to be applied with a device attached to the canvas
canvas->setBitmapDevice(win->getBitmap());
usingGL = false;
}
return true;
}
virtual void publishCanvas(SampleWindow::DeviceType dType,
SkCanvas* canvas,
SampleWindow* win) {
if (SampleWindow::kGPU_DeviceType == dType) {
fGrContext->flush();
}
else {
//CGContextRef cg = UIGraphicsGetCurrentContext();
//SkCGDrawBitmap(cg, win->getBitmap(), 0, 0);
}
win->presentGL();
}
virtual void windowSizeChanged(SampleWindow* win) {
if (fGrContext) {
win->attachGL();
GrPlatformSurfaceDesc desc;
desc.reset();
desc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType;
desc.fWidth = SkScalarRound(win->width());
desc.fHeight = SkScalarRound(win->height());
desc.fConfig = kRGBA_8888_GrPixelConfig;
const GrGLInterface* gl = GrGLGetDefaultGLInterface();
GrAssert(NULL != gl);
GR_GL_GetIntegerv(gl, GR_GL_STENCIL_BITS, &desc.fStencilBits);
GR_GL_GetIntegerv(gl, GR_GL_SAMPLES, &desc.fSampleCnt);
GrGLint buffer;
GR_GL_GetIntegerv(gl, GR_GL_FRAMEBUFFER_BINDING, &buffer);
desc.fPlatformRenderTarget = buffer;
SkSafeUnref(fGrRenderTarget);
fGrRenderTarget = static_cast<GrRenderTarget*>(
fGrContext->createPlatformSurface(desc));
}
}
bool isUsingGL() { return usingGL; }
virtual GrContext* getGrContext() { return fGrContext; }
private:
bool usingGL;
GrContext* fGrContext;
GrRenderTarget* fGrRenderTarget;
};
////////////////////////////////////////////////////////////////////////////////
@implementation SkUIView
@synthesize fWind, fTitle, fTitleItem, fRasterLayer, fGLLayer, fOptionsDelegate;
#include "SkApplication.h"
#include "SkEvent.h"
#include "SkWindow.h"
#define kREDRAW_UIVIEW_GL "sk_redraw_uiview_gl_iOS"
extern bool gDoTraceDraw;
#define DO_TRACE_DRAW_MAX 100
struct FPSState {
static const int FRAME_COUNT = 60;
CFTimeInterval fNow0, fNow1;
CFTimeInterval fTime0, fTime1, fTotalTime;
int fFrameCounter;
int fDrawCounter;
SkString str;
FPSState() {
fTime0 = fTime1 = fTotalTime = 0;
fFrameCounter = 0;
}
void startDraw() {
fNow0 = CACurrentMediaTime();
if (0 == fDrawCounter && false) {
gDoTraceDraw = true;
SkDebugf("\n");
}
}
void endDraw() {
fNow1 = CACurrentMediaTime();
if (0 == fDrawCounter) {
gDoTraceDraw = true;
}
if (DO_TRACE_DRAW_MAX == ++fDrawCounter) {
fDrawCounter = 0;
}
}
void flush(SkOSWindow* hwnd) {
CFTimeInterval now2 = CACurrentMediaTime();
fTime0 += fNow1 - fNow0;
fTime1 += now2 - fNow1;
if (++fFrameCounter == FRAME_COUNT) {
CFTimeInterval totalNow = CACurrentMediaTime();
fTotalTime = totalNow - fTotalTime;
//SkMSec ms0 = (int)(1000 * fTime0 / FRAME_COUNT);
//SkMSec msTotal = (int)(1000 * fTotalTime / FRAME_COUNT);
//str.printf(" ms: %d [%d], fps: %3.1f", msTotal, ms0,
// FRAME_COUNT / fTotalTime);
str.printf(" fps:%3.1f", FRAME_COUNT / fTotalTime);
hwnd->setTitle(NULL);
fTotalTime = totalNow;
fTime0 = fTime1 = 0;
fFrameCounter = 0;
}
}
};
static FPSState gFPS;
#define FPS_StartDraw() gFPS.startDraw()
#define FPS_EndDraw() gFPS.endDraw()
#define FPS_Flush(wind) gFPS.flush(wind)
///////////////////////////////////////////////////////////////////////////////
- (id)initWithMyDefaults {
fRedrawRequestPending = false;
fFPSState = new FPSState;
//Add gesture recognizer for single taps. Taps on the right half of the view
//will cause SampleApp to go to the next sample, taps on the left will go to
//the previous sample
UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleTap:)];
[self addGestureRecognizer:tap];
[tap release];
#ifdef USE_GL_1
fGL.fContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
#else
fGL.fContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
#endif
if (!fGL.fContext || ![EAGLContext setCurrentContext:fGL.fContext])
{
[self release];
return nil;
}
// Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer
glGenFramebuffers(1, &fGL.fFramebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, fGL.fFramebuffer);
glGenRenderbuffers(1, &fGL.fRenderbuffer);
glGenRenderbuffers(1, &fGL.fStencilbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, fGL.fRenderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fStencilbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fGL.fStencilbuffer);
self.fGLLayer = [CAEAGLLayer layer];
fGLLayer.bounds = self.bounds;
fGLLayer.anchorPoint = CGPointMake(0, 0);
fGLLayer.opaque = TRUE;
[self.layer addSublayer:fGLLayer];
fGLLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO],
kEAGLDrawablePropertyRetainedBacking,
SKGL_CONFIG,
kEAGLDrawablePropertyColorFormat,
nil];
self.fRasterLayer = [CALayer layer];
fRasterLayer.anchorPoint = CGPointMake(0, 0);
fRasterLayer.opaque = TRUE;
[self.layer addSublayer:fRasterLayer];
NSMutableDictionary *newActions = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNull null], @"onOrderIn",
[NSNull null], @"onOrderOut",
[NSNull null], @"sublayers",
[NSNull null], @"contents",
[NSNull null], @"bounds",
nil];
fGLLayer.actions = newActions;
fRasterLayer.actions = newActions;
[newActions release];
fDevManager = new SkiOSDeviceManager;
fWind = new SampleWindow(self, NULL, NULL, fDevManager);
application_init();
fWind->resize(self.frame.size.width, self.frame.size.height, SKWIND_CONFIG);
@synthesize fWind, fTitleItem, fOptionsDelegate;
- (id)initWithDefaults {
fWind = NULL;
return self;
}
- (id)initWithCoder:(NSCoder*)coder {
if ((self = [super initWithCoder:coder])) {
self = [self initWithMyDefaults];
self = [self initWithDefaults];
[self setUpWindow];
}
return self;
}
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self = [self initWithMyDefaults];
self = [self initWithDefaults];
[self setUpWindow];
}
return self;
}
- (void)setUpWindow {
if (NULL != fWind) {
fWind->setVisibleP(true);
fWind->resize(self.frame.size.width, self.frame.size.height,
SkBitmap::kARGB_8888_Config);
}
}
- (void)dealloc {
delete fWind;
delete fDevManager;
delete fFPSState;
self.fRasterLayer = nil;
self.fGLLayer = nil;
[fGL.fContext release];
application_term();
[fTitleItem release];
[super dealloc];
}
- (void)layoutSubviews {
int W, H;
// Allocate color buffer backing based on the current layer size
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
[fGL.fContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:fGLLayer];
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &fGL.fWidth);
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &fGL.fHeight);
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fStencilbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, fGL.fWidth, fGL.fHeight);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));
}
if (fDevManager->isUsingGL()) {
W = fGL.fWidth;
H = fGL.fHeight;
CGRect rect = CGRectMake(0, 0, W, H);
fGLLayer.bounds = rect;
}
else {
CGRect rect = self.bounds;
W = (int)CGRectGetWidth(rect);
H = (int)CGRectGetHeight(rect);
fRasterLayer.bounds = rect;
}
printf("---- layoutSubviews %d %d\n", W, H);
fWind->resize(W, H);
fWind->inval(NULL);
}
///////////////////////////////////////////////////////////////////////////////
- (void)drawWithCanvas:(SkCanvas*)canvas {
fRedrawRequestPending = false;
fFPSState->startDraw();
fWind->draw(canvas);
fFPSState->endDraw();
#ifdef FORCE_REDRAW
fWind->inval(NULL);
#endif
fFPSState->flush(fWind);
}
- (void)drawInGL {
// This application only creates a single context which is already set current at this point.
// This call is redundant, but needed if dealing with multiple contexts.
[EAGLContext setCurrentContext:fGL.fContext];
// This application only creates a single default framebuffer which is already bound at this point.
// This call is redundant, but needed if dealing with multiple framebuffers.
glBindFramebuffer(GL_FRAMEBUFFER, fGL.fFramebuffer);
GLint scissorEnable;
glGetIntegerv(GL_SCISSOR_TEST, &scissorEnable);
glDisable(GL_SCISSOR_TEST);
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
if (scissorEnable) {
glEnable(GL_SCISSOR_TEST);
}
glViewport(0, 0, fGL.fWidth, fGL.fHeight);
GrContext* ctx = fDevManager->getGrContext();
SkASSERT(NULL != ctx);
SkCanvas canvas;
// if we're not "retained", then we have to always redraw everything.
// This call forces us to ignore the fDirtyRgn, and draw everywhere.
// If we are "retained", we can skip this call (as the raster case does)
fWind->forceInvalAll();
[self drawWithCanvas:&canvas];
// This application only creates a single color renderbuffer which is already bound at this point.
// This call is redundant, but needed if dealing with multiple renderbuffers.
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
[fGL.fContext presentRenderbuffer:GL_RENDERBUFFER];
#if GR_COLLECT_STATS
// static int frame = 0;
// if (!(frame % 100)) {
// ctx->printStats();
// }
// ctx->resetStats();
// ++frame;
#endif
- (void)forceRedraw {
[self drawInRaster];
}
- (void)drawInRaster {
SkCanvas canvas;
[self drawWithCanvas:&canvas];
SkCanvas canvas(fWind->getBitmap());
fWind->draw(&canvas);
CGImageRef cgimage = SkCreateCGImageRef(fWind->getBitmap());
fRasterLayer.contents = (id)cgimage;
self.layer.contents = (id)cgimage;
CGImageRelease(cgimage);
}
- (void)forceRedraw {
if (fDevManager->isUsingGL())
[self drawInGL];
else
[self drawInRaster];
}
//Gesture Handlers
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
for (UITouch *touch in touches) {
@ -430,25 +81,11 @@ static FPSState gFPS;
}
}
- (void)handleTap:(UISwipeGestureRecognizer *)sender {
// CGPoint loc = [sender locationInView:self];
// if (loc.x > self.bounds.size.width/2)
// ((SampleWindow*)fWind)->nextSample();
// else
// ((SampleWindow*)fWind)->previousSample();
}
///////////////////////////////////////////////////////////////////////////////
- (void)setSkTitle:(const char *)title {
NSString* text = [NSString stringWithUTF8String:title];
if ([text length] > 0)
self.fTitle = text;
if (fTitleItem && fTitle) {
fTitleItem.title = [NSString stringWithFormat:@"%@%@", fTitle,
[NSString stringWithUTF8String:fFPSState->str.c_str()]];
if (fTitleItem) {
fTitleItem.title = [NSString stringWithUTF8String:title];
}
}
@ -465,22 +102,8 @@ static FPSState gFPS;
}
- (void)postInvalWithRect:(const SkIRect*)r {
if (!fRedrawRequestPending) {
fRedrawRequestPending = true;
bool gl = fDevManager->isUsingGL();
[CATransaction begin];
[CATransaction setAnimationDuration:0];
fRasterLayer.hidden = gl;
fGLLayer.hidden = !gl;
[CATransaction commit];
if (gl) {
[self performSelector:@selector(drawInGL) withObject:nil afterDelay:0];
}
else {
[self performSelector:@selector(drawInRaster) withObject:nil afterDelay:0];
[self setNeedsDisplay];
}
}
[self performSelector:@selector(drawInRaster) withObject:nil afterDelay:0];
[self setNeedsDisplay];
}
@end

View File

@ -1,9 +1,11 @@
#import <UIKit/UIKit.h>
#include "SkApplication.h"
int main(int argc, char *argv[]) {
signal(SIGPIPE, SIG_IGN);
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
application_init();
int retVal = UIApplicationMain(argc, argv, nil, nil);
application_term();
[pool release];
return retVal;
}

View File

@ -0,0 +1,46 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SampleApp.h"
#import "SkUIView.h"
class SkiOSDeviceManager;
class SkOSWindow;
class SkEvent;
struct FPSState;
@interface SkSampleUIView : SkUIView {
BOOL fRedrawRequestPending;
struct {
EAGLContext* fContext;
GLuint fRenderbuffer;
GLuint fStencilbuffer;
GLuint fFramebuffer;
GLint fWidth;
GLint fHeight;
} fGL;
NSString* fTitle;
CALayer* fRasterLayer;
CAEAGLLayer* fGLLayer;
FPSState* fFPSState;
SkiOSDeviceManager* fDevManager;
}
@property (nonatomic, copy) NSString* fTitle;
@property (nonatomic, retain) CALayer* fRasterLayer;
@property (nonatomic, retain) CAEAGLLayer* fGLLayer;
- (id)initWithDefaults;
- (void)drawInRaster;
- (void)forceRedraw;
- (void)setSkTitle:(const char*)title;
- (void)postInvalWithRect:(const SkIRect*)rectOrNil;
@end

View File

@ -0,0 +1,410 @@
#import "SkSampleUIView.h"
//#define SKWIND_CONFIG SkBitmap::kRGB_565_Config
#define SKWIND_CONFIG SkBitmap::kARGB_8888_Config
#define SKGL_CONFIG kEAGLColorFormatRGB565
//#define SKGL_CONFIG kEAGLColorFormatRGBA8
#define FORCE_REDRAW
//#define USE_GL_1
#define USE_GL_2
#include "SkCanvas.h"
#include "GrContext.h"
#include "GrGLInterface.h"
#include "SkGpuDevice.h"
#include "SkCGUtils.h"
class SkiOSDeviceManager : public SampleWindow::DeviceManager {
public:
SkiOSDeviceManager() {
fGrContext = NULL;
fGrRenderTarget = NULL;
usingGL = false;
}
virtual ~SkiOSDeviceManager() {
SkSafeUnref(fGrContext);
SkSafeUnref(fGrRenderTarget);
}
virtual void init(SampleWindow* win) {
win->attachGL();
if (NULL == fGrContext) {
#ifdef USE_GL_1
fGrContext = GrContext::Create(kOpenGL_Fixed_GrEngine, NULL);
#else
fGrContext = GrContext::Create(kOpenGL_Shaders_GrEngine, NULL);
#endif
}
if (NULL == fGrContext) {
SkDebugf("Failed to setup 3D");
win->detachGL();
}
}
virtual bool supportsDeviceType(SampleWindow::DeviceType dType) {
switch (dType) {
case SampleWindow::kRaster_DeviceType:
case SampleWindow::kPicture_DeviceType: // fallthru
return true;
case SampleWindow::kGPU_DeviceType:
return NULL != fGrContext;
default:
return false;
}
}
virtual bool prepareCanvas(SampleWindow::DeviceType dType,
SkCanvas* canvas,
SampleWindow* win) {
if (SampleWindow::kGPU_DeviceType == dType) {
canvas->setDevice(new SkGpuDevice(fGrContext, fGrRenderTarget))->unref();
usingGL = true;
}
else {
//The clip needs to be applied with a device attached to the canvas
canvas->setBitmapDevice(win->getBitmap());
usingGL = false;
}
return true;
}
virtual void publishCanvas(SampleWindow::DeviceType dType,
SkCanvas* canvas,
SampleWindow* win) {
if (SampleWindow::kGPU_DeviceType == dType) {
fGrContext->flush();
}
else {
//CGContextRef cg = UIGraphicsGetCurrentContext();
//SkCGDrawBitmap(cg, win->getBitmap(), 0, 0);
}
win->presentGL();
}
virtual void windowSizeChanged(SampleWindow* win) {
if (fGrContext) {
win->attachGL();
GrPlatformSurfaceDesc desc;
desc.reset();
desc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType;
desc.fWidth = SkScalarRound(win->width());
desc.fHeight = SkScalarRound(win->height());
desc.fConfig = kRGBA_8888_GrPixelConfig;
const GrGLInterface* gl = GrGLGetDefaultGLInterface();
GrAssert(NULL != gl);
GR_GL_GetIntegerv(gl, GR_GL_STENCIL_BITS, &desc.fStencilBits);
GR_GL_GetIntegerv(gl, GR_GL_SAMPLES, &desc.fSampleCnt);
GrGLint buffer;
GR_GL_GetIntegerv(gl, GR_GL_FRAMEBUFFER_BINDING, &buffer);
desc.fPlatformRenderTarget = buffer;
SkSafeUnref(fGrRenderTarget);
fGrRenderTarget = static_cast<GrRenderTarget*>(
fGrContext->createPlatformSurface(desc));
}
}
bool isUsingGL() { return usingGL; }
virtual GrContext* getGrContext() { return fGrContext; }
private:
bool usingGL;
GrContext* fGrContext;
GrRenderTarget* fGrRenderTarget;
};
////////////////////////////////////////////////////////////////////////////////
@implementation SkSampleUIView
@synthesize fTitle, fRasterLayer, fGLLayer;
#include "SkApplication.h"
#include "SkEvent.h"
#include "SkWindow.h"
#define kREDRAW_UIVIEW_GL "sk_redraw_uiview_gl_iOS"
extern bool gDoTraceDraw;
#define DO_TRACE_DRAW_MAX 100
struct FPSState {
static const int FRAME_COUNT = 60;
CFTimeInterval fNow0, fNow1;
CFTimeInterval fTime0, fTime1, fTotalTime;
int fFrameCounter;
int fDrawCounter;
SkString str;
FPSState() {
fTime0 = fTime1 = fTotalTime = 0;
fFrameCounter = 0;
}
void startDraw() {
fNow0 = CACurrentMediaTime();
if (0 == fDrawCounter && false) {
gDoTraceDraw = true;
SkDebugf("\n");
}
}
void endDraw() {
fNow1 = CACurrentMediaTime();
if (0 == fDrawCounter) {
gDoTraceDraw = true;
}
if (DO_TRACE_DRAW_MAX == ++fDrawCounter) {
fDrawCounter = 0;
}
}
void flush(SkOSWindow* hwnd) {
CFTimeInterval now2 = CACurrentMediaTime();
fTime0 += fNow1 - fNow0;
fTime1 += now2 - fNow1;
if (++fFrameCounter == FRAME_COUNT) {
CFTimeInterval totalNow = CACurrentMediaTime();
fTotalTime = totalNow - fTotalTime;
//SkMSec ms0 = (int)(1000 * fTime0 / FRAME_COUNT);
//SkMSec msTotal = (int)(1000 * fTotalTime / FRAME_COUNT);
//str.printf(" ms: %d [%d], fps: %3.1f", msTotal, ms0,
// FRAME_COUNT / fTotalTime);
str.printf(" fps:%3.1f", FRAME_COUNT / fTotalTime);
hwnd->setTitle(NULL);
fTotalTime = totalNow;
fTime0 = fTime1 = 0;
fFrameCounter = 0;
}
}
};
static FPSState gFPS;
#define FPS_StartDraw() gFPS.startDraw()
#define FPS_EndDraw() gFPS.endDraw()
#define FPS_Flush(wind) gFPS.flush(wind)
///////////////////////////////////////////////////////////////////////////////
- (id)initWithDefaults {
if (self = [super initWithDefaults]) {
fRedrawRequestPending = false;
fFPSState = new FPSState;
#ifdef USE_GL_1
fGL.fContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
#else
fGL.fContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
#endif
if (!fGL.fContext || ![EAGLContext setCurrentContext:fGL.fContext])
{
[self release];
return nil;
}
// Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer
glGenFramebuffers(1, &fGL.fFramebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, fGL.fFramebuffer);
glGenRenderbuffers(1, &fGL.fRenderbuffer);
glGenRenderbuffers(1, &fGL.fStencilbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, fGL.fRenderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fStencilbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fGL.fStencilbuffer);
self.fGLLayer = [CAEAGLLayer layer];
fGLLayer.bounds = self.bounds;
fGLLayer.anchorPoint = CGPointMake(0, 0);
fGLLayer.opaque = TRUE;
[self.layer addSublayer:fGLLayer];
fGLLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO],
kEAGLDrawablePropertyRetainedBacking,
SKGL_CONFIG,
kEAGLDrawablePropertyColorFormat,
nil];
self.fRasterLayer = [CALayer layer];
fRasterLayer.anchorPoint = CGPointMake(0, 0);
fRasterLayer.opaque = TRUE;
[self.layer addSublayer:fRasterLayer];
NSMutableDictionary *newActions = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNull null], @"onOrderIn",
[NSNull null], @"onOrderOut",
[NSNull null], @"sublayers",
[NSNull null], @"contents",
[NSNull null], @"bounds",
nil];
fGLLayer.actions = newActions;
fRasterLayer.actions = newActions;
[newActions release];
fDevManager = new SkiOSDeviceManager;
fWind = new SampleWindow(self, NULL, NULL, fDevManager);
fWind->resize(self.frame.size.width, self.frame.size.height, SKWIND_CONFIG);
}
return self;
}
- (void)dealloc {
delete fDevManager;
delete fFPSState;
self.fRasterLayer = nil;
self.fGLLayer = nil;
[fGL.fContext release];
[super dealloc];
}
- (void)layoutSubviews {
int W, H;
// Allocate color buffer backing based on the current layer size
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
[fGL.fContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:fGLLayer];
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &fGL.fWidth);
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &fGL.fHeight);
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fStencilbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, fGL.fWidth, fGL.fHeight);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));
}
if (fDevManager->isUsingGL()) {
W = fGL.fWidth;
H = fGL.fHeight;
CGRect rect = CGRectMake(0, 0, W, H);
fGLLayer.bounds = rect;
}
else {
CGRect rect = self.bounds;
W = (int)CGRectGetWidth(rect);
H = (int)CGRectGetHeight(rect);
fRasterLayer.bounds = rect;
}
printf("---- layoutSubviews %d %d\n", W, H);
fWind->resize(W, H);
fWind->inval(NULL);
}
///////////////////////////////////////////////////////////////////////////////
- (void)drawWithCanvas:(SkCanvas*)canvas {
fRedrawRequestPending = false;
fFPSState->startDraw();
fWind->draw(canvas);
fFPSState->endDraw();
#ifdef FORCE_REDRAW
fWind->inval(NULL);
#endif
fFPSState->flush(fWind);
}
- (void)drawInGL {
// This application only creates a single context which is already set current at this point.
// This call is redundant, but needed if dealing with multiple contexts.
[EAGLContext setCurrentContext:fGL.fContext];
// This application only creates a single default framebuffer which is already bound at this point.
// This call is redundant, but needed if dealing with multiple framebuffers.
glBindFramebuffer(GL_FRAMEBUFFER, fGL.fFramebuffer);
GLint scissorEnable;
glGetIntegerv(GL_SCISSOR_TEST, &scissorEnable);
glDisable(GL_SCISSOR_TEST);
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
if (scissorEnable) {
glEnable(GL_SCISSOR_TEST);
}
glViewport(0, 0, fGL.fWidth, fGL.fHeight);
GrContext* ctx = fDevManager->getGrContext();
SkASSERT(NULL != ctx);
SkCanvas canvas;
// if we're not "retained", then we have to always redraw everything.
// This call forces us to ignore the fDirtyRgn, and draw everywhere.
// If we are "retained", we can skip this call (as the raster case does)
fWind->forceInvalAll();
[self drawWithCanvas:&canvas];
// This application only creates a single color renderbuffer which is already bound at this point.
// This call is redundant, but needed if dealing with multiple renderbuffers.
glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer);
[fGL.fContext presentRenderbuffer:GL_RENDERBUFFER];
#if GR_COLLECT_STATS
// static int frame = 0;
// if (!(frame % 100)) {
// ctx->printStats();
// }
// ctx->resetStats();
// ++frame;
#endif
}
- (void)drawInRaster {
SkCanvas canvas;
[self drawWithCanvas:&canvas];
CGImageRef cgimage = SkCreateCGImageRef(fWind->getBitmap());
fRasterLayer.contents = (id)cgimage;
CGImageRelease(cgimage);
}
- (void)forceRedraw {
if (fDevManager->isUsingGL())
[self drawInGL];
else
[self drawInRaster];
}
///////////////////////////////////////////////////////////////////////////////
- (void)setSkTitle:(const char *)title {
NSString* text = [NSString stringWithUTF8String:title];
if ([text length] > 0)
self.fTitle = text;
if (fTitleItem && fTitle) {
fTitleItem.title = [NSString stringWithFormat:@"%@%@", fTitle,
[NSString stringWithUTF8String:fFPSState->str.c_str()]];
}
}
- (void)postInvalWithRect:(const SkIRect*)r {
if (!fRedrawRequestPending) {
fRedrawRequestPending = true;
bool gl = fDevManager->isUsingGL();
[CATransaction begin];
[CATransaction setAnimationDuration:0];
fRasterLayer.hidden = gl;
fGLLayer.hidden = !gl;
[CATransaction commit];
if (gl) {
[self performSelector:@selector(drawInGL) withObject:nil afterDelay:0];
}
else {
[self performSelector:@selector(drawInRaster) withObject:nil afterDelay:0];
[self setNeedsDisplay];
}
}
}
@end

View File

@ -7,7 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
2605F44213F18B1B0044A072 /* DebuggerContentView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2605F43C13F18B1B0044A072 /* DebuggerContentView.cpp */; };
2605F44313F18B1B0044A072 /* DebuggerCommandsView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2605F43E13F18B1B0044A072 /* DebuggerCommandsView.cpp */; };
@ -456,6 +455,8 @@
26962CAB13CE268A0039B1FB /* SampleApp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26962CA913CE268A0039B1FB /* SampleApp.cpp */; };
26962D4F13CE2D780039B1FB /* GrGLDefaultInterface_iOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26962D4E13CE2D780039B1FB /* GrGLDefaultInterface_iOS.cpp */; };
26A8AFF313E05D7000A3C111 /* GrResourceCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A8AFF113E05D7000A3C111 /* GrResourceCache.cpp */; };
26D91223140D576B0036A311 /* SkSampleUIView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26D91222140D576B0036A311 /* SkSampleUIView.mm */; };
26D9122A140D57BD0036A311 /* skia_ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26D91229140D57BD0036A311 /* skia_ios.mm */; };
26E0E40A13B4E67800866555 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260EE9D113AFA7850064D447 /* OpenGLES.framework */; };
26F548C213B918EC007CC564 /* SkBlitter_4444.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E022313B1225D0064D447 /* SkBlitter_4444.cpp */; };
26F548C313B918ED007CC564 /* SkBlitter_A1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E022413B1225D0064D447 /* SkBlitter_A1.cpp */; };
@ -809,7 +810,6 @@
260E029013B1225D0064D447 /* SkUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkUtils.cpp; sourceTree = "<group>"; };
260E029113B1225D0064D447 /* SkWriter32.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkWriter32.cpp; sourceTree = "<group>"; };
260E029213B1225D0064D447 /* SkXfermode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkXfermode.cpp; sourceTree = "<group>"; };
260E029413B1225D0064D447 /* opts_check_SSE2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = opts_check_SSE2.cpp; sourceTree = "<group>"; };
260E029613B1225D0064D447 /* SkDebug_stdio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkDebug_stdio.cpp; sourceTree = "<group>"; };
260E029813B1225D0064D447 /* SkFontHost_mac_coretext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkFontHost_mac_coretext.cpp; sourceTree = "<group>"; };
260E029A13B1225D0064D447 /* SkGlobals_global.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkGlobals_global.cpp; sourceTree = "<group>"; };
@ -957,7 +957,6 @@
260E03F113B122D40064D447 /* GrRedBlackTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrRedBlackTree.h; sourceTree = "<group>"; };
260E03F213B122D40064D447 /* GrResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GrResource.cpp; sourceTree = "<group>"; };
260E03F313B122D40064D447 /* GrStencil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GrStencil.cpp; sourceTree = "<group>"; };
260E03F413B122D40064D447 /* GrTesselatedPathRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GrTesselatedPathRenderer.cpp; sourceTree = "<group>"; };
260E03F513B122D40064D447 /* GrTextContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GrTextContext.cpp; sourceTree = "<group>"; };
260E03F613B122D40064D447 /* GrTextStrike.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GrTextStrike.cpp; sourceTree = "<group>"; };
260E03F713B122D40064D447 /* GrTextStrike_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrTextStrike_impl.h; sourceTree = "<group>"; };
@ -981,9 +980,6 @@
260E044D13B1232F0064D447 /* SkFlipPixelRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkFlipPixelRef.cpp; sourceTree = "<group>"; };
260E044E13B1232F0064D447 /* SkImageDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkImageDecoder.cpp; sourceTree = "<group>"; };
260E045613B1232F0064D447 /* SkImageEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkImageEncoder.cpp; sourceTree = "<group>"; };
260E04B513B123730064D447 /* SkBitmapProcState_opts_SSE2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkBitmapProcState_opts_SSE2.cpp; sourceTree = "<group>"; };
260E04B613B123730064D447 /* SkBlitRow_opts_SSE2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkBlitRow_opts_SSE2.cpp; sourceTree = "<group>"; };
260E04B713B123730064D447 /* SkUtils_opts_SSE2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkUtils_opts_SSE2.cpp; sourceTree = "<group>"; };
260E04C813B123840064D447 /* SkSVGAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkSVGAttribute.h; sourceTree = "<group>"; };
260E04C913B123840064D447 /* SkSVGBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkSVGBase.h; sourceTree = "<group>"; };
260E04CA13B123840064D447 /* SkSVGPaintState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkSVGPaintState.h; sourceTree = "<group>"; };
@ -1294,7 +1290,6 @@
260E07CF13B128870064D447 /* SkImageRefPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkImageRefPool.cpp; sourceTree = "<group>"; };
260E07D013B128870064D447 /* SkImageRefPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkImageRefPool.h; sourceTree = "<group>"; };
260E07D613B1289C0064D447 /* SkImageRef_GlobalPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkImageRef_GlobalPool.cpp; sourceTree = "<group>"; };
260E07DB13B128AD0064D447 /* SkMovie_gif.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkMovie_gif.cpp; sourceTree = "<group>"; };
260E080E13B1294E0064D447 /* SkImageDecoder_CG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkImageDecoder_CG.cpp; sourceTree = "<group>"; };
260E083B13B12A200064D447 /* SkImageDecoder_Factory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkImageDecoder_Factory.cpp; sourceTree = "<group>"; };
260E083C13B12A200064D447 /* SkImageEncoder_Factory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkImageEncoder_Factory.cpp; sourceTree = "<group>"; };
@ -1380,12 +1375,11 @@
26962D4E13CE2D780039B1FB /* GrGLDefaultInterface_iOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GrGLDefaultInterface_iOS.cpp; path = ../../gpu/src/ios/GrGLDefaultInterface_iOS.cpp; sourceTree = SOURCE_ROOT; };
26A8AFF113E05D7000A3C111 /* GrResourceCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GrResourceCache.cpp; sourceTree = "<group>"; };
26A8AFF213E05D7000A3C111 /* GrResourceCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GrResourceCache.h; sourceTree = "<group>"; };
26D91221140D576B0036A311 /* SkSampleUIView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkSampleUIView.h; sourceTree = "<group>"; };
26D91222140D576B0036A311 /* SkSampleUIView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SkSampleUIView.mm; sourceTree = "<group>"; };
26D91229140D57BD0036A311 /* skia_ios.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = skia_ios.mm; path = Shared/skia_ios.mm; sourceTree = "<group>"; };
26E0E5C913B5299E00866555 /* SkGPipe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SkGPipe.h; path = ../../include/pipe/SkGPipe.h; sourceTree = SOURCE_ROOT; };
26F548DF13B91980007CC564 /* opts_check_arm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = opts_check_arm.cpp; sourceTree = "<group>"; };
26F548E013B91980007CC564 /* SkBitmapProcState_opts_arm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkBitmapProcState_opts_arm.cpp; sourceTree = "<group>"; };
26F548E113B91980007CC564 /* SkBitmapProcState_opts_none.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkBitmapProcState_opts_none.cpp; sourceTree = "<group>"; };
26F548E213B91980007CC564 /* SkBitmapProcState_opts_SSE2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkBitmapProcState_opts_SSE2.h; sourceTree = "<group>"; };
26F548E313B91980007CC564 /* SkBlitRow_opts_arm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkBlitRow_opts_arm.cpp; sourceTree = "<group>"; };
26F548E413B91980007CC564 /* SkBlitRow_opts_none.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkBlitRow_opts_none.cpp; sourceTree = "<group>"; };
26F548E513B91980007CC564 /* SkBlitRow_opts_SSE2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SkBlitRow_opts_SSE2.h; sourceTree = "<group>"; };
26F548E613B91980007CC564 /* SkUtils_opts_none.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SkUtils_opts_none.cpp; sourceTree = "<group>"; };
@ -1422,7 +1416,6 @@
2860E32C111B888700E27156 /* AppDelegate_iPad.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate_iPad.mm; sourceTree = "<group>"; };
2860E32D111B888700E27156 /* MainWindow_iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow_iPad.xib; sourceTree = "<group>"; };
288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Shared/main.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -1723,7 +1716,6 @@
children = (
26677D6513B4C548009319B8 /* SkData.cpp */,
260E020A13B1225D0064D447 /* core */,
260E029313B1225D0064D447 /* opts */,
260E029513B1225D0064D447 /* ports */,
);
path = src;
@ -1871,14 +1863,6 @@
path = core;
sourceTree = "<group>";
};
260E029313B1225D0064D447 /* opts */ = {
isa = PBXGroup;
children = (
260E029413B1225D0064D447 /* opts_check_SSE2.cpp */,
);
path = opts;
sourceTree = "<group>";
};
260E029513B1225D0064D447 /* ports */ = {
isa = PBXGroup;
children = (
@ -2109,7 +2093,6 @@
260E03F113B122D40064D447 /* GrRedBlackTree.h */,
260E03F213B122D40064D447 /* GrResource.cpp */,
260E03F313B122D40064D447 /* GrStencil.cpp */,
260E03F413B122D40064D447 /* GrTesselatedPathRenderer.cpp */,
260E03F513B122D40064D447 /* GrTextContext.cpp */,
260E03F613B122D40064D447 /* GrTextStrike.cpp */,
260E03F713B122D40064D447 /* GrTextStrike_impl.h */,
@ -2197,7 +2180,6 @@
260E07CF13B128870064D447 /* SkImageRefPool.cpp */,
260E07D013B128870064D447 /* SkImageRefPool.h */,
260E07D613B1289C0064D447 /* SkImageRef_GlobalPool.cpp */,
260E07DB13B128AD0064D447 /* SkMovie_gif.cpp */,
);
path = images;
sourceTree = "<group>";
@ -2213,18 +2195,11 @@
260E04B413B123730064D447 /* opts */ = {
isa = PBXGroup;
children = (
26F548DF13B91980007CC564 /* opts_check_arm.cpp */,
26F548E013B91980007CC564 /* SkBitmapProcState_opts_arm.cpp */,
26F548E113B91980007CC564 /* SkBitmapProcState_opts_none.cpp */,
26F548E213B91980007CC564 /* SkBitmapProcState_opts_SSE2.h */,
26F548E313B91980007CC564 /* SkBlitRow_opts_arm.cpp */,
26F548E413B91980007CC564 /* SkBlitRow_opts_none.cpp */,
26F548E513B91980007CC564 /* SkBlitRow_opts_SSE2.h */,
26F548E613B91980007CC564 /* SkUtils_opts_none.cpp */,
26F548E713B91980007CC564 /* SkUtils_opts_SSE2.h */,
260E04B513B123730064D447 /* SkBitmapProcState_opts_SSE2.cpp */,
260E04B613B123730064D447 /* SkBlitRow_opts_SSE2.cpp */,
260E04B713B123730064D447 /* SkUtils_opts_SSE2.cpp */,
);
name = opts;
path = ../../src/opts;
@ -2752,6 +2727,7 @@
260EE8B913AFA7790064D447 /* iOS */ = {
isa = PBXGroup;
children = (
26D91229140D57BD0036A311 /* skia_ios.mm */,
26FB98D113D0C87000ACBEA0 /* SkUIView.h */,
26FB98D213D0C87000ACBEA0 /* SkUIView.mm */,
26962D4E13CE2D780039B1FB /* GrGLDefaultInterface_iOS.cpp */,
@ -2855,7 +2831,8 @@
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
29B97316FDCFA39411CA2CEA /* main.m */,
26D91221140D576B0036A311 /* SkSampleUIView.h */,
26D91222140D576B0036A311 /* SkSampleUIView.mm */,
26962C8E13CE25D60039B1FB /* iOSSampleApp_Prefix.pch */,
26962C8F13CE25D60039B1FB /* iOSSampleApp-Info.plist */,
26962CC813CE27390039B1FB /* xcconfig */,
@ -2947,7 +2924,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1D60589B0D05DD56006BFB54 /* main.m in Sources */,
2860E328111B887F00E27156 /* AppDelegate_iPhone.mm in Sources */,
2860E32E111B888700E27156 /* AppDelegate_iPad.mm in Sources */,
260E00E313B11F5B0064D447 /* OverView.cpp in Sources */,
@ -3409,6 +3385,8 @@
2612C111140D300B001B6925 /* GrGLStencilBuffer.cpp in Sources */,
2612C112140D300B001B6925 /* GrPathRendererChain.cpp in Sources */,
2612C122140D30B0001B6925 /* GrAddPathRenderers_none.cpp in Sources */,
26D91223140D576B0036A311 /* SkSampleUIView.mm in Sources */,
26D9122A140D57BD0036A311 /* skia_ios.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -399,7 +399,7 @@
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>SkUIDetailViewController</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>SkUIView</string>
<string>SkSampleUIView</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAxDqAAA</bytes>
@ -407,7 +407,7 @@
<string>{{125, 4}, {768, 1024}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>SkUISplitViewController</string>
<string>{{362, 4}, {768, 1024}}</string>
<string>{{362, 0}, {783, 1006}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>SkUIRootViewController</string>
@ -480,6 +480,14 @@
<string key="minorKey">iPad/AppDelegate_iPad.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SkSampleUIView</string>
<string key="superclassName">SkUIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">SkSampleUIView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SkUIDetailViewController</string>
<string key="superclassName">UIViewController</string>
@ -539,6 +547,17 @@
<object class="IBPartialClassDescription">
<string key="className">SkUIView</string>
<string key="superclassName">UIView</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">fOptionsDelegate</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">fOptionsDelegate</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">fOptionsDelegate</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">Shared/SkUIView.h</string>

View File

@ -373,7 +373,7 @@
<string>UIApplication</string>
<string>UIResponder</string>
<string>SkUINavigationController</string>
<string>{{351, 949}, {320, 480}}</string>
<string>{{351, 526}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>SkUIDetailViewController</string>
<string>{{445, 495}, {320, 480}}</string>
@ -392,7 +392,7 @@
<string>SkUIRootViewController</string>
<string>{{360, 1385}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>SkUIView</string>
<string>SkSampleUIView</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>AppDelegate_iPhone</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@ -401,7 +401,7 @@
<bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAw9kAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>{{362, 1362}, {320, 480}}</string>
<string>{{1356, 526}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</object>
@ -467,6 +467,14 @@
<string key="minorKey">iPhone/AppDelegate_iPhone.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SkSampleUIView</string>
<string key="superclassName">SkUIView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">SkSampleUIView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">SkUIDetailViewController</string>
<string key="superclassName">UIViewController</string>
@ -526,6 +534,17 @@
<object class="IBPartialClassDescription">
<string key="className">SkUIView</string>
<string key="superclassName">UIView</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">fOptionsDelegate</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">fOptionsDelegate</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">fOptionsDelegate</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">Shared/SkUIView.h</string>

View File

@ -62,5 +62,4 @@ bool SkOSWindow::attachGL() {
void SkOSWindow::detachGL() {}
void SkOSWindow::presentGL() {
glFlush();
}