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

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

Issue 1861843002: Update DropShadowImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review issues 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 | « gm/imagefilterstransformed.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('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 Google Inc. 2 * Copyright 2013 Google Inc.
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 SkDropShadowImageFilter_DEFINED 8 #ifndef SkDropShadowImageFilter_DEFINED
9 #define SkDropShadowImageFilter_DEFINED 9 #define SkDropShadowImageFilter_DEFINED
10 10
11 #include "SkColor.h" 11 #include "SkColor.h"
12 #include "SkImageFilter.h" 12 #include "SkImageFilter.h"
13 #include "SkScalar.h" 13 #include "SkScalar.h"
14 14
15 class SK_API SkDropShadowImageFilter : public SkImageFilter { 15 class SK_API SkDropShadowImageFilter : public SkImageFilter {
16 public: 16 public:
17 enum ShadowMode { 17 enum ShadowMode {
18 kDrawShadowAndForeground_ShadowMode, 18 kDrawShadowAndForeground_ShadowMode,
19 kDrawShadowOnly_ShadowMode, 19 kDrawShadowOnly_ShadowMode,
20 20
21 kLast_ShadowMode = kDrawShadowOnly_ShadowMode 21 kLast_ShadowMode = kDrawShadowOnly_ShadowMode
22 }; 22 };
23 23
24 static const int kShadowModeCount = kLast_ShadowMode+1; 24 static const int kShadowModeCount = kLast_ShadowMode+1;
25 25
26 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkSc alar sigmaY, 26 static sk_sp<SkImageFilter> Make(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY,
27 SkColor color, ShadowMode shadowMode, SkImageFi lter* input = NULL, 27 SkColor color, ShadowMode shadowMode,
28 const CropRect* cropRect = NULL) { 28 sk_sp<SkImageFilter> input,
29 return new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY, color, shadow Mode, input, 29 const CropRect* cropRect = nullptr) {
30 cropRect); 30 return sk_sp<SkImageFilter>(new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY,
31 color, shadowMod e,
32 std::move(input) ,
33 cropRect));
31 } 34 }
32 35
33 SkRect computeFastBounds(const SkRect&) const override; 36 SkRect computeFastBounds(const SkRect&) const override;
34 SK_TO_STRING_OVERRIDE() 37 SK_TO_STRING_OVERRIDE()
35 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) 38 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter)
36 39
40 #ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
41 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkSc alar sigmaY,
42 SkColor color, ShadowMode shadowMode,
43 SkImageFilter* input = nullptr,
44 const CropRect* cropRect = nullptr) {
45 return Make(dx, dy, sigmaX, sigmaY, color, shadowMode,
46 sk_ref_sp<SkImageFilter>(input), cropRect).release();
47 }
48 #endif
49
37 protected: 50 protected:
38 void flatten(SkWriteBuffer&) const override; 51 void flatten(SkWriteBuffer&) const override;
39 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, 52 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
40 SkIPoint* offset) const override; 53 SkIPoint* offset) const override;
41 SkIRect onFilterNodeBounds(const SkIRect& src, const SkMatrix&, MapDirection ) const override; 54 SkIRect onFilterNodeBounds(const SkIRect& src, const SkMatrix&, MapDirection ) const override;
42 55
43 private: 56 private:
44 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor, 57 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor,
45 ShadowMode shadowMode, SkImageFilter* input, const C ropRect* cropRect); 58 ShadowMode shadowMode, sk_sp<SkImageFilter> input,
59 const CropRect* cropRect);
46 60
47 SkScalar fDx, fDy, fSigmaX, fSigmaY; 61 SkScalar fDx, fDy, fSigmaX, fSigmaY;
48 SkColor fColor; 62 SkColor fColor;
49 ShadowMode fShadowMode; 63 ShadowMode fShadowMode;
50 64
51 typedef SkImageFilter INHERITED; 65 typedef SkImageFilter INHERITED;
52 }; 66 };
53 67
54 #endif 68 #endif
OLDNEW
« no previous file with comments | « gm/imagefilterstransformed.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698