| 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; | |
| 14 class SkXfermode; | 13 class SkXfermode; |
| 15 | 14 |
| 16 class SK_API SkXfermodeImageFilter : public SkImageFilter { | 15 class SK_API SkXfermodeImageFilter : public SkImageFilter { |
| 17 /** | 16 /** |
| 18 * This filter takes an xfermode, and uses it to composite the foreground | 17 * This filter takes an xfermode, and uses it to composite the foreground |
| 19 * over the background. If foreground or background is NULL, the input | 18 * over the background. If foreground or background is NULL, the input |
| 20 * bitmap (src) is used instead. | 19 * bitmap (src) is used instead. |
| 21 */ | 20 */ |
| 22 | 21 |
| 23 public: | 22 public: |
| 24 virtual ~SkXfermodeImageFilter(); | 23 virtual ~SkXfermodeImageFilter(); |
| 25 | 24 |
| 26 static SkXfermodeImageFilter* Create(SkXfermode* mode, SkImageFilter* backgr
ound, | 25 static SkXfermodeImageFilter* Create(SkXfermode* mode, SkImageFilter* backgr
ound, |
| 27 SkImageFilter* foreground = NULL, | 26 SkImageFilter* foreground = NULL, |
| 28 const CropRect* cropRect = NULL) { | 27 const CropRect* cropRect = NULL) { |
| 29 SkImageFilter* inputs[2] = { background, foreground }; | 28 SkImageFilter* inputs[2] = { background, foreground }; |
| 30 return SkNEW_ARGS(SkXfermodeImageFilter, (mode, inputs, cropRect)); | 29 return SkNEW_ARGS(SkXfermodeImageFilter, (mode, inputs, cropRect)); |
| 31 } | 30 } |
| 32 | 31 |
| 33 SK_TO_STRING_OVERRIDE() | 32 SK_TO_STRING_OVERRIDE() |
| 34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter) | 33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter) |
| 35 | 34 |
| 36 virtual bool onFilterImage(Proxy* proxy, | 35 virtual bool onFilterImage(Proxy* proxy, |
| 37 const SkBitmap& src, | 36 const SkImage* src, |
| 38 const Context& ctx, | 37 const Context& ctx, |
| 39 SkBitmap* dst, | 38 SkAutoTUnref<const SkImage>& dst, |
| 40 SkIPoint* offset) const SK_OVERRIDE; | 39 SkIPoint* offset) const SK_OVERRIDE; |
| 41 #if SK_SUPPORT_GPU | 40 #if SK_SUPPORT_GPU |
| 42 bool canFilterImageGPU() const SK_OVERRIDE; | 41 bool canFilterImageGPU() const SK_OVERRIDE; |
| 43 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context
& ctx, | 42 virtual bool filterImageGPU(Proxy* proxy, const SkImage* src, const Context&
ctx, |
| 44 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; | 43 SkAutoTUnref<const SkImage>& result, SkIPoint* o
ffset) const SK_OVERRIDE; |
| 45 #endif | 44 #endif |
| 46 | 45 |
| 47 protected: | 46 protected: |
| 48 SkXfermodeImageFilter(SkXfermode* mode, SkImageFilter* inputs[2], | 47 SkXfermodeImageFilter(SkXfermode* mode, SkImageFilter* inputs[2], |
| 49 const CropRect* cropRect); | 48 const CropRect* cropRect); |
| 50 void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 49 void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 SkXfermode* fMode; | 52 SkXfermode* fMode; |
| 54 typedef SkImageFilter INHERITED; | 53 typedef SkImageFilter INHERITED; |
| 55 }; | 54 }; |
| 56 | 55 |
| 57 #endif | 56 #endif |
| OLD | NEW |