Make GrStyle more sk_sp savy
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1947543002 Review-Url: https://codereview.chromium.org/1947543002
This commit is contained in:
parent
92605b35ef
commit
46db22f1cf
@ -7,7 +7,7 @@
|
||||
|
||||
#include "GrStyle.h"
|
||||
|
||||
void GrStyle::initPathEffect(SkPathEffect* pe) {
|
||||
void GrStyle::initPathEffect(sk_sp<SkPathEffect> pe) {
|
||||
if (!pe) {
|
||||
fDashInfo.fType = SkPathEffect::kNone_DashType;
|
||||
return;
|
||||
@ -17,7 +17,7 @@ void GrStyle::initPathEffect(SkPathEffect* pe) {
|
||||
if (fStrokeRec.getStyle() == SkStrokeRec::kFill_Style) {
|
||||
fPathEffect.reset(nullptr);
|
||||
} else {
|
||||
fPathEffect.reset(SkSafeRef(pe));
|
||||
fPathEffect = std::move(pe);
|
||||
fDashInfo.fType = SkPathEffect::kDash_DashType;
|
||||
fDashInfo.fIntervals.reset(info.fCount);
|
||||
fDashInfo.fPhase = info.fPhase;
|
||||
@ -26,7 +26,7 @@ void GrStyle::initPathEffect(SkPathEffect* pe) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
fPathEffect.reset(SkSafeRef(pe));
|
||||
fPathEffect = std::move(pe);
|
||||
}
|
||||
fDashInfo.fType = SkPathEffect::kNone_DashType;
|
||||
fDashInfo.fIntervals.reset(0);
|
||||
|
@ -29,9 +29,9 @@ public:
|
||||
fDashInfo.fType = SkPathEffect::kNone_DashType;
|
||||
}
|
||||
|
||||
GrStyle(const SkStrokeRec& strokeRec, SkPathEffect* pe) : fStrokeRec(strokeRec) {
|
||||
GrStyle(const SkStrokeRec& strokeRec, sk_sp<SkPathEffect> pe) : fStrokeRec(strokeRec) {
|
||||
SkASSERT(SkStrokeRec::kStrokeAndFill_Style != strokeRec.getStyle());
|
||||
this->initPathEffect(pe);
|
||||
this->initPathEffect(std::move(pe));
|
||||
}
|
||||
|
||||
GrStyle(const GrStyle& that) : fStrokeRec(SkStrokeRec::kFill_InitStyle) {
|
||||
@ -40,7 +40,7 @@ public:
|
||||
|
||||
explicit GrStyle(const SkPaint& paint) : fStrokeRec(paint) {
|
||||
SkASSERT(SkStrokeRec::kStrokeAndFill_Style != fStrokeRec.getStyle());
|
||||
this->initPathEffect(paint.getPathEffect());
|
||||
this->initPathEffect(sk_ref_sp(paint.getPathEffect()));
|
||||
}
|
||||
|
||||
GrStyle& operator=(const GrStyle& that) {
|
||||
@ -68,7 +68,7 @@ public:
|
||||
const SkStrokeRec& strokeRec() const { return fStrokeRec; }
|
||||
|
||||
private:
|
||||
void initPathEffect(SkPathEffect* pe);
|
||||
void initPathEffect(sk_sp<SkPathEffect> pe);
|
||||
|
||||
struct DashInfo {
|
||||
DashInfo& operator=(const DashInfo& that) {
|
||||
|
Loading…
Reference in New Issue
Block a user