blob: c27e61b70fe779d1c4b02a418c362b7f0d84aafe [file] [log] [blame]
kkinnunen18996512015-04-26 23:18:49 -07001/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "GrDashLinePathRenderer.h"
9
10#include "GrGpu.h"
11#include "effects/GrDashingEffect.h"
12
kkinnunen18996512015-04-26 23:18:49 -070013bool GrDashLinePathRenderer::canDrawPath(const GrDrawTarget* target,
14 const GrPipelineBuilder* pipelineBuilder,
15 const SkMatrix& viewMatrix,
16 const SkPath& path,
17 const GrStrokeInfo& stroke,
18 bool antiAlias) const {
19 SkPoint pts[2];
20 if (stroke.isDashed() && path.isLine(pts)) {
21 return GrDashingEffect::CanDrawDashLine(pts, stroke, viewMatrix);
22 }
23 return false;
24}
25
26bool GrDashLinePathRenderer::onDrawPath(GrDrawTarget* target,
27 GrPipelineBuilder* pipelineBuilder,
28 GrColor color,
29 const SkMatrix& viewMatrix,
30 const SkPath& path,
31 const GrStrokeInfo& stroke,
32 bool useAA) {
33 SkPoint pts[2];
34 SkAssertResult(path.isLine(pts));
bsalomoned0bcad2015-05-04 10:36:42 -070035 return GrDashingEffect::DrawDashLine(target, pipelineBuilder, color,
kkinnunen18996512015-04-26 23:18:49 -070036 viewMatrix, pts, useAA, stroke);
37}