Index: src/gpu/GrStyle.cpp |
diff --git a/src/gpu/GrStyle.cpp b/src/gpu/GrStyle.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..40a148bb4a9c6e88063d064aa3232ef6fda50202 |
--- /dev/null |
+++ b/src/gpu/GrStyle.cpp |
@@ -0,0 +1,33 @@ |
+/* |
+ * Copyright 2016 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "GrStyle.h" |
+ |
+void GrStyle::initPathEffect(SkPathEffect* pe) { |
+ if (!pe) { |
+ fDashInfo.fType = SkPathEffect::kNone_DashType; |
+ return; |
+ } |
+ SkPathEffect::DashInfo info; |
+ if (SkPathEffect::kDash_DashType == pe->asADash(&info)) { |
+ if (fStrokeRec.getStyle() == SkStrokeRec::kFill_Style) { |
+ fPathEffect.reset(nullptr); |
+ } else { |
+ fPathEffect.reset(SkSafeRef(pe)); |
+ fDashInfo.fType = SkPathEffect::kDash_DashType; |
+ fDashInfo.fIntervals.reset(info.fCount); |
+ fDashInfo.fPhase = info.fPhase; |
+ info.fIntervals = fDashInfo.fIntervals.get(); |
+ pe->asADash(&info); |
+ return; |
+ } |
+ } else { |
+ fPathEffect.reset(SkSafeRef(pe)); |
+ } |
+ fDashInfo.fType = SkPathEffect::kNone_DashType; |
+ fDashInfo.fIntervals.reset(0); |
+} |