OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2011 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef _SkTestImageFilters_h | |
9 #define _SkTestImageFilters_h | |
10 | |
11 #include "SkImageFilter.h" | |
12 #include "SkPoint.h" | |
13 | |
14 // Fun mode that scales down (only) and then scales back up to look pixelated | |
15 class SK_API SkDownSampleImageFilter : public SkImageFilter { | |
16 public: | |
17 static sk_sp<SkImageFilter> Make(SkScalar scale, sk_sp<SkImageFilter> input)
; | |
18 | |
19 SK_TO_STRING_OVERRIDE() | |
20 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter) | |
21 | |
22 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR | |
23 static SkImageFilter* Create(SkScalar scale, SkImageFilter* input = nullptr)
{ | |
24 return Make(scale, sk_ref_sp<SkImageFilter>(input)).release(); | |
25 } | |
26 #endif | |
27 | |
28 protected: | |
29 void flatten(SkWriteBuffer&) const override; | |
30 | |
31 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, | |
32 SkIPoint* offset) const override; | |
33 | |
34 private: | |
35 SkDownSampleImageFilter(SkScalar scale, sk_sp<SkImageFilter> input) | |
36 : INHERITED(&input, 1, nullptr), fScale(scale) {} | |
37 | |
38 SkScalar fScale; | |
39 | |
40 typedef SkImageFilter INHERITED; | |
41 }; | |
42 | |
43 #endif | |
OLD | NEW |