Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: include/effects/SkXfermodeImageFilter.h

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/effects/SkArithmeticMode.h ('k') | public.bzl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, SkImageFilter* back ground,
dogben 2016/04/01 20:08:52 Shouldn't this accept background and foreground as
reed1 2016/04/02 14:26:56 Indeed. Subsequent changes will fix those. Since (
robertphillips 2016/04/03 18:26:46 Yep - I'm slowly churning my way through all the I
25 SkImageFilter* foreground, const CropRect* cropRect);
26 static sk_sp<SkImageFilter> Make(sk_sp<SkXfermode> mode, SkImageFilter* back ground) {
27 return Make(std::move(mode), background, nullptr, nullptr);
28 }
29 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR
24 static SkImageFilter* Create(SkXfermode* mode, SkImageFilter* background, 30 static SkImageFilter* Create(SkXfermode* mode, SkImageFilter* background,
25 SkImageFilter* foreground = NULL, 31 SkImageFilter* foreground = NULL,
26 const CropRect* cropRect = NULL) { 32 const CropRect* cropRect = NULL) {
27 SkImageFilter* inputs[2] = { background, foreground }; 33 return Make(sk_ref_sp(mode), background, foreground, cropRect).release() ;
28 return new SkXfermodeImageFilter(mode, inputs, cropRect);
29 } 34 }
30 35 #endif
36
31 SK_TO_STRING_OVERRIDE() 37 SK_TO_STRING_OVERRIDE()
32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter) 38 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter)
33 39
34 bool onFilterImageDeprecated(Proxy* proxy, 40 bool onFilterImageDeprecated(Proxy* proxy,
35 const SkBitmap& src, 41 const SkBitmap& src,
36 const Context& ctx, 42 const Context& ctx,
37 SkBitmap* dst, 43 SkBitmap* dst,
38 SkIPoint* offset) const override; 44 SkIPoint* offset) const override;
39 #if SK_SUPPORT_GPU 45 #if SK_SUPPORT_GPU
40 bool canFilterImageGPU() const override; 46 bool canFilterImageGPU() const override;
41 bool filterImageGPUDeprecated(Proxy* proxy, const SkBitmap& src, const Conte xt& ctx, 47 bool filterImageGPUDeprecated(Proxy* proxy, const SkBitmap& src, const Conte xt& ctx,
42 SkBitmap* result, SkIPoint* offset) const over ride; 48 SkBitmap* result, SkIPoint* offset) const over ride;
43 #endif 49 #endif
44 50
45 protected: 51 protected:
46 SkXfermodeImageFilter(SkXfermode* mode, SkImageFilter* inputs[2], 52 SkXfermodeImageFilter(sk_sp<SkXfermode> mode, SkImageFilter* inputs[2],
47 const CropRect* cropRect); 53 const CropRect* cropRect);
48 void flatten(SkWriteBuffer&) const override; 54 void flatten(SkWriteBuffer&) const override;
49 55
50 private: 56 private:
51 SkAutoTUnref<SkXfermode> fMode; 57 sk_sp<SkXfermode> fMode;
52 typedef SkImageFilter INHERITED; 58 typedef SkImageFilter INHERITED;
53 }; 59 };
54 60
55 #endif 61 #endif
OLDNEW
« no previous file with comments | « include/effects/SkArithmeticMode.h ('k') | public.bzl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698