diff options
author | reed <reed@google.com> | 2016-03-18 10:17:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-18 10:17:27 -0700 |
commit | f28ad894272018fd2855e3f77ea1236ea0cce1c0 (patch) | |
tree | 25dfb6f13e3bbbde1c9d7af7b41ea39b2df78dd4 /include | |
parent | 9fbee18f691a0afed1e38a851048ce06063505ed (diff) |
Revert of switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.org/1813553005/ )
Reason for revert:
some build breaks, possibly related to paint having to know what a patheffect is
Original issue's description:
> switch patheffects over to sk_sp
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1813553005
>
> Committed: https://skia.googlesource.com/skia/+/9fbee18f691a0afed1e38a851048ce06063505ed
TBR=caryclark@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1817543002
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkPaint.h | 7 | ||||
-rw-r--r-- | include/core/SkPathEffect.h | 45 | ||||
-rw-r--r-- | include/effects/Sk1DPathEffect.h | 8 | ||||
-rw-r--r-- | include/effects/Sk2DPathEffect.h | 8 | ||||
-rw-r--r-- | include/effects/SkArcToPathEffect.h | 4 | ||||
-rw-r--r-- | include/effects/SkCornerPathEffect.h | 10 | ||||
-rw-r--r-- | include/effects/SkDashPathEffect.h | 8 | ||||
-rw-r--r-- | include/effects/SkDiscretePathEffect.h | 6 |
8 files changed, 26 insertions, 70 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 9dc9f91ac3..39ee1e0de1 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -561,13 +561,8 @@ public: paint @return effect */ + SkPathEffect* setPathEffect(SkPathEffect* effect); void setPathEffect(sk_sp<SkPathEffect>); -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - SkPathEffect* setPathEffect(SkPathEffect* effect) { - this->setPathEffect(sk_ref_sp(effect)); - return effect; - } -#endif /** Get the paint's maskfilter object. <p /> diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h index 405a504774..a77b9467e4 100644 --- a/include/core/SkPathEffect.h +++ b/include/core/SkPathEffect.h @@ -18,10 +18,6 @@ class SkPath; class SkStrokeRec; -#ifndef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - #define SK_SUPPORT_LEGACY_PATHEFFECT_PTR -#endif - /** \class SkPathEffect SkPathEffect is the base class for objects in the SkPaint that affect @@ -158,14 +154,16 @@ private: for managing the lifetimes of its two arguments. */ class SkPairPathEffect : public SkPathEffect { +public: + virtual ~SkPairPathEffect(); + protected: - SkPairPathEffect(sk_sp<SkPathEffect> pe0, sk_sp<SkPathEffect> pe1); + SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1); void flatten(SkWriteBuffer&) const override; // these are visible to our subclasses - sk_sp<SkPathEffect> fPE0; - sk_sp<SkPathEffect> fPE1; + SkPathEffect* fPE0, *fPE1; SK_TO_STRING_OVERRIDE() @@ -185,22 +183,16 @@ public: The reference counts for outer and inner are both incremented in the constructor, and decremented in the destructor. */ - static sk_sp<SkPathEffect> Make(sk_sp<SkPathEffect> outer, sk_sp<SkPathEffect> inner) { + static SkPathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) { if (!outer) { - return inner; + return SkSafeRef(inner); } if (!inner) { - return outer; + return SkSafeRef(outer); } - return sk_sp<SkPathEffect>(new SkComposePathEffect(outer, inner)); + return 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; @@ -212,8 +204,7 @@ public: #endif protected: - SkComposePathEffect(sk_sp<SkPathEffect> outer, sk_sp<SkPathEffect> inner) - : INHERITED(outer, inner) {} + SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner) : INHERITED(outer, inner) {} private: // illegal @@ -235,21 +226,16 @@ public: The reference counts for first and second are both incremented in the constructor, and decremented in the destructor. */ - static sk_sp<SkPathEffect> Make(sk_sp<SkPathEffect> first, sk_sp<SkPathEffect> second) { + static SkPathEffect* Create(SkPathEffect* first, SkPathEffect* second) { if (!first) { - return second; + return SkSafeRef(second); } if (!second) { - return first; + return SkSafeRef(first); } - return sk_sp<SkPathEffect>(new SkSumPathEffect(first, second)); + return 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; @@ -261,8 +247,7 @@ public: #endif protected: - SkSumPathEffect(sk_sp<SkPathEffect> first, sk_sp<SkPathEffect> second) - : INHERITED(first, second) {} + SkSumPathEffect(SkPathEffect* first, SkPathEffect* second) : INHERITED(first, second) {} private: // illegal diff --git a/include/effects/Sk1DPathEffect.h b/include/effects/Sk1DPathEffect.h index d5315a8735..03c6966943 100644 --- a/include/effects/Sk1DPathEffect.h +++ b/include/effects/Sk1DPathEffect.h @@ -56,13 +56,7 @@ public: @param style how to transform path at each point (based on the current position and tangent) */ - static sk_sp<SkPathEffect> Make(const SkPath& path, SkScalar advance, SkScalar phase, Style); - -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - static SkPathEffect* Create(const SkPath& path, SkScalar advance, SkScalar phase, Style s) { - return Make(path, advance, phase, s).release(); - } -#endif + static SkPathEffect* Create(const SkPath& path, SkScalar advance, SkScalar phase, Style); virtual bool filterPath(SkPath*, const SkPath&, SkStrokeRec*, const SkRect*) const override; diff --git a/include/effects/Sk2DPathEffect.h b/include/effects/Sk2DPathEffect.h index 823a6ad9d8..73da83c4b9 100644 --- a/include/effects/Sk2DPathEffect.h +++ b/include/effects/Sk2DPathEffect.h @@ -55,8 +55,8 @@ private: class SK_API SkLine2DPathEffect : public Sk2DPathEffect { public: - static sk_sp<SkPathEffect> Make(SkScalar width, const SkMatrix& matrix) { - return sk_sp<SkPathEffect>(new SkLine2DPathEffect(width, matrix)); + static SkPathEffect* Create(SkScalar width, const SkMatrix& matrix) { + return new SkLine2DPathEffect(width, matrix); } virtual bool filterPath(SkPath* dst, const SkPath& src, @@ -84,8 +84,8 @@ public: * Stamp the specified path to fill the shape, using the matrix to define * the latice. */ - static sk_sp<SkPathEffect> Make(const SkMatrix& matrix, const SkPath& path) { - return sk_sp<SkPathEffect>(new SkPath2DPathEffect(matrix, path)); + static SkPathEffect* Create(const SkMatrix& matrix, const SkPath& path) { + return new SkPath2DPathEffect(matrix, path); } SK_TO_STRING_OVERRIDE() diff --git a/include/effects/SkArcToPathEffect.h b/include/effects/SkArcToPathEffect.h index fcf4a3a5dc..4716ea125d 100644 --- a/include/effects/SkArcToPathEffect.h +++ b/include/effects/SkArcToPathEffect.h @@ -15,11 +15,11 @@ public: /** radius must be > 0 to have an effect. It specifies the distance from each corner that should be "rounded". */ - static sk_sp<SkPathEffect> Make(SkScalar radius) { + static SkPathEffect* Create(SkScalar radius) { if (radius <= 0) { return NULL; } - return sk_sp<SkPathEffect>(new SkArcToPathEffect(radius)); + return new SkArcToPathEffect(radius); } bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; diff --git a/include/effects/SkCornerPathEffect.h b/include/effects/SkCornerPathEffect.h index cf03463530..13095f0e6c 100644 --- a/include/effects/SkCornerPathEffect.h +++ b/include/effects/SkCornerPathEffect.h @@ -20,15 +20,7 @@ public: /** radius must be > 0 to have an effect. It specifies the distance from each corner that should be "rounded". */ - static sk_sp<SkPathEffect> Make(SkScalar radius) { - return sk_sp<SkPathEffect>(new SkCornerPathEffect(radius)); - } - -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - static SkPathEffect* Create(SkScalar radius) { - return Make(radius).release(); - } -#endif + static SkPathEffect* Create(SkScalar radius) { return new SkCornerPathEffect(radius); } virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; diff --git a/include/effects/SkDashPathEffect.h b/include/effects/SkDashPathEffect.h index ccb1a4e440..08b0a4693f 100644 --- a/include/effects/SkDashPathEffect.h +++ b/include/effects/SkDashPathEffect.h @@ -36,13 +36,7 @@ public: Note: only affects stroked paths. */ - static sk_sp<SkPathEffect> Make(const SkScalar intervals[], int count, SkScalar phase); - -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR - static SkPathEffect* Create(const SkScalar intervals[], int count, SkScalar phase) { - return Make(intervals, count, phase).release(); - } -#endif + static SkPathEffect* Create(const SkScalar intervals[], int count, SkScalar phase); virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; diff --git a/include/effects/SkDiscretePathEffect.h b/include/effects/SkDiscretePathEffect.h index 78d4516ee6..a49e2d89a7 100644 --- a/include/effects/SkDiscretePathEffect.h +++ b/include/effects/SkDiscretePathEffect.h @@ -29,13 +29,9 @@ public: they can pass in a different seedAssist to get a different set of path segments. */ - static sk_sp<SkPathEffect> Make(SkScalar segLength, SkScalar dev, uint32_t seedAssist = 0); - -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR static SkPathEffect* Create(SkScalar segLength, SkScalar deviation, uint32_t seedAssist = 0) { - return Make(segLength, deviation, seedAssist).release(); + return new SkDiscretePathEffect(segLength, deviation, seedAssist); } -#endif virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect*) const override; |