Chromium Code Reviews| Index: src/gpu/GrStrokeInfo.h |
| diff --git a/src/gpu/GrStrokeInfo.h b/src/gpu/GrStrokeInfo.h |
| index e1349a7eece9d941afdc8dfdd801154d759ccc62..d1eb14f62940f4577034ee36b8899538af694249 100644 |
| --- a/src/gpu/GrStrokeInfo.h |
| +++ b/src/gpu/GrStrokeInfo.h |
| @@ -16,12 +16,15 @@ |
| * which holds information on fill style, width, miter, cap, and join. It also holds information |
| * about the dash like intervals, count, and phase. |
| */ |
| -class GrStrokeInfo { |
| -public: |
| - GrStrokeInfo(SkStrokeRec::InitStyle style) : |
| - fStroke(style), fDashType(SkPathEffect::kNone_DashType) {} |
| +class GrStrokeInfo : public SkStrokeRec { |
| +public: |
| + GrStrokeInfo(SkStrokeRec::InitStyle style) |
| + : INHERITED(style) |
| + , fDashType(SkPathEffect::kNone_DashType) { |
| + } |
| - GrStrokeInfo(const GrStrokeInfo& src, bool includeDash = true) : fStroke(src.fStroke) { |
| + GrStrokeInfo(const GrStrokeInfo& src, bool includeDash = true) |
| + : INHERITED(src) { |
| if (includeDash && src.isDashed()) { |
| fDashType = src.fDashType; |
| fDashPhase = src.fDashPhase; |
| @@ -32,13 +35,15 @@ public: |
| } |
| } |
| - GrStrokeInfo(const SkPaint& paint, SkPaint::Style styleOverride) : |
| - fStroke(paint, styleOverride), fDashType(SkPathEffect::kNone_DashType) { |
| + GrStrokeInfo(const SkPaint& paint, SkPaint::Style styleOverride) |
| + : INHERITED(paint, styleOverride) |
| + , fDashType(SkPathEffect::kNone_DashType) { |
| this->init(paint); |
| } |
| - explicit GrStrokeInfo(const SkPaint& paint) : |
| - fStroke(paint), fDashType(SkPathEffect::kNone_DashType) { |
| + explicit GrStrokeInfo(const SkPaint& paint) |
| + : INHERITED(paint) |
| + , fDashType(SkPathEffect::kNone_DashType) { |
| this->init(paint); |
| } |
| @@ -51,23 +56,17 @@ public: |
| } else { |
| this->removeDash(); |
| } |
| - fStroke = other.fStroke; |
| + this->INHERITED::operator=(other); |
| return *this; |
| } |
| - const SkStrokeRec& getStrokeRec() const { return fStroke; } |
| - |
| - SkStrokeRec* getStrokeRecPtr() { return &fStroke; } |
| - |
| - void setFillStyle() { fStroke.setFillStyle(); } |
| - |
| /* |
| * This functions takes in a patheffect and updates the dashing information if the path effect |
| * is a Dash type. Returns true if the path effect is a dashed effect and we are stroking, |
| * otherwise it returns false. |
| */ |
| bool setDashInfo(const SkPathEffect* pe) { |
| - if (pe && !fStroke.isFillStyle()) { |
| + if (pe && !this->isFillStyle()) { |
| SkPathEffect::DashInfo dashInfo; |
| fDashType = pe->asADash(&dashInfo); |
| if (SkPathEffect::kDash_DashType == fDashType) { |
| @@ -85,8 +84,7 @@ public: |
| * Like the above, but sets with an explicit SkPathEffect::DashInfo |
| */ |
| bool setDashInfo(const SkPathEffect::DashInfo& info) { |
| - if (!fStroke.isFillStyle()) { |
| - SkASSERT(!fStroke.isFillStyle()); |
| + if (!this->isFillStyle()) { |
| fDashType = SkPathEffect::kDash_DashType; |
| fDashPhase = info.fPhase; |
| fIntervals.reset(info.fCount); |
| @@ -99,11 +97,9 @@ public: |
| } |
| bool isDashed() const { |
| - return (!fStroke.isFillStyle() && SkPathEffect::kDash_DashType == fDashType); |
| + return (!this->isFillStyle() && SkPathEffect::kDash_DashType == fDashType); |
| } |
| - bool isFillStyle() const { return fStroke.isFillStyle(); } |
| - |
| int32_t getDashCount() const { |
| SkASSERT(this->isDashed()); |
| return fIntervals.count(); |
| @@ -129,7 +125,7 @@ public: |
| * will be unmodified. The stroking in the SkStrokeRec might still |
| * be applicable. |
| */ |
| - bool applyDash(SkPath* dst, GrStrokeInfo* dstStrokeInfo, const SkPath& src) const; |
| + bool applyDashToPath(SkPath* dst, GrStrokeInfo* dstStrokeInfo, const SkPath& src) const; |
| private: |
| @@ -138,10 +134,13 @@ private: |
| this->setDashInfo(pe); |
| } |
| - SkStrokeRec fStroke; |
| + bool operator==(const SkStrokeRec& other) const; |
|
egdaniel
2015/05/15 14:07:05
you declare these comparison operators but never a
Kimmo Kinnunen
2015/05/18 06:18:36
Ah, sorry about that.
Done.
|
| + bool operator!=(const SkStrokeRec& other) const; |
| + |
| SkPathEffect::DashType fDashType; |
| SkScalar fDashPhase; |
| SkAutoSTArray<2, SkScalar> fIntervals; |
| + typedef SkStrokeRec INHERITED; |
| }; |
| #endif |