| Index: gm/drawable.cpp
|
| diff --git a/gm/drawable.cpp b/gm/drawable.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..375ce73cbe6dc6fe9ca98fa377067c41b6fdbec0
|
| --- /dev/null
|
| +++ b/gm/drawable.cpp
|
| @@ -0,0 +1,35 @@
|
| +/*
|
| + * Copyright 2015 Google Inc.
|
| + *
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file.
|
| + */
|
| +
|
| +#include "gm.h"
|
| +#include "SkCanvas.h"
|
| +#include "SkDrawable.h"
|
| +
|
| +struct MyDrawable : public SkDrawable {
|
| + SkRect onGetBounds() override {
|
| + return SkRect::MakeWH(640, 480);
|
| + }
|
| +
|
| + void onDraw(SkCanvas* canvas) override {
|
| + SkPath path;
|
| + path.moveTo(10, 10);
|
| + path.conicTo(10, 90, 50, 90, 0.9f);
|
| +
|
| + SkPaint paint;
|
| + paint.setColor(SK_ColorBLUE);
|
| + canvas->drawRect(path.getBounds(), paint);
|
| +
|
| + paint.setAntiAlias(true);
|
| + paint.setColor(SK_ColorWHITE);
|
| + canvas->drawPath(path, paint);
|
| + }
|
| +};
|
| +
|
| +DEF_SIMPLE_GM(Drawables, canvas, 640, 480) {
|
| + SkAutoTUnref<SkDrawable> d(new MyDrawable);
|
| + canvas->drawDrawable(d);
|
| +}
|
|
|