| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "gm.h" | 9 #include "gm.h" |
| 10 #include "SkTArray.h" | 10 #include "SkTArray.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class RoundRectGM : public GM { | 21 class RoundRectGM : public GM { |
| 22 public: | 22 public: |
| 23 RoundRectGM() { | 23 RoundRectGM() { |
| 24 this->setBGColor(0xFF000000); | 24 this->setBGColor(0xFF000000); |
| 25 this->makePaints(); | 25 this->makePaints(); |
| 26 this->makeMatrices(); | 26 this->makeMatrices(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 | 30 |
| 31 SkString onShortName() SK_OVERRIDE { | 31 SkString onShortName() override { |
| 32 return SkString("roundrects"); | 32 return SkString("roundrects"); |
| 33 } | 33 } |
| 34 | 34 |
| 35 SkISize onISize() SK_OVERRIDE { | 35 SkISize onISize() override { |
| 36 return SkISize::Make(1200, 900); | 36 return SkISize::Make(1200, 900); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void makePaints() { | 39 void makePaints() { |
| 40 { | 40 { |
| 41 // no AA | 41 // no AA |
| 42 SkPaint p; | 42 SkPaint p; |
| 43 fPaints.push_back(p); | 43 fPaints.push_back(p); |
| 44 } | 44 } |
| 45 | 45 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 SkColor genColor(SkRandom* rand) { | 130 SkColor genColor(SkRandom* rand) { |
| 131 SkScalar hsv[3]; | 131 SkScalar hsv[3]; |
| 132 hsv[0] = rand->nextRangeF(0.0f, 360.0f); | 132 hsv[0] = rand->nextRangeF(0.0f, 360.0f); |
| 133 hsv[1] = rand->nextRangeF(0.75f, 1.0f); | 133 hsv[1] = rand->nextRangeF(0.75f, 1.0f); |
| 134 hsv[2] = rand->nextRangeF(0.75f, 1.0f); | 134 hsv[2] = rand->nextRangeF(0.75f, 1.0f); |
| 135 | 135 |
| 136 return SkHSVToColor(hsv); | 136 return SkHSVToColor(hsv); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 139 void onDraw(SkCanvas* canvas) override { |
| 140 SkRandom rand(1); | 140 SkRandom rand(1); |
| 141 canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); | 141 canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); |
| 142 SkRect rect = SkRect::MakeLTRB(-20, -30, 20, 30); | 142 SkRect rect = SkRect::MakeLTRB(-20, -30, 20, 30); |
| 143 SkRRect circleRect; | 143 SkRRect circleRect; |
| 144 circleRect.setRectXY(rect, 5, 5); | 144 circleRect.setRectXY(rect, 5, 5); |
| 145 | 145 |
| 146 const SkScalar kXStart = 60.0f; | 146 const SkScalar kXStart = 60.0f; |
| 147 const SkScalar kYStart = 80.0f; | 147 const SkScalar kYStart = 80.0f; |
| 148 const int kXStep = 150; | 148 const int kXStep = 150; |
| 149 const int kYStep = 160; | 149 const int kYStep = 160; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 331 |
| 332 typedef GM INHERITED; | 332 typedef GM INHERITED; |
| 333 }; | 333 }; |
| 334 | 334 |
| 335 ////////////////////////////////////////////////////////////////////////////// | 335 ////////////////////////////////////////////////////////////////////////////// |
| 336 | 336 |
| 337 static GM* MyFactory(void*) { return new RoundRectGM; } | 337 static GM* MyFactory(void*) { return new RoundRectGM; } |
| 338 static GMRegistry reg(MyFactory); | 338 static GMRegistry reg(MyFactory); |
| 339 | 339 |
| 340 } | 340 } |
| OLD | NEW |