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 #ifndef SkMergeImageFilter_DEFINED | 8 #ifndef SkMergeImageFilter_DEFINED |
9 #define SkMergeImageFilter_DEFINED | 9 #define SkMergeImageFilter_DEFINED |
10 | 10 |
11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
12 | 12 |
13 #include "SkXfermode.h" | 13 #include "SkXfermode.h" |
14 | 14 |
15 class SK_API SkMergeImageFilter : public SkImageFilter { | 15 class SK_API SkMergeImageFilter : public SkImageFilter { |
16 public: | 16 public: |
17 SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second, | |
18 SkXfermode::Mode = SkXfermode::kSrcOver_Mode, | |
19 const CropRect* cropRect = NULL); | |
20 SkMergeImageFilter(SkImageFilter* filters[], int count, | |
21 const SkXfermode::Mode modes[] = NULL, | |
22 const CropRect* cropRect = NULL); | |
23 virtual ~SkMergeImageFilter(); | 17 virtual ~SkMergeImageFilter(); |
24 | 18 |
| 19 static SkMergeImageFilter* Create(SkImageFilter* first, SkImageFilter* secon
d, |
| 20 SkXfermode::Mode mode = SkXfermode::kSrcOv
er_Mode, |
| 21 const CropRect* cropRect = NULL) { |
| 22 return SkNEW_ARGS(SkMergeImageFilter, (first, second, mode, cropRect)); |
| 23 } |
| 24 static SkMergeImageFilter* Create(SkImageFilter* filters[], int count, |
| 25 const SkXfermode::Mode modes[] = NULL, |
| 26 const CropRect* cropRect = NULL) { |
| 27 return SkNEW_ARGS(SkMergeImageFilter, (filters, count, modes, cropRect))
; |
| 28 } |
| 29 |
25 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter) | 30 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter) |
26 | 31 |
27 protected: | 32 protected: |
28 SkMergeImageFilter(SkReadBuffer& buffer); | 33 SkMergeImageFilter(SkReadBuffer& buffer); |
29 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 34 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
30 | 35 |
31 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 36 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
32 SkBitmap* result, SkIPoint* loc) const SK_OVERRID
E; | 37 SkBitmap* result, SkIPoint* loc) const SK_OVERRID
E; |
| 38 |
| 39 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS |
| 40 public: |
| 41 #endif |
| 42 SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second, |
| 43 SkXfermode::Mode = SkXfermode::kSrcOver_Mode, |
| 44 const CropRect* cropRect = NULL); |
| 45 SkMergeImageFilter(SkImageFilter* filters[], int count, |
| 46 const SkXfermode::Mode modes[] = NULL, |
| 47 const CropRect* cropRect = NULL); |
33 private: | 48 private: |
34 uint8_t* fModes; // SkXfermode::Mode | 49 uint8_t* fModes; // SkXfermode::Mode |
35 | 50 |
36 // private storage, to avoid dynamically allocating storage for our copy | 51 // private storage, to avoid dynamically allocating storage for our copy |
37 // of the modes (unless the count is so large we can't fit). | 52 // of the modes (unless the count is so large we can't fit). |
38 intptr_t fStorage[16]; | 53 intptr_t fStorage[16]; |
39 | 54 |
40 void initAllocModes(); | 55 void initAllocModes(); |
41 void initModes(const SkXfermode::Mode []); | 56 void initModes(const SkXfermode::Mode []); |
42 | 57 |
43 typedef SkImageFilter INHERITED; | 58 typedef SkImageFilter INHERITED; |
44 }; | 59 }; |
45 | 60 |
46 #endif | 61 #endif |
OLD | NEW |