| 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 "SkPath.h" | 9 #include "SkPath.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| 11 | 11 |
| 12 #define W 400 | 12 #define W 400 |
| 13 #define H 400 | 13 #define H 400 |
| 14 #define N 10 | 14 #define N 10 |
| 15 | 15 |
| 16 static const SkScalar SH = SkIntToScalar(H); | 16 constexpr SkScalar SH = SkIntToScalar(H); |
| 17 | 17 |
| 18 static void rnd_quad(SkPath* p, SkPaint* paint, SkRandom& rand) { | 18 static void rnd_quad(SkPath* p, SkPaint* paint, SkRandom& rand) { |
| 19 p->moveTo(rand.nextRangeScalar(0, W), rand.nextRangeScalar(0, H)); | 19 p->moveTo(rand.nextRangeScalar(0, W), rand.nextRangeScalar(0, H)); |
| 20 for (int x = 0; x < 2; ++x) { | 20 for (int x = 0; x < 2; ++x) { |
| 21 p->quadTo(rand.nextRangeScalar(W / 4, W), rand.nextRangeScalar(0, H), | 21 p->quadTo(rand.nextRangeScalar(W / 4, W), rand.nextRangeScalar(0, H), |
| 22 rand.nextRangeScalar(0, W), rand.nextRangeScalar(H / 4, H)); | 22 rand.nextRangeScalar(0, W), rand.nextRangeScalar(H / 4, H)); |
| 23 } | 23 } |
| 24 paint->setColor(rand.nextU()); | 24 paint->setColor(rand.nextU()); |
| 25 SkScalar width = rand.nextRangeScalar(1, 5); | 25 SkScalar width = rand.nextRangeScalar(1, 5); |
| 26 width *= width; | 26 width *= width; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 rnd_cubic(&p, &paint, rand); | 74 rnd_cubic(&p, &paint, rand); |
| 75 canvas->drawPath(p, paint); | 75 canvas->drawPath(p, paint); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 typedef skiagm::GM INHERITED; | 80 typedef skiagm::GM INHERITED; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 DEF_GM( return new BeziersGM; ) | 83 DEF_GM( return new BeziersGM; ) |
| OLD | NEW |