| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 namespace skiagm { | 29 namespace skiagm { |
| 30 | 30 |
| 31 class BlurImageFilter : public GM { | 31 class BlurImageFilter : public GM { |
| 32 public: | 32 public: |
| 33 BlurImageFilter() { | 33 BlurImageFilter() { |
| 34 this->setBGColor(0xFFFFFFFF); | 34 this->setBGColor(0xFFFFFFFF); |
| 35 fName.printf("imageblur2"); | 35 fName.printf("imageblur2"); |
| 36 } | 36 } |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 virtual uint32_t onGetFlags() const SK_OVERRIDE { | 39 uint32_t onGetFlags() const SK_OVERRIDE { |
| 40 return kSkipTiled_Flag; | 40 return kSkipTiled_Flag; |
| 41 } | 41 } |
| 42 | 42 |
| 43 virtual SkString onShortName() SK_OVERRIDE { | 43 SkString onShortName() SK_OVERRIDE { |
| 44 return fName; | 44 return fName; |
| 45 } | 45 } |
| 46 | 46 |
| 47 virtual SkISize onISize() SK_OVERRIDE { | 47 SkISize onISize() SK_OVERRIDE { |
| 48 return SkISize::Make(WIDTH, HEIGHT); | 48 return SkISize::Make(WIDTH, HEIGHT); |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 51 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 52 const int sigmaCount = SK_ARRAY_COUNT(kBlurSigmas); | 52 const int sigmaCount = SK_ARRAY_COUNT(kBlurSigmas); |
| 53 const int testStringCount = SK_ARRAY_COUNT(kTestStrings); | 53 const int testStringCount = SK_ARRAY_COUNT(kTestStrings); |
| 54 SkScalar dx = WIDTH / sigmaCount; | 54 SkScalar dx = WIDTH / sigmaCount; |
| 55 SkScalar dy = HEIGHT / sigmaCount; | 55 SkScalar dy = HEIGHT / sigmaCount; |
| 56 const SkScalar textSize = 12; | 56 const SkScalar textSize = 12; |
| 57 | 57 |
| 58 for (int x = 0; x < sigmaCount; x++) { | 58 for (int x = 0; x < sigmaCount; x++) { |
| 59 SkScalar sigmaX = kBlurSigmas[x]; | 59 SkScalar sigmaX = kBlurSigmas[x]; |
| 60 for (int y = 0; y < sigmaCount; y++) { | 60 for (int y = 0; y < sigmaCount; y++) { |
| 61 SkScalar sigmaY = kBlurSigmas[y]; | 61 SkScalar sigmaY = kBlurSigmas[y]; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 87 | 87 |
| 88 typedef GM INHERITED; | 88 typedef GM INHERITED; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 ////////////////////////////////////////////////////////////////////////////// | 91 ////////////////////////////////////////////////////////////////////////////// |
| 92 | 92 |
| 93 static GM* MyFactory(void*) { return new BlurImageFilter; } | 93 static GM* MyFactory(void*) { return new BlurImageFilter; } |
| 94 static GMRegistry reg(MyFactory); | 94 static GMRegistry reg(MyFactory); |
| 95 | 95 |
| 96 } | 96 } |
| OLD | NEW |