OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 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 #ifndef SkXfermodeImageFilter_DEFINED | 8 #ifndef SkXfermodeImageFilter_DEFINED |
9 #define SkXfermodeImageFilter_DEFINED | 9 #define SkXfermodeImageFilter_DEFINED |
10 | 10 |
11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
12 | 12 |
13 class SkBitmap; | 13 class SkBitmap; |
14 class SkXfermode; | 14 class SkXfermode; |
15 | 15 |
16 class SK_API SkXfermodeImageFilter : public SkImageFilter { | 16 class SK_API SkXfermodeImageFilter : public SkImageFilter { |
17 /** | 17 /** |
18 * This filter takes an xfermode, and uses it to composite the foreground | 18 * This filter takes an xfermode, and uses it to composite the foreground |
19 * over the background. If foreground or background is NULL, the input | 19 * over the background. If foreground or background is NULL, the input |
20 * bitmap (src) is used instead. | 20 * bitmap (src) is used instead. |
21 */ | 21 */ |
22 | 22 |
23 public: | 23 public: |
24 static sk_sp<SkImageFilter> Make(sk_sp<SkXfermode> mode, sk_sp<SkImageFilter
> background, | 24 static sk_sp<SkImageFilter> Make(sk_sp<SkXfermode> mode, sk_sp<SkImageFilter
> background, |
25 sk_sp<SkImageFilter> foreground, const Crop
Rect* cropRect); | 25 sk_sp<SkImageFilter> foreground, const Crop
Rect* cropRect); |
26 static sk_sp<SkImageFilter> Make(sk_sp<SkXfermode> mode, sk_sp<SkImageFilter
> background) { | 26 static sk_sp<SkImageFilter> Make(sk_sp<SkXfermode> mode, sk_sp<SkImageFilter
> background) { |
27 return Make(std::move(mode), std::move(background), nullptr, nullptr); | 27 return Make(std::move(mode), std::move(background), nullptr, nullptr); |
28 } | 28 } |
29 | 29 |
30 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR | 30 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR |
31 static SkImageFilter* Create(SkXfermode* mode, SkImageFilter* background, | 31 static SkImageFilter* Create(SkXfermode* mode, SkImageFilter* background, |
(...skipping 14 matching lines...) Expand all Loading... |
46 cropRect); | 46 cropRect); |
47 } | 47 } |
48 static sk_sp<SkImageFilter> Make(sk_sp<SkXfermode> mode, SkImageFilter* back
ground) { | 48 static sk_sp<SkImageFilter> Make(sk_sp<SkXfermode> mode, SkImageFilter* back
ground) { |
49 return Make(std::move(mode), sk_ref_sp(background)); | 49 return Make(std::move(mode), sk_ref_sp(background)); |
50 } | 50 } |
51 #endif | 51 #endif |
52 | 52 |
53 SK_TO_STRING_OVERRIDE() | 53 SK_TO_STRING_OVERRIDE() |
54 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter) | 54 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter) |
55 | 55 |
56 bool onFilterImageDeprecated(Proxy* proxy, | 56 protected: |
57 const SkBitmap& src, | 57 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, |
58 const Context& ctx, | 58 SkIPoint* offset) const override; |
59 SkBitmap* dst, | 59 |
60 SkIPoint* offset) const override; | |
61 #if SK_SUPPORT_GPU | 60 #if SK_SUPPORT_GPU |
62 bool canFilterImageGPU() const override; | 61 sk_sp<SkSpecialImage> filterImageGPU(SkSpecialImage* source, |
63 bool filterImageGPUDeprecated(Proxy* proxy, const SkBitmap& src, const Conte
xt& ctx, | 62 sk_sp<SkSpecialImage> background, |
64 SkBitmap* result, SkIPoint* offset) const over
ride; | 63 const SkIPoint& backgroundOffset, |
| 64 sk_sp<SkSpecialImage> foreground, |
| 65 const SkIPoint& foregroundOffset, |
| 66 const SkIRect& bounds) const; |
65 #endif | 67 #endif |
66 | 68 |
67 protected: | |
68 SkXfermodeImageFilter(sk_sp<SkXfermode> mode, sk_sp<SkImageFilter> inputs[2]
, | 69 SkXfermodeImageFilter(sk_sp<SkXfermode> mode, sk_sp<SkImageFilter> inputs[2]
, |
69 const CropRect* cropRect); | 70 const CropRect* cropRect); |
70 void flatten(SkWriteBuffer&) const override; | 71 void flatten(SkWriteBuffer&) const override; |
71 | 72 |
72 private: | 73 private: |
73 sk_sp<SkXfermode> fMode; | 74 sk_sp<SkXfermode> fMode; |
74 typedef SkImageFilter INHERITED; | 75 typedef SkImageFilter INHERITED; |
75 }; | 76 }; |
76 | 77 |
77 #endif | 78 #endif |
OLD | NEW |