| OLD | NEW |
| 1 #include "SkApplication.h" |
| 1 #import "SkCanvas.h" | 2 #import "SkCanvas.h" |
| 2 #import "SkPaint.h" | 3 #import "SkPaint.h" |
| 3 #import "SkWindow.h" | 4 #import "SkWindow.h" |
| 4 #include "SkGraphics.h" | 5 #include "SkGraphics.h" |
| 5 #include "SkCGUtils.h" | 6 #include "SkCGUtils.h" |
| 6 | 7 |
| 7 extern void tool_main(int argc, char *argv[]); | 8 void dummy_main(int , char *[]) { |
| 8 extern bool set_cmd_line_args(int argc, char *argv[], const char* dir); | 9 } |
| 9 | 10 |
| 10 class SkSampleView : public SkView { | 11 class SkSampleView : public SkView { |
| 11 public: | 12 public: |
| 12 SkSampleView() { | 13 SkSampleView() { |
| 13 this->setVisibleP(true); | 14 this->setVisibleP(true); |
| 14 this->setClipToBounds(false); | 15 this->setClipToBounds(false); |
| 15 }; | 16 }; |
| 16 protected: | 17 protected: |
| 17 virtual void onDraw(SkCanvas* canvas) { | 18 virtual void onDraw(SkCanvas* canvas) { |
| 18 canvas->drawColor(0xFFFFFFFF); | 19 canvas->drawColor(0xFFFFFFFF); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 34 } | 35 } |
| 35 | 36 |
| 36 void application_term() { | 37 void application_term() { |
| 37 SkGraphics::Term(); | 38 SkGraphics::Term(); |
| 38 SkEvent::Term(); | 39 SkEvent::Term(); |
| 39 } | 40 } |
| 40 | 41 |
| 41 int saved_argc; | 42 int saved_argc; |
| 42 char** saved_argv; | 43 char** saved_argv; |
| 43 | 44 |
| 44 bool set_cmd_line_args(int argc, char *argv[], const char* ) { | 45 IOS_launch_type set_cmd_line_args(int argc, char *argv[], const char* ) { |
| 45 saved_argc = argc; | 46 saved_argc = argc; |
| 46 saved_argv = argv; | 47 saved_argv = argv; |
| 47 return true; | 48 return kTool_iOSLaunchType; |
| 48 } | 49 } |
| 49 | 50 |
| 50 class FillLayout : public SkView::Layout { | 51 class FillLayout : public SkView::Layout { |
| 51 protected: | 52 protected: |
| 52 virtual void onLayoutChildren(SkView* parent) { | 53 virtual void onLayoutChildren(SkView* parent) { |
| 53 SkView* view = SkView::F2BIter(parent).next(); | 54 SkView* view = SkView::F2BIter(parent).next(); |
| 54 view->setSize(parent->width(), parent->height()); | 55 view->setSize(parent->width(), parent->height()); |
| 55 } | 56 } |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 #import "SimpleApp.h" | 59 #import "SimpleApp.h" |
| 59 @implementation SimpleApp | 60 @implementation SimpleApp |
| 60 | 61 |
| 61 - (id)initWithDefaults { | 62 - (id)initWithDefaults { |
| 62 (void) tool_main(saved_argc, saved_argv); | 63 dummy_main(saved_argc, saved_argv); |
| 63 if (self = [super initWithDefaults]) { | 64 if (self = [super initWithDefaults]) { |
| 64 fWind = new SkOSWindow(self); | 65 fWind = new SkOSWindow(self); |
| 65 fWind->setLayout(new FillLayout, false); | 66 fWind->setLayout(new FillLayout, false); |
| 66 fWind->attachChildToFront(new SkSampleView)->unref(); | 67 fWind->attachChildToFront(new SkSampleView)->unref(); |
| 67 } | 68 } |
| 68 return self; | 69 return self; |
| 69 } | 70 } |
| 70 | 71 |
| 71 @end | 72 @end |
| OLD | NEW |