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

Unified Diff: src/gpu/GrStrokeInfo.h

Issue 1096513002: Pass dashing information to path rasterizers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix 100-col issue Created 5 years, 8 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
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;

Powered by Google App Engine
This is Rietveld 408576698