OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
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 | 8 |
9 #ifndef SkMagnifierImageFilter_DEFINED | 9 #ifndef SkMagnifierImageFilter_DEFINED |
10 #define SkMagnifierImageFilter_DEFINED | 10 #define SkMagnifierImageFilter_DEFINED |
11 | 11 |
12 #include "SkRect.h" | 12 #include "SkRect.h" |
13 #include "SkImageFilter.h" | 13 #include "SkImageFilter.h" |
14 | 14 |
15 class SK_API SkMagnifierImageFilter : public SkImageFilter { | 15 class SK_API SkMagnifierImageFilter : public SkImageFilter { |
16 public: | 16 public: |
17 static SkImageFilter* Create(const SkRect& src, SkScalar inset, SkImageFilte
r* input = NULL); | 17 static sk_sp<SkImageFilter> Make(const SkRect& src, SkScalar inset, sk_sp<Sk
ImageFilter> input); |
18 | 18 |
19 SK_TO_STRING_OVERRIDE() | 19 SK_TO_STRING_OVERRIDE() |
20 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter) | 20 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter) |
21 | 21 |
| 22 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR |
| 23 static SkImageFilter* Create(const SkRect& src, SkScalar inset, |
| 24 SkImageFilter* input = nullptr) { |
| 25 return Make(src, inset, sk_ref_sp<SkImageFilter>(input)).release(); |
| 26 } |
| 27 #endif |
| 28 |
22 protected: | 29 protected: |
23 SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset, SkImageFilter*
input); | 30 SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset, sk_sp<SkImageF
ilter> input); |
24 void flatten(SkWriteBuffer&) const override; | 31 void flatten(SkWriteBuffer&) const override; |
25 | 32 |
26 bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&, | 33 bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&, |
27 SkBitmap* result, SkIPoint* offset) const overr
ide; | 34 SkBitmap* result, SkIPoint* offset) const overr
ide; |
28 #if SK_SUPPORT_GPU | 35 #if SK_SUPPORT_GPU |
29 bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&, | 36 bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&, |
30 const SkIRect& bounds) const override; | 37 const SkIRect& bounds) const override; |
31 #endif | 38 #endif |
32 | 39 |
33 private: | 40 private: |
34 SkRect fSrcRect; | 41 SkRect fSrcRect; |
35 SkScalar fInset; | 42 SkScalar fInset; |
36 typedef SkImageFilter INHERITED; | 43 typedef SkImageFilter INHERITED; |
37 }; | 44 }; |
38 | 45 |
39 #endif | 46 #endif |
OLD | NEW |