aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrDashingEffect.h
blob: 14df1ae7d5ea72d53ba33d0e46822ba5a3cfff61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrDashingEffect_DEFINED
#define GrDashingEffect_DEFINED

#include "GrTypesPriv.h"
#include "SkPathEffect.h"

class GrGpu;
class GrDrawState;
class GrDrawTarget;
class GrGeometryProcessor;
class GrPaint;
class GrStrokeInfo;

class GrGLDashingEffect;
class SkPath;

namespace GrDashingEffect {
    bool DrawDashLine(GrGpu*, GrDrawTarget*, GrDrawState*, const SkPoint pts[2],
                      const GrPaint& paint, const GrStrokeInfo& strokeInfo,
                      const SkMatrix& vm);

    enum DashCap {
        kRound_DashCap,
        kNonRound_DashCap,
    };

    /**
     * An effect that renders a dashed line. It is intended to be used as a coverage effect.
     * The effect is meant for dashed lines that only have a single on/off interval pair.
     * Bounding geometry is rendered and the effect computes coverage based on the fragment's
     * position relative to the dashed line.
     */
    GrGeometryProcessor* Create(GrPrimitiveEdgeType edgeType,
                                const SkPathEffect::DashInfo& info,
                                SkScalar strokeWidth,
                                DashCap cap);
}

#endif