OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkRandom.h" | 9 #include "SkRandom.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 paint->setStrokeWidth(width); | 40 paint->setStrokeWidth(width); |
41 paint->setAlpha(0xFF); | 41 paint->setAlpha(0xFF); |
42 } | 42 } |
43 | 43 |
44 class BeziersGM : public skiagm::GM { | 44 class BeziersGM : public skiagm::GM { |
45 public: | 45 public: |
46 BeziersGM() {} | 46 BeziersGM() {} |
47 | 47 |
48 protected: | 48 protected: |
49 | 49 |
50 SkString onShortName() SK_OVERRIDE { | 50 SkString onShortName() override { |
51 return SkString("beziers"); | 51 return SkString("beziers"); |
52 } | 52 } |
53 | 53 |
54 SkISize onISize() SK_OVERRIDE { | 54 SkISize onISize() override { |
55 return SkISize::Make(W, H*2); | 55 return SkISize::Make(W, H*2); |
56 } | 56 } |
57 | 57 |
58 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 58 void onDraw(SkCanvas* canvas) override { |
59 SkPaint paint; | 59 SkPaint paint; |
60 paint.setStyle(SkPaint::kStroke_Style); | 60 paint.setStyle(SkPaint::kStroke_Style); |
61 paint.setStrokeWidth(SkIntToScalar(9)/2); | 61 paint.setStrokeWidth(SkIntToScalar(9)/2); |
62 paint.setAntiAlias(true); | 62 paint.setAntiAlias(true); |
63 | 63 |
64 SkRandom rand; | 64 SkRandom rand; |
65 for (int i = 0; i < N; i++) { | 65 for (int i = 0; i < N; i++) { |
66 SkPath p; | 66 SkPath p; |
67 rnd_quad(&p, &paint, rand); | 67 rnd_quad(&p, &paint, rand); |
68 canvas->drawPath(p, paint); | 68 canvas->drawPath(p, paint); |
69 } | 69 } |
70 canvas->translate(0, SH); | 70 canvas->translate(0, SH); |
71 for (int i = 0; i < N; i++) { | 71 for (int i = 0; i < N; i++) { |
72 SkPath p; | 72 SkPath p; |
73 rnd_cubic(&p, &paint, rand); | 73 rnd_cubic(&p, &paint, rand); |
74 canvas->drawPath(p, paint); | 74 canvas->drawPath(p, paint); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 private: | 78 private: |
79 typedef skiagm::GM INHERITED; | 79 typedef skiagm::GM INHERITED; |
80 }; | 80 }; |
81 | 81 |
82 static skiagm::GM* F0(void*) { return new BeziersGM; } | 82 static skiagm::GM* F0(void*) { return new BeziersGM; } |
83 static skiagm::GMRegistry R0(F0); | 83 static skiagm::GMRegistry R0(F0); |
OLD | NEW |