| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkMagnifierImageFilter.h" | 9 #include "SkMagnifierImageFilter.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| 11 | 11 |
| 12 #define WIDTH 500 | 12 #define WIDTH 500 |
| 13 #define HEIGHT 500 | 13 #define HEIGHT 500 |
| 14 | 14 |
| 15 namespace skiagm { | 15 namespace skiagm { |
| 16 | 16 |
| 17 class ImageMagnifierGM : public GM { | 17 class ImageMagnifierGM : public GM { |
| 18 public: | 18 public: |
| 19 ImageMagnifierGM() { | 19 ImageMagnifierGM() { |
| 20 this->setBGColor(0xFF000000); | 20 this->setBGColor(0xFF000000); |
| 21 } | 21 } |
| 22 | 22 |
| 23 protected: | 23 protected: |
| 24 | 24 |
| 25 SkString onShortName() SK_OVERRIDE { | 25 SkString onShortName() override { |
| 26 return SkString("imagemagnifier"); | 26 return SkString("imagemagnifier"); |
| 27 } | 27 } |
| 28 | 28 |
| 29 SkISize onISize() SK_OVERRIDE { | 29 SkISize onISize() override { |
| 30 return SkISize::Make(WIDTH, HEIGHT); | 30 return SkISize::Make(WIDTH, HEIGHT); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 33 void onDraw(SkCanvas* canvas) override { |
| 34 SkPaint filterPaint; | 34 SkPaint filterPaint; |
| 35 filterPaint.setImageFilter( | 35 filterPaint.setImageFilter( |
| 36 SkMagnifierImageFilter::Create( | 36 SkMagnifierImageFilter::Create( |
| 37 SkRect::MakeXYWH(SkIntToScalar(100), SkIntToScalar(100), | 37 SkRect::MakeXYWH(SkIntToScalar(100), SkIntToScalar(100), |
| 38 SkIntToScalar(WIDTH / 2), | 38 SkIntToScalar(WIDTH / 2), |
| 39 SkIntToScalar(HEIGHT / 2)), | 39 SkIntToScalar(HEIGHT / 2)), |
| 40 100))->unref(); | 40 100))->unref(); |
| 41 canvas->saveLayer(NULL, &filterPaint); | 41 canvas->saveLayer(NULL, &filterPaint); |
| 42 const char* str = "The quick brown fox jumped over the lazy dog."; | 42 const char* str = "The quick brown fox jumped over the lazy dog."; |
| 43 SkRandom rand; | 43 SkRandom rand; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 58 private: | 58 private: |
| 59 typedef GM INHERITED; | 59 typedef GM INHERITED; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 ////////////////////////////////////////////////////////////////////////////// | 62 ////////////////////////////////////////////////////////////////////////////// |
| 63 | 63 |
| 64 static GM* MyFactory(void*) { return new ImageMagnifierGM; } | 64 static GM* MyFactory(void*) { return new ImageMagnifierGM; } |
| 65 static GMRegistry reg(MyFactory); | 65 static GMRegistry reg(MyFactory); |
| 66 | 66 |
| 67 } | 67 } |
| OLD | NEW |