blob: 651a240addd738ccb8a5a5f4bb09c73d64598fc4 [file] [log] [blame]
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +00001
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
joshualitt2e3b3e32014-12-09 13:31:14 -080012#include "GrColor.h"
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +000013#include "GrTypesPriv.h"
14#include "SkPathEffect.h"
15
egdaniele61c4112014-06-12 10:24:21 -070016class GrGpu;
joshualitt9853cce2014-11-17 14:22:48 -080017class GrDrawState;
egdaniele61c4112014-06-12 10:24:21 -070018class GrDrawTarget;
joshualittb0a8a372014-09-23 09:50:21 -070019class GrGeometryProcessor;
egdaniele61c4112014-06-12 10:24:21 -070020class GrPaint;
21class GrStrokeInfo;
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +000022
23class GrGLDashingEffect;
24class SkPath;
25
26namespace GrDashingEffect {
joshualitt8059eb92014-12-29 15:10:07 -080027 bool DrawDashLine(GrGpu*, GrDrawTarget*, GrDrawState*, GrColor, const SkMatrix& viewMatrix,
28 const SkPoint pts[2], const GrPaint& paint, const GrStrokeInfo& strokeInfo);
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +000029
egdanielf767e792014-07-02 06:21:32 -070030 enum DashCap {
31 kRound_DashCap,
32 kNonRound_DashCap,
33 };
34
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +000035 /**
36 * An effect that renders a dashed line. It is intended to be used as a coverage effect.
37 * The effect is meant for dashed lines that only have a single on/off interval pair.
38 * Bounding geometry is rendered and the effect computes coverage based on the fragment's
39 * position relative to the dashed line.
40 */
joshualitt2e3b3e32014-12-09 13:31:14 -080041 GrGeometryProcessor* Create(GrColor,
42 GrPrimitiveEdgeType edgeType,
joshualittb0a8a372014-09-23 09:50:21 -070043 const SkPathEffect::DashInfo& info,
44 SkScalar strokeWidth,
joshualittd27f73e2014-12-29 07:43:36 -080045 DashCap cap,
46 const SkMatrix& localMatrix);
commit-bot@chromium.org628ed0b2014-05-19 14:32:49 +000047}
48
49#endif