| 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" |
| 11 #include "SkRandom.h" | 11 #include "SkRandom.h" |
| 12 #include "SkMatrix.h" | 12 #include "SkMatrix.h" |
| 13 #include "SkBlurMaskFilter.h" | 13 #include "SkBlurMaskFilter.h" |
| 14 #include "SkGradientShader.h" | 14 #include "SkGradientShader.h" |
| 15 #include "SkBlurDrawLooper.h" | 15 #include "SkBlurDrawLooper.h" |
| 16 #include "SkRect.h" | 16 #include "SkRect.h" |
| 17 | 17 |
| 18 namespace skiagm { | 18 namespace skiagm { |
| 19 | 19 |
| 20 class OvalGM : public GM { | 20 class OvalGM : public GM { |
| 21 public: | 21 public: |
| 22 OvalGM() { | 22 OvalGM() { |
| 23 this->setBGColor(0xFF000000); | 23 this->setBGColor(0xFF000000); |
| 24 this->makePaints(); | 24 this->makePaints(); |
| 25 this->makeMatrices(); | 25 this->makeMatrices(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 protected: | 28 protected: |
| 29 | 29 |
| 30 SkString onShortName() SK_OVERRIDE { | 30 SkString onShortName() override { |
| 31 return SkString("ovals"); | 31 return SkString("ovals"); |
| 32 } | 32 } |
| 33 | 33 |
| 34 SkISize onISize() SK_OVERRIDE { | 34 SkISize onISize() override { |
| 35 return SkISize::Make(1200, 900); | 35 return SkISize::Make(1200, 900); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void makePaints() { | 38 void makePaints() { |
| 39 { | 39 { |
| 40 // no AA | 40 // no AA |
| 41 SkPaint p; | 41 SkPaint p; |
| 42 fPaints.push_back(p); | 42 fPaints.push_back(p); |
| 43 } | 43 } |
| 44 | 44 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 SkColor genColor(SkRandom* rand) { | 129 SkColor genColor(SkRandom* rand) { |
| 130 SkScalar hsv[3]; | 130 SkScalar hsv[3]; |
| 131 hsv[0] = rand->nextRangeF(0.0f, 360.0f); | 131 hsv[0] = rand->nextRangeF(0.0f, 360.0f); |
| 132 hsv[1] = rand->nextRangeF(0.75f, 1.0f); | 132 hsv[1] = rand->nextRangeF(0.75f, 1.0f); |
| 133 hsv[2] = rand->nextRangeF(0.75f, 1.0f); | 133 hsv[2] = rand->nextRangeF(0.75f, 1.0f); |
| 134 | 134 |
| 135 return SkHSVToColor(hsv); | 135 return SkHSVToColor(hsv); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 138 void onDraw(SkCanvas* canvas) override { |
| 139 SkRandom rand(1); | 139 SkRandom rand(1); |
| 140 canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); | 140 canvas->translate(20 * SK_Scalar1, 20 * SK_Scalar1); |
| 141 SkRect oval = SkRect::MakeLTRB(-20, -30, 20, 30); | 141 SkRect oval = SkRect::MakeLTRB(-20, -30, 20, 30); |
| 142 | 142 |
| 143 const SkScalar kXStart = 60.0f; | 143 const SkScalar kXStart = 60.0f; |
| 144 const SkScalar kYStart = 80.0f; | 144 const SkScalar kYStart = 80.0f; |
| 145 const int kXStep = 150; | 145 const int kXStep = 150; |
| 146 const int kYStep = 160; | 146 const int kYStep = 160; |
| 147 int maxX = fMatrices.count(); | 147 int maxX = fMatrices.count(); |
| 148 | 148 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 279 |
| 280 typedef GM INHERITED; | 280 typedef GM INHERITED; |
| 281 }; | 281 }; |
| 282 | 282 |
| 283 ////////////////////////////////////////////////////////////////////////////// | 283 ////////////////////////////////////////////////////////////////////////////// |
| 284 | 284 |
| 285 static GM* MyFactory(void*) { return new OvalGM; } | 285 static GM* MyFactory(void*) { return new OvalGM; } |
| 286 static GMRegistry reg(MyFactory); | 286 static GMRegistry reg(MyFactory); |
| 287 | 287 |
| 288 } | 288 } |
| OLD | NEW |