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 virtual ~SkXfermodeImageFilter(); | 24 virtual ~SkXfermodeImageFilter(); |
25 | 25 |
26 static SkXfermodeImageFilter* Create(SkXfermode* mode, SkImageFilter* backgr
ound, | 26 static SkXfermodeImageFilter* Create(SkXfermode* mode, SkImageFilter* backgr
ound, |
27 SkImageFilter* foreground = NULL, | 27 SkImageFilter* foreground = NULL, |
28 const CropRect* cropRect = NULL) { | 28 const CropRect* cropRect = NULL, |
| 29 uint32_t uniqueID = 0) { |
29 SkImageFilter* inputs[2] = { background, foreground }; | 30 SkImageFilter* inputs[2] = { background, foreground }; |
30 return SkNEW_ARGS(SkXfermodeImageFilter, (mode, inputs, cropRect)); | 31 return SkNEW_ARGS(SkXfermodeImageFilter, (mode, inputs, cropRect, unique
ID)); |
31 } | 32 } |
32 | 33 |
33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter) | 34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter) |
34 | 35 |
35 virtual bool onFilterImage(Proxy* proxy, | 36 virtual bool onFilterImage(Proxy* proxy, |
36 const SkBitmap& src, | 37 const SkBitmap& src, |
37 const Context& ctx, | 38 const Context& ctx, |
38 SkBitmap* dst, | 39 SkBitmap* dst, |
39 SkIPoint* offset) const SK_OVERRIDE; | 40 SkIPoint* offset) const SK_OVERRIDE; |
40 #if SK_SUPPORT_GPU | 41 #if SK_SUPPORT_GPU |
41 virtual bool canFilterImageGPU() const SK_OVERRIDE; | 42 virtual bool canFilterImageGPU() const SK_OVERRIDE; |
42 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context
& ctx, | 43 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context
& ctx, |
43 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; | 44 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; |
44 #endif | 45 #endif |
45 | 46 |
46 protected: | 47 protected: |
47 SkXfermodeImageFilter(SkXfermode* mode, SkImageFilter* inputs[2], | 48 SkXfermodeImageFilter(SkXfermode* mode, SkImageFilter* inputs[2], |
48 const CropRect* cropRect); | 49 const CropRect* cropRect, uint32_t uniqueID); |
49 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | 50 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
50 explicit SkXfermodeImageFilter(SkReadBuffer& buffer); | 51 explicit SkXfermodeImageFilter(SkReadBuffer& buffer); |
51 #endif | 52 #endif |
52 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 53 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
53 | 54 |
54 private: | 55 private: |
55 SkXfermode* fMode; | 56 SkXfermode* fMode; |
56 typedef SkImageFilter INHERITED; | 57 typedef SkImageFilter INHERITED; |
57 }; | 58 }; |
58 | 59 |
59 #endif | 60 #endif |
OLD | NEW |