OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkDrawFilter.h" | 12 #include "SkDrawFilter.h" |
13 #include "SkPaint.h" | 13 #include "SkPaint.h" |
14 | 14 |
15 /** | 15 /** |
16 * Initial test coverage for SkDrawFilter. | 16 * Initial test coverage for SkDrawFilter. |
17 * Draws two rectangles; if draw filters are broken, they will match. | 17 * Draws two rectangles; if draw filters are broken, they will match. |
18 * If draw filters are working correctly, the first will be blue and blurred, | 18 * If draw filters are working correctly, the first will be blue and blurred, |
19 * the second red and sharp. | 19 * the second red and sharp. |
20 */ | 20 */ |
21 | 21 |
| 22 namespace { |
22 class TestFilter : public SkDrawFilter { | 23 class TestFilter : public SkDrawFilter { |
23 public: | 24 public: |
24 bool filter(SkPaint* p, Type) override { | 25 bool filter(SkPaint* p, Type) override { |
25 p->setColor(SK_ColorRED); | 26 p->setColor(SK_ColorRED); |
26 p->setMaskFilter(NULL); | 27 p->setMaskFilter(NULL); |
27 return true; | 28 return true; |
28 } | 29 } |
29 }; | 30 }; |
| 31 } |
30 | 32 |
31 class DrawFilterGM : public skiagm::GM { | 33 class DrawFilterGM : public skiagm::GM { |
32 SkAutoTUnref<SkMaskFilter> fBlur; | 34 SkAutoTUnref<SkMaskFilter> fBlur; |
33 | 35 |
34 protected: | 36 protected: |
35 SkISize onISize() override { | 37 SkISize onISize() override { |
36 return SkISize::Make(320, 240); | 38 return SkISize::Make(320, 240); |
37 } | 39 } |
38 | 40 |
39 SkString onShortName() override { | 41 SkString onShortName() override { |
(...skipping 22 matching lines...) Expand all Loading... |
62 canvas->setDrawFilter(NULL); | 64 canvas->setDrawFilter(NULL); |
63 } | 65 } |
64 | 66 |
65 private: | 67 private: |
66 typedef GM INHERITED; | 68 typedef GM INHERITED; |
67 }; | 69 }; |
68 | 70 |
69 static skiagm::GM* MyFactory(void*) { return new DrawFilterGM; } | 71 static skiagm::GM* MyFactory(void*) { return new DrawFilterGM; } |
70 static skiagm::GMRegistry reg(MyFactory); | 72 static skiagm::GMRegistry reg(MyFactory); |
71 | 73 |
OLD | NEW |