aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDashLinePathRenderer.cpp
blob: 17c189028b0280d0d73db24b85d7e6deb8f2797f (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
/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "GrDashLinePathRenderer.h"

#include "GrGpu.h"
#include "effects/GrDashingEffect.h"

bool GrDashLinePathRenderer::canDrawPath(const GrDrawTarget* target,
                                         const GrPipelineBuilder* pipelineBuilder,
                                         const SkMatrix& viewMatrix,
                                         const SkPath& path,
                                         const GrStrokeInfo& stroke,
                                         bool antiAlias) const {
    SkPoint pts[2];
    if (stroke.isDashed() && path.isLine(pts)) {
        return GrDashingEffect::CanDrawDashLine(pts, stroke, viewMatrix);
    }
    return false;
}

bool GrDashLinePathRenderer::onDrawPath(GrDrawTarget* target,
                                        GrPipelineBuilder* pipelineBuilder,
                                        GrColor color,
                                        const SkMatrix& viewMatrix,
                                        const SkPath& path,
                                        const GrStrokeInfo& stroke,
                                        bool useAA) {
    SkPoint pts[2];
    SkAssertResult(path.isLine(pts));
    return GrDashingEffect::DrawDashLine(target, *pipelineBuilder, color,
                                         viewMatrix, pts, useAA, stroke);
}