| OLD | NEW |
| 1 /* | |
| 2 * Copyright 2015 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #include "SkApplication.h" | 1 #include "SkApplication.h" |
| 9 #import "SkCanvas.h" | 2 #import "SkCanvas.h" |
| 10 #import "SkPaint.h" | 3 #import "SkPaint.h" |
| 11 #import "SkWindow.h" | 4 #import "SkWindow.h" |
| 12 #include "SkGraphics.h" | 5 #include "SkGraphics.h" |
| 13 #include "SkCGUtils.h" | 6 #include "SkCGUtils.h" |
| 14 | 7 |
| 15 void dummy_main(int , char *[]) { | 8 void dummy_main(int , char *[]) { |
| 16 } | 9 } |
| 17 | 10 |
| 18 class SkSampleView : public SkView { | 11 class SkSampleView : public SkView { |
| 19 public: | 12 public: |
| 20 SkSampleView() { | 13 SkSampleView() { |
| 21 this->setVisibleP(true); | 14 this->setVisibleP(true); |
| 22 this->setClipToBounds(false); | 15 this->setClipToBounds(false); |
| 23 }; | 16 }; |
| 24 protected: | 17 protected: |
| 25 virtual void onDraw(SkCanvas* canvas) { | 18 virtual void onDraw(SkCanvas* canvas) { |
| 26 canvas->drawColor(0xFFFFFFFF); | 19 canvas->drawColor(0xFFFFFFFF); |
| 27 SkPaint p; | 20 SkPaint p; |
| 28 p.setTextSize(20); | 21 p.setTextSize(20); |
| 29 p.setAntiAlias(true); | 22 p.setAntiAlias(true); |
| 30 canvas->drawText("finished", 13, 50, 30, p); | 23 canvas->drawText("finished", 13, 50, 30, p); |
| 31 SkRect r = {50, 50, 80, 80}; | 24 SkRect r = {50, 50, 80, 80}; |
| 32 p.setColor(0xAA11EEAA); | 25 p.setColor(0xAA11EEAA); |
| 33 canvas->drawRect(r, p); | 26 canvas->drawRect(r, p); |
| 34 } | 27 } |
| 35 private: | 28 private: |
| 36 typedef SkView INHERITED; | 29 typedef SkView INHERITED; |
| 37 }; | 30 }; |
| 38 | 31 |
| 39 void application_init() { | 32 void application_init() { |
| 40 SkGraphics::Init(); | 33 SkGraphics::Init(); |
| 41 SkEvent::Init(); | 34 SkEvent::Init(); |
| 42 } | 35 } |
| 43 | 36 |
| 44 void application_term() { | 37 void application_term() { |
| 38 SkGraphics::Term(); |
| 45 SkEvent::Term(); | 39 SkEvent::Term(); |
| 46 } | 40 } |
| 47 | 41 |
| 48 int saved_argc; | 42 int saved_argc; |
| 49 char** saved_argv; | 43 char** saved_argv; |
| 50 | 44 |
| 51 IOS_launch_type set_cmd_line_args(int argc, char *argv[], const char* ) { | 45 IOS_launch_type set_cmd_line_args(int argc, char *argv[], const char* ) { |
| 52 saved_argc = argc; | 46 saved_argc = argc; |
| 53 saved_argv = argv; | 47 saved_argv = argv; |
| 54 return kTool_iOSLaunchType; | 48 return kTool_iOSLaunchType; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 69 dummy_main(saved_argc, saved_argv); | 63 dummy_main(saved_argc, saved_argv); |
| 70 if (self = [super initWithDefaults]) { | 64 if (self = [super initWithDefaults]) { |
| 71 fWind = new SkOSWindow(self); | 65 fWind = new SkOSWindow(self); |
| 72 fWind->setLayout(new FillLayout, false); | 66 fWind->setLayout(new FillLayout, false); |
| 73 fWind->attachChildToFront(new SkSampleView)->unref(); | 67 fWind->attachChildToFront(new SkSampleView)->unref(); |
| 74 } | 68 } |
| 75 return self; | 69 return self; |
| 76 } | 70 } |
| 77 | 71 |
| 78 @end | 72 @end |
| OLD | NEW |