diff options
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/SimpleiOSApp/SimpleApp.mm | 15 | ||||
-rw-r--r-- | experimental/SimpleiOSApp/tool-Info.plist | 43 | ||||
-rw-r--r-- | experimental/iOSSampleApp/Shared/skia_ios.mm | 4 | ||||
-rw-r--r-- | experimental/iOSSampleApp/SkSampleUIView.mm | 35 |
4 files changed, 72 insertions, 25 deletions
diff --git a/experimental/SimpleiOSApp/SimpleApp.mm b/experimental/SimpleiOSApp/SimpleApp.mm index 12dff34ce4..dba8bccafd 100644 --- a/experimental/SimpleiOSApp/SimpleApp.mm +++ b/experimental/SimpleiOSApp/SimpleApp.mm @@ -3,6 +3,10 @@ #import "SkWindow.h" #include "SkGraphics.h" #include "SkCGUtils.h" + +extern void tool_main(int argc, char *argv[]); +void save_args(int argc, char *argv[]); + class SkSampleView : public SkView { public: SkSampleView() { @@ -15,7 +19,7 @@ protected: SkPaint p; p.setTextSize(20); p.setAntiAlias(true); - canvas->drawText("Hello World!", 13, 50, 30, p); + canvas->drawText("finished", 13, 50, 30, p); SkRect r = {50, 50, 80, 80}; p.setColor(0xAA11EEAA); canvas->drawRect(r, p); @@ -34,6 +38,14 @@ void application_term() { SkEvent::Term(); } +int saved_argc; +char** saved_argv; + +void save_args(int argc, char *argv[]) { + saved_argc = argc; + saved_argv = argv; +} + class FillLayout : public SkView::Layout { protected: virtual void onLayoutChildren(SkView* parent) { @@ -46,6 +58,7 @@ protected: @implementation SimpleApp - (id)initWithDefaults { + (void) tool_main(saved_argc, saved_argv); if (self = [super initWithDefaults]) { fWind = new SkOSWindow(self); fWind->setLayout(new FillLayout, false); diff --git a/experimental/SimpleiOSApp/tool-Info.plist b/experimental/SimpleiOSApp/tool-Info.plist new file mode 100644 index 0000000000..6f8c6d8bd1 --- /dev/null +++ b/experimental/SimpleiOSApp/tool-Info.plist @@ -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.google.${EXECUTABLE_NAME}</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> diff --git a/experimental/iOSSampleApp/Shared/skia_ios.mm b/experimental/iOSSampleApp/Shared/skia_ios.mm index 4e497867bf..65b3e8a034 100644 --- a/experimental/iOSSampleApp/Shared/skia_ios.mm +++ b/experimental/iOSSampleApp/Shared/skia_ios.mm @@ -1,9 +1,13 @@ #import <UIKit/UIKit.h> #include "SkApplication.h" + +extern void save_args(int argc, char *argv[]); + int main(int argc, char *argv[]) { signal(SIGPIPE, SIG_IGN); NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; application_init(); + save_args(argc, argv); int retVal = UIApplicationMain(argc, argv, nil, nil); application_term(); [pool release]; diff --git a/experimental/iOSSampleApp/SkSampleUIView.mm b/experimental/iOSSampleApp/SkSampleUIView.mm index b71640201d..b08414ec4e 100644 --- a/experimental/iOSSampleApp/SkSampleUIView.mm +++ b/experimental/iOSSampleApp/SkSampleUIView.mm @@ -7,15 +7,18 @@ #define FORCE_REDRAW +#include "SkCanvas.h" +#include "SkCGUtils.h" +#include "SampleApp.h" + +#if SK_SUPPORT_GPU //#define USE_GL_1 #define USE_GL_2 -#include "SkCanvas.h" -#include "GrContext.h" #include "gl/GrGLInterface.h" +#include "GrContext.h" #include "SkGpuDevice.h" -#include "SkCGUtils.h" -#include "SampleApp.h" +#endif class SkiOSDeviceManager : public SampleWindow::DeviceManager { public: @@ -151,9 +154,11 @@ public: virtual void publishCanvas(SampleWindow::DeviceType dType, SkCanvas* canvas, SampleWindow* win) SK_OVERRIDE { +#if SK_SUPPORT_GPU if (NULL != fCurContext) { fCurContext->flush(); } +#endif win->present(); } @@ -219,18 +224,12 @@ private: #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; @@ -239,22 +238,10 @@ struct FPSState { 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) { @@ -335,7 +322,7 @@ static FPSState gFPS; fRasterLayer.opaque = TRUE; [self.layer addSublayer:fRasterLayer]; - NSMutableDictionary *newActions = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNull null], @"onOrderIn", + NSMutableDictionary *newActions = [[NSMutableDictionary alloc] initWithObjectsAndKeys:[NSNull null], @"onOrderIn", [NSNull null], @"onOrderOut", [NSNull null], @"sublayers", [NSNull null], @"contents", @@ -346,7 +333,7 @@ static FPSState gFPS; [newActions release]; fDevManager = new SkiOSDeviceManager(fGL.fFramebuffer); - static char* kDummyArgv = "dummyExecutableName"; + static char* kDummyArgv = const_cast<char*>("dummyExecutableName"); fWind = new SampleWindow(self, 1, &kDummyArgv, fDevManager); fWind->resize(self.frame.size.width, self.frame.size.height, SKWIND_CONFIG); |