| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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" |
| 11 | 11 |
| 12 #define WIDTH 640 | 12 #define WIDTH 640 |
| 13 #define HEIGHT 480 | 13 #define HEIGHT 480 |
| 14 | 14 |
| 15 namespace skiagm { | 15 namespace skiagm { |
| 16 | 16 |
| 17 class ImageBlurTiledGM : public GM { | 17 class ImageBlurTiledGM : public GM { |
| 18 public: | 18 public: |
| 19 ImageBlurTiledGM(SkScalar sigmaX, SkScalar sigmaY) | 19 ImageBlurTiledGM(SkScalar sigmaX, SkScalar sigmaY) |
| 20 : fSigmaX(sigmaX), fSigmaY(sigmaY) { | 20 : fSigmaX(sigmaX), fSigmaY(sigmaY) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 protected: | 23 protected: |
| 24 virtual SkString onShortName() { | 24 virtual SkString onShortName() { |
| 25 return SkString("imageblurtiled"); | 25 return SkString("imageblurtiled"); |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual SkISize onISize() { | 28 virtual SkISize onISize() { |
| 29 return make_isize(WIDTH, HEIGHT); | 29 return SkISize::Make(WIDTH, HEIGHT); |
| 30 } | 30 } |
| 31 | 31 |
| 32 virtual void onDraw(SkCanvas* canvas) { | 32 virtual void onDraw(SkCanvas* canvas) { |
| 33 SkPaint paint; | 33 SkPaint paint; |
| 34 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref
(); | 34 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref
(); |
| 35 const SkScalar tile_size = SkIntToScalar(128); | 35 const SkScalar tile_size = SkIntToScalar(128); |
| 36 SkRect bounds; | 36 SkRect bounds; |
| 37 if (!canvas->getClipBounds(&bounds)) { | 37 if (!canvas->getClipBounds(&bounds)) { |
| 38 bounds.setEmpty(); | 38 bounds.setEmpty(); |
| 39 } | 39 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 69 | 69 |
| 70 typedef GM INHERITED; | 70 typedef GM INHERITED; |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 ////////////////////////////////////////////////////////////////////////////// | 73 ////////////////////////////////////////////////////////////////////////////// |
| 74 | 74 |
| 75 static GM* MyFactory1(void*) { return new ImageBlurTiledGM(3.0f, 3.0f); } | 75 static GM* MyFactory1(void*) { return new ImageBlurTiledGM(3.0f, 3.0f); } |
| 76 static GMRegistry reg1(MyFactory1); | 76 static GMRegistry reg1(MyFactory1); |
| 77 | 77 |
| 78 } | 78 } |
| OLD | NEW |