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

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

Issue 1852113003: switch maskfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/core/SkPaint.h ('k') | include/effects/SkBlurMaskFilter.h » ('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 2008 The Android Open Source Project 2 * Copyright 2008 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 8
9 #ifndef SkBlurDrawLooper_DEFINED 9 #ifndef SkBlurDrawLooper_DEFINED
10 #define SkBlurDrawLooper_DEFINED 10 #define SkBlurDrawLooper_DEFINED
(...skipping 28 matching lines...) Expand all
39 uint32_t flags = kNone_BlurFlag) { 39 uint32_t flags = kNone_BlurFlag) {
40 return sk_sp<SkDrawLooper>(new SkBlurDrawLooper(color, sigma, dx, dy, fl ags)); 40 return sk_sp<SkDrawLooper>(new SkBlurDrawLooper(color, sigma, dx, dy, fl ags));
41 } 41 }
42 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR 42 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR
43 static SkDrawLooper* Create(SkColor color, SkScalar sigma, SkScalar dx, SkSc alar dy, 43 static SkDrawLooper* Create(SkColor color, SkScalar sigma, SkScalar dx, SkSc alar dy,
44 uint32_t flags = kNone_BlurFlag) { 44 uint32_t flags = kNone_BlurFlag) {
45 return Make(color, sigma, dx, dy, flags).release(); 45 return Make(color, sigma, dx, dy, flags).release();
46 } 46 }
47 #endif 47 #endif
48 48
49 virtual ~SkBlurDrawLooper();
50
51 SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const overrid e; 49 SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const overrid e;
52 50
53 size_t contextSize() const override { return sizeof(BlurDrawLooperContext); } 51 size_t contextSize() const override { return sizeof(BlurDrawLooperContext); }
54 52
55 SK_TO_STRING_OVERRIDE() 53 SK_TO_STRING_OVERRIDE()
56 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper) 54 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper)
57 55
58 protected: 56 protected:
59 SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, 57 SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy,
60 uint32_t flags); 58 uint32_t flags);
61 59
62 void flatten(SkWriteBuffer&) const override; 60 void flatten(SkWriteBuffer&) const override;
63 61
64 bool asABlurShadow(BlurShadowRec*) const override; 62 bool asABlurShadow(BlurShadowRec*) const override;
65 63
66 private: 64 private:
67 SkMaskFilter* fBlur; 65 sk_sp<SkMaskFilter> fBlur;
68 sk_sp<SkColorFilter> fColorFilter; 66 sk_sp<SkColorFilter> fColorFilter;
69 SkScalar fDx, fDy, fSigma; 67 SkScalar fDx, fDy, fSigma;
70 SkColor fBlurColor; 68 SkColor fBlurColor;
71 uint32_t fBlurFlags; 69 uint32_t fBlurFlags;
72 70
73 enum State { 71 enum State {
74 kBeforeEdge, 72 kBeforeEdge,
75 kAfterEdge, 73 kAfterEdge,
76 kDone 74 kDone
77 }; 75 };
78 76
79 class BlurDrawLooperContext : public SkDrawLooper::Context { 77 class BlurDrawLooperContext : public SkDrawLooper::Context {
80 public: 78 public:
81 explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper); 79 explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper);
82 80
83 bool next(SkCanvas* canvas, SkPaint* paint) override; 81 bool next(SkCanvas* canvas, SkPaint* paint) override;
84 82
85 private: 83 private:
86 const SkBlurDrawLooper* fLooper; 84 const SkBlurDrawLooper* fLooper;
87 State fState; 85 State fState;
88 }; 86 };
89 87
90 void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags); 88 void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags);
91 void initEffects(); 89 void initEffects();
92 90
93 typedef SkDrawLooper INHERITED; 91 typedef SkDrawLooper INHERITED;
94 }; 92 };
95 93
96 #endif 94 #endif
OLDNEW
« no previous file with comments | « include/core/SkPaint.h ('k') | include/effects/SkBlurMaskFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698