OLD | NEW |
1 #ifndef _SkTestImageFilters_h | 1 #ifndef _SkTestImageFilters_h |
2 #define _SkTestImageFilters_h | 2 #define _SkTestImageFilters_h |
3 | 3 |
4 #include "SkImageFilter.h" | 4 #include "SkImageFilter.h" |
5 #include "SkPoint.h" | 5 #include "SkPoint.h" |
6 | 6 |
7 // Fun mode that scales down (only) and then scales back up to look pixelated | 7 // Fun mode that scales down (only) and then scales back up to look pixelated |
8 class SK_API SkDownSampleImageFilter : public SkImageFilter { | 8 class SK_API SkDownSampleImageFilter : public SkImageFilter { |
9 public: | 9 public: |
10 SkDownSampleImageFilter(SkScalar scale) : INHERITED(0), fScale(scale) {} | 10 static SkDownSampleImageFilter* Create(SkScalar scale) { |
| 11 return SkNEW_ARGS(SkDownSampleImageFilter, (scale)); |
| 12 } |
11 | 13 |
12 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter) | 14 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter) |
13 | 15 |
14 protected: | 16 protected: |
| 17 SkDownSampleImageFilter(SkScalar scale) : INHERITED(0), fScale(scale) {} |
15 SkDownSampleImageFilter(SkReadBuffer& buffer); | 18 SkDownSampleImageFilter(SkReadBuffer& buffer); |
16 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 19 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
17 | 20 |
18 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 21 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
19 SkBitmap* result, SkIPoint* loc) const SK_OVERRID
E; | 22 SkBitmap* result, SkIPoint* loc) const SK_OVERRID
E; |
20 | 23 |
21 private: | 24 private: |
22 SkScalar fScale; | 25 SkScalar fScale; |
23 | 26 |
24 typedef SkImageFilter INHERITED; | 27 typedef SkImageFilter INHERITED; |
25 }; | 28 }; |
26 | 29 |
27 #endif | 30 #endif |
OLD | NEW |