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