diff options
Diffstat (limited to 'src/gpu/GrStyle.cpp')
-rw-r--r-- | src/gpu/GrStyle.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gpu/GrStyle.cpp b/src/gpu/GrStyle.cpp new file mode 100644 index 0000000000..40a148bb4a --- /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); +} |