2014-07-22 17:15:34 +00:00
|
|
|
#include "SkApplication.h"
|
2011-08-30 19:14:13 +00:00
|
|
|
#import "SkCanvas.h"
|
|
|
|
#import "SkPaint.h"
|
|
|
|
#import "SkWindow.h"
|
|
|
|
#include "SkGraphics.h"
|
|
|
|
#include "SkCGUtils.h"
|
2012-10-02 18:33:14 +00:00
|
|
|
|
2014-07-22 17:15:34 +00:00
|
|
|
void dummy_main(int , char *[]) {
|
|
|
|
}
|
2012-10-02 18:33:14 +00:00
|
|
|
|
2011-08-30 19:14:13 +00:00
|
|
|
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);
|
2012-10-02 18:33:14 +00:00
|
|
|
canvas->drawText("finished", 13, 50, 30, p);
|
2011-08-30 19:14:13 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2012-10-02 18:33:14 +00:00
|
|
|
int saved_argc;
|
|
|
|
char** saved_argv;
|
|
|
|
|
2014-07-22 17:15:34 +00:00
|
|
|
IOS_launch_type set_cmd_line_args(int argc, char *argv[], const char* ) {
|
2012-10-02 18:33:14 +00:00
|
|
|
saved_argc = argc;
|
|
|
|
saved_argv = argv;
|
2014-07-22 17:15:34 +00:00
|
|
|
return kTool_iOSLaunchType;
|
2012-10-02 18:33:14 +00:00
|
|
|
}
|
|
|
|
|
2011-08-30 19:14:13 +00:00
|
|
|
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 {
|
2014-07-22 17:15:34 +00:00
|
|
|
dummy_main(saved_argc, saved_argv);
|
2011-08-30 19:14:13 +00:00
|
|
|
if (self = [super initWithDefaults]) {
|
|
|
|
fWind = new SkOSWindow(self);
|
|
|
|
fWind->setLayout(new FillLayout, false);
|
|
|
|
fWind->attachChildToFront(new SkSampleView)->unref();
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|