Chromium Code Reviews| Index: src/gpu/GrStrokeInfo.h |
| diff --git a/src/gpu/GrStrokeInfo.h b/src/gpu/GrStrokeInfo.h |
| index 2bd056ea3cadba0e77d35bb50f42a9f9d0dea3af..3be6f5c8d7c65f0626f22f0a971aa4951eb63c3f 100644 |
| --- a/src/gpu/GrStrokeInfo.h |
| +++ b/src/gpu/GrStrokeInfo.h |
| @@ -20,9 +20,10 @@ |
| class GrStrokeInfo { |
| public: |
| GrStrokeInfo(SkStrokeRec::InitStyle style) : |
| - fStroke(style), fDashType(SkPathEffect::kNone_DashType) {} |
| + fStroke(style), fPathEffect(NULL), fDashType(SkPathEffect::kNone_DashType) {} |
| - GrStrokeInfo(const GrStrokeInfo& src, bool includeDash = true) : fStroke(src.fStroke) { |
| + GrStrokeInfo(const GrStrokeInfo& src, bool includeDash = true) : |
| + fStroke(src.fStroke), fPathEffect(NULL) { |
| if (includeDash) { |
| fDashInfo = src.fDashInfo; |
| fDashType = src.fDashType; |
| @@ -31,16 +32,21 @@ public: |
| } else { |
| fDashType = SkPathEffect::kNone_DashType; |
| } |
| + SkRefCnt_SafeAssign(fPathEffect, src.fPathEffect); |
| + } |
| + |
| + ~GrStrokeInfo() { |
| + SkSafeUnref(fPathEffect); |
| } |
| GrStrokeInfo(const SkPaint& paint, SkPaint::Style styleOverride) : |
| - fStroke(paint, styleOverride), fDashType(SkPathEffect::kNone_DashType) { |
| + fStroke(paint, styleOverride), fPathEffect(NULL), fDashType(SkPathEffect::kNone_DashType) { |
| this->init(paint); |
| } |
| explicit GrStrokeInfo(const SkPaint& paint) : |
| - fStroke(paint), fDashType(SkPathEffect::kNone_DashType) { |
| + fStroke(paint), fPathEffect(NULL), fDashType(SkPathEffect::kNone_DashType) { |
| this->init(paint); |
| } |
| @@ -83,14 +89,18 @@ public: |
| const SkPathEffect::DashInfo& getDashInfo() const { return fDashInfo; } |
| + SkPathEffect* getPathEffect() const { return fPathEffect; } |
|
bsalomon
2015/04/16 17:52:18
can this be const?
|
| + |
| private: |
| void init(const SkPaint& paint) { |
| - const SkPathEffect* pe = paint.getPathEffect(); |
| + SkPathEffect* pe = paint.getPathEffect(); |
| this->setDashInfo(pe); |
| + SkRefCnt_SafeAssign(fPathEffect, pe); |
| } |
| SkStrokeRec fStroke; |
| + SkPathEffect* fPathEffect; |
|
bsalomon
2015/04/16 17:52:18
can this be const?
|
| SkPathEffect::DashType fDashType; |
| SkPathEffect::DashInfo fDashInfo; |
| SkAutoSTArray<2, SkScalar> fIntervals; |