| 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 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 28 uint32_t onGetFlags() const SK_OVERRIDE { |
| 29 return kSkipTiled_Flag; | 29 return kSkipTiled_Flag; |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual SkString onShortName() SK_OVERRIDE { | 32 SkString onShortName() SK_OVERRIDE { |
| 33 return SkString("circles"); | 33 return SkString("circles"); |
| 34 } | 34 } |
| 35 | 35 |
| 36 virtual SkISize onISize() SK_OVERRIDE { | 36 SkISize onISize() SK_OVERRIDE { |
| 37 return SkISize::Make(1200, 900); | 37 return SkISize::Make(1200, 900); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void makePaints() { | 40 void makePaints() { |
| 41 { | 41 { |
| 42 // no AA | 42 // no AA |
| 43 SkPaint p; | 43 SkPaint p; |
| 44 fPaints.push_back(p); | 44 fPaints.push_back(p); |
| 45 } | 45 } |
| 46 | 46 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 fMatrices.push_back(m); | 148 fMatrices.push_back(m); |
| 149 } | 149 } |
| 150 | 150 |
| 151 { | 151 { |
| 152 SkMatrix m; | 152 SkMatrix m; |
| 153 m.setRotate(SkIntToScalar(30)); | 153 m.setRotate(SkIntToScalar(30)); |
| 154 fMatrices.push_back(m); | 154 fMatrices.push_back(m); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 158 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 159 // Draw a giant AA circle as the background. | 159 // Draw a giant AA circle as the background. |
| 160 SkISize size = this->getISize(); | 160 SkISize size = this->getISize(); |
| 161 SkScalar giantRadius = SkTMin(SkIntToScalar(size.fWidth), | 161 SkScalar giantRadius = SkTMin(SkIntToScalar(size.fWidth), |
| 162 SkIntToScalar(size.fHeight)) / 2.f; | 162 SkIntToScalar(size.fHeight)) / 2.f; |
| 163 SkPoint giantCenter = SkPoint::Make(SkIntToScalar(size.fWidth/2), | 163 SkPoint giantCenter = SkPoint::Make(SkIntToScalar(size.fWidth/2), |
| 164 SkIntToScalar(size.fHeight/2)); | 164 SkIntToScalar(size.fHeight/2)); |
| 165 SkPaint giantPaint; | 165 SkPaint giantPaint; |
| 166 giantPaint.setAntiAlias(true); | 166 giantPaint.setAntiAlias(true); |
| 167 giantPaint.setColor(0x80808080); | 167 giantPaint.setColor(0x80808080); |
| 168 canvas->drawCircle(giantCenter.fX, giantCenter.fY, giantRadius, giantPai
nt); | 168 canvas->drawCircle(giantCenter.fX, giantCenter.fY, giantRadius, giantPai
nt); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 SkTArray<SkPaint> fPaints; | 213 SkTArray<SkPaint> fPaints; |
| 214 SkTArray<SkMatrix> fMatrices; | 214 SkTArray<SkMatrix> fMatrices; |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 ////////////////////////////////////////////////////////////////////////////// | 217 ////////////////////////////////////////////////////////////////////////////// |
| 218 | 218 |
| 219 static GM* MyFactory(void*) { return new CircleGM; } | 219 static GM* MyFactory(void*) { return new CircleGM; } |
| 220 static GMRegistry reg(MyFactory); | 220 static GMRegistry reg(MyFactory); |
| 221 | 221 |
| 222 } | 222 } |
| OLD | NEW |