OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Intel Inc. | 3 * Copyright 2012 Intel 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 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkBlurDrawLooper.h" | 9 #include "SkBlurDrawLooper.h" |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
11 #include "SkBlurMaskFilter.h" | 11 #include "SkBlurMaskFilter.h" |
12 #include "SkGradientShader.h" | 12 #include "SkGradientShader.h" |
13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
14 #include "SkRandom.h" | 14 #include "SkRandom.h" |
15 #include "SkTArray.h" | 15 #include "SkTArray.h" |
16 | 16 |
17 namespace skiagm { | 17 namespace skiagm { |
18 | 18 |
19 class CircleGM : public GM { | 19 class CircleGM : public GM { |
20 public: | 20 public: |
21 CircleGM() { | 21 CircleGM() { |
22 this->setBGColor(0xFF000000); | 22 this->setBGColor(0xFF000000); |
23 this->makePaints(); | 23 this->makePaints(); |
24 this->makeMatrices(); | 24 this->makeMatrices(); |
25 } | 25 } |
26 | 26 |
27 protected: | 27 protected: |
28 | 28 |
29 SkString onShortName() SK_OVERRIDE { | 29 SkString onShortName() override { |
30 return SkString("circles"); | 30 return SkString("circles"); |
31 } | 31 } |
32 | 32 |
33 SkISize onISize() SK_OVERRIDE { | 33 SkISize onISize() override { |
34 return SkISize::Make(1200, 900); | 34 return SkISize::Make(1200, 900); |
35 } | 35 } |
36 | 36 |
37 void makePaints() { | 37 void makePaints() { |
38 { | 38 { |
39 // no AA | 39 // no AA |
40 SkPaint p; | 40 SkPaint p; |
41 fPaints.push_back(p); | 41 fPaints.push_back(p); |
42 } | 42 } |
43 | 43 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 fMatrices.push_back(m); | 145 fMatrices.push_back(m); |
146 } | 146 } |
147 | 147 |
148 { | 148 { |
149 SkMatrix m; | 149 SkMatrix m; |
150 m.setRotate(SkIntToScalar(30)); | 150 m.setRotate(SkIntToScalar(30)); |
151 fMatrices.push_back(m); | 151 fMatrices.push_back(m); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 155 void onDraw(SkCanvas* canvas) override { |
156 // Draw a giant AA circle as the background. | 156 // Draw a giant AA circle as the background. |
157 SkISize size = this->getISize(); | 157 SkISize size = this->getISize(); |
158 SkScalar giantRadius = SkTMin(SkIntToScalar(size.fWidth), | 158 SkScalar giantRadius = SkTMin(SkIntToScalar(size.fWidth), |
159 SkIntToScalar(size.fHeight)) / 2.f; | 159 SkIntToScalar(size.fHeight)) / 2.f; |
160 SkPoint giantCenter = SkPoint::Make(SkIntToScalar(size.fWidth/2), | 160 SkPoint giantCenter = SkPoint::Make(SkIntToScalar(size.fWidth/2), |
161 SkIntToScalar(size.fHeight/2)); | 161 SkIntToScalar(size.fHeight/2)); |
162 SkPaint giantPaint; | 162 SkPaint giantPaint; |
163 giantPaint.setAntiAlias(true); | 163 giantPaint.setAntiAlias(true); |
164 giantPaint.setColor(0x80808080); | 164 giantPaint.setColor(0x80808080); |
165 canvas->drawCircle(giantCenter.fX, giantCenter.fY, giantRadius, giantPai
nt); | 165 canvas->drawCircle(giantCenter.fX, giantCenter.fY, giantRadius, giantPai
nt); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 SkTArray<SkPaint> fPaints; | 210 SkTArray<SkPaint> fPaints; |
211 SkTArray<SkMatrix> fMatrices; | 211 SkTArray<SkMatrix> fMatrices; |
212 }; | 212 }; |
213 | 213 |
214 ////////////////////////////////////////////////////////////////////////////// | 214 ////////////////////////////////////////////////////////////////////////////// |
215 | 215 |
216 static GM* MyFactory(void*) { return new CircleGM; } | 216 static GM* MyFactory(void*) { return new CircleGM; } |
217 static GMRegistry reg(MyFactory); | 217 static GMRegistry reg(MyFactory); |
218 | 218 |
219 } | 219 } |
OLD | NEW |