1 2 /* 3 * Copyright 2014 Google Inc. 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 #ifndef GrDashingEffect_DEFINED 10 #define GrDashingEffect_DEFINED 11 12 #include "GrTypesPriv.h" 13 #include "SkPathEffect.h" 14 15 class GrGpu; 16 class GrDrawTarget; 17 class GrGeometryProcessor; 18 class GrPaint; 19 class GrStrokeInfo; 20 21 class GrGLDashingEffect; 22 class SkPath; 23 24 namespace GrDashingEffect { 25 bool DrawDashLine(const SkPoint pts[2], const GrPaint& paint, const GrStrokeInfo& strokeInfo, 26 GrGpu* gpu, GrDrawTarget* target, const SkMatrix& vm); 27 28 enum DashCap { 29 kRound_DashCap, 30 kNonRound_DashCap, 31 }; 32 33 /** 34 * An effect that renders a dashed line. It is intended to be used as a coverage effect. 35 * The effect is meant for dashed lines that only have a single on/off interval pair. 36 * Bounding geometry is rendered and the effect computes coverage based on the fragment's 37 * position relative to the dashed line. 38 */ 39 GrGeometryProcessor* Create(GrPrimitiveEdgeType edgeType, 40 const SkPathEffect::DashInfo& info, 41 SkScalar strokeWidth, 42 DashCap cap); 43 } 44 45 #endif 46