17f0b6df72
Share command flags between dm and unit tests. Also, allow dm's core to be included by itself and iOSShell. Command line flags that are the same (or nearly the same) in DM and in skia_tests have been moved to common_flags. Authors, please check to see that the shared common flag is correct for the tool. For iOS, the 'tool_main' entry point has a wrapper to allow multiple tools to be statically linked in the iOSShell. Since SkCommandLineFlags::Parse can only be called once, these calls are disabled in the IOS build. Since the iOS app directory is dynamically assigned a name, use '@' to select it. (This is the same convention chosen by the Mobile Harness iOS file system utilities.) Move the heart of dm.gyp into dm.gypi so that it can be included by itself and iOSShell.gyp. Add tools/flags/SkCommonFlags.* to define and declare common command line flags. Add support for dm to iOSShell. BUG=skia: R=scroggo@google.com, mtklein@google.com, jvanverth@google.com, bsalomon@google.com Author: caryclark@google.com Review URL: https://codereview.chromium.org/389653004
73 lines
1.6 KiB
Plaintext
73 lines
1.6 KiB
Plaintext
#include "SkApplication.h"
|
|
#import "SkCanvas.h"
|
|
#import "SkPaint.h"
|
|
#import "SkWindow.h"
|
|
#include "SkGraphics.h"
|
|
#include "SkCGUtils.h"
|
|
|
|
void dummy_main(int , char *[]) {
|
|
}
|
|
|
|
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);
|
|
canvas->drawText("finished", 13, 50, 30, p);
|
|
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();
|
|
}
|
|
|
|
int saved_argc;
|
|
char** saved_argv;
|
|
|
|
IOS_launch_type set_cmd_line_args(int argc, char *argv[], const char* ) {
|
|
saved_argc = argc;
|
|
saved_argv = argv;
|
|
return kTool_iOSLaunchType;
|
|
}
|
|
|
|
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 {
|
|
dummy_main(saved_argc, saved_argv);
|
|
if (self = [super initWithDefaults]) {
|
|
fWind = new SkOSWindow(self);
|
|
fWind->setLayout(new FillLayout, false);
|
|
fWind->attachChildToFront(new SkSampleView)->unref();
|
|
}
|
|
return self;
|
|
}
|
|
|
|
@end
|