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

Unified Diff: include/core/SkPathEffect.h

Issue 1813123003: Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.or… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move flag into sktypes, so it is visible to both paint and other patheffect clients Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPaint.h ('k') | include/core/SkTypes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPathEffect.h
diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h
index a77b9467e42fda294329976e6fddf6f2ce436fe6..fd5957378ab12fc44c7f26ebefcc0012c1da0845 100644
--- a/include/core/SkPathEffect.h
+++ b/include/core/SkPathEffect.h
@@ -154,16 +154,14 @@ private:
for managing the lifetimes of its two arguments.
*/
class SkPairPathEffect : public SkPathEffect {
-public:
- virtual ~SkPairPathEffect();
-
protected:
- SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1);
+ SkPairPathEffect(sk_sp<SkPathEffect> pe0, sk_sp<SkPathEffect> pe1);
void flatten(SkWriteBuffer&) const override;
// these are visible to our subclasses
- SkPathEffect* fPE0, *fPE1;
+ sk_sp<SkPathEffect> fPE0;
+ sk_sp<SkPathEffect> fPE1;
SK_TO_STRING_OVERRIDE()
@@ -183,16 +181,22 @@ public:
The reference counts for outer and inner are both incremented in the constructor,
and decremented in the destructor.
*/
- static SkPathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) {
+ static sk_sp<SkPathEffect> Make(sk_sp<SkPathEffect> outer, sk_sp<SkPathEffect> inner) {
if (!outer) {
- return SkSafeRef(inner);
+ return inner;
}
if (!inner) {
- return SkSafeRef(outer);
+ return outer;
}
- return new SkComposePathEffect(outer, inner);
+ return sk_sp<SkPathEffect>(new SkComposePathEffect(outer, inner));
}
+#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR
+ static SkPathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) {
+ return Make(sk_ref_sp(outer), sk_ref_sp(inner)).release();
+ }
+#endif
+
virtual bool filterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const override;
@@ -204,7 +208,8 @@ public:
#endif
protected:
- SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner) : INHERITED(outer, inner) {}
+ SkComposePathEffect(sk_sp<SkPathEffect> outer, sk_sp<SkPathEffect> inner)
+ : INHERITED(outer, inner) {}
private:
// illegal
@@ -226,16 +231,21 @@ public:
The reference counts for first and second are both incremented in the constructor,
and decremented in the destructor.
*/
- static SkPathEffect* Create(SkPathEffect* first, SkPathEffect* second) {
+ static sk_sp<SkPathEffect> Make(sk_sp<SkPathEffect> first, sk_sp<SkPathEffect> second) {
if (!first) {
- return SkSafeRef(second);
+ return second;
}
if (!second) {
- return SkSafeRef(first);
+ return first;
}
- return new SkSumPathEffect(first, second);
+ return sk_sp<SkPathEffect>(new SkSumPathEffect(first, second));
}
+#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR
+ static SkPathEffect* Create(SkPathEffect* first, SkPathEffect* second) {
+ return Make(sk_ref_sp(first), sk_ref_sp(second)).release();
+ }
+#endif
virtual bool filterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const override;
@@ -247,7 +257,8 @@ public:
#endif
protected:
- SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) : INHERITED(first, second) {}
+ SkSumPathEffect(sk_sp<SkPathEffect> first, sk_sp<SkPathEffect> second)
+ : INHERITED(first, second) {}
private:
// illegal
« no previous file with comments | « include/core/SkPaint.h ('k') | include/core/SkTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698