| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkDrawable.h" | 10 #include "SkDrawable.h" |
| 11 #include "SkPath.h" | |
| 12 | 11 |
| 13 struct MyDrawable : public SkDrawable { | 12 struct MyDrawable : public SkDrawable { |
| 14 SkRect onGetBounds() override { return SkRect::MakeWH(50, 100); } | 13 SkRect onGetBounds() override { return SkRect::MakeWH(50, 100); } |
| 15 | 14 |
| 16 void onDraw(SkCanvas* canvas) override { | 15 void onDraw(SkCanvas* canvas) override { |
| 17 SkPath path; | 16 SkPath path; |
| 18 path.moveTo(10, 10); | 17 path.moveTo(10, 10); |
| 19 path.conicTo(10, 90, 50, 90, 0.9f); | 18 path.conicTo(10, 90, 50, 90, 0.9f); |
| 20 | 19 |
| 21 SkPaint paint; | 20 SkPaint paint; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 canvas->drawDrawable(drawable); | 37 canvas->drawDrawable(drawable); |
| 39 canvas->drawDrawable(drawable, 0, 150); | 38 canvas->drawDrawable(drawable, 0, 150); |
| 40 | 39 |
| 41 SkMatrix m = SkMatrix::MakeScale(1.5f, 0.8f); | 40 SkMatrix m = SkMatrix::MakeScale(1.5f, 0.8f); |
| 42 m.postTranslate(70, 0); | 41 m.postTranslate(70, 0); |
| 43 canvas->drawDrawable(drawable, &m); | 42 canvas->drawDrawable(drawable, &m); |
| 44 | 43 |
| 45 m.postTranslate(0, 150); | 44 m.postTranslate(0, 150); |
| 46 canvas->drawDrawable(drawable, &m); | 45 canvas->drawDrawable(drawable, &m); |
| 47 } | 46 } |
| OLD | NEW |