OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrDashLinePathRenderer.h" | 8 #include "GrDashLinePathRenderer.h" |
9 | 9 |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
11 #include "effects/GrDashingEffect.h" | 11 #include "effects/GrDashingEffect.h" |
12 | 12 |
| 13 GrDashLinePathRenderer::GrDashLinePathRenderer(GrContext* context) |
| 14 : fGpu(SkRef(context->getGpu())) { |
| 15 } |
| 16 |
| 17 GrDashLinePathRenderer::~GrDashLinePathRenderer() { |
| 18 } |
| 19 |
13 bool GrDashLinePathRenderer::canDrawPath(const GrDrawTarget* target, | 20 bool GrDashLinePathRenderer::canDrawPath(const GrDrawTarget* target, |
14 const GrPipelineBuilder* pipelineBuilde
r, | 21 const GrPipelineBuilder* pipelineBuilde
r, |
15 const SkMatrix& viewMatrix, | 22 const SkMatrix& viewMatrix, |
16 const SkPath& path, | 23 const SkPath& path, |
17 const GrStrokeInfo& stroke, | 24 const GrStrokeInfo& stroke, |
18 bool antiAlias) const { | 25 bool antiAlias) const { |
19 SkPoint pts[2]; | 26 SkPoint pts[2]; |
20 if (stroke.isDashed() && path.isLine(pts)) { | 27 if (stroke.isDashed() && path.isLine(pts)) { |
21 return GrDashingEffect::CanDrawDashLine(pts, stroke, viewMatrix); | 28 return GrDashingEffect::CanDrawDashLine(pts, stroke, viewMatrix); |
22 } | 29 } |
23 return false; | 30 return false; |
24 } | 31 } |
25 | 32 |
26 bool GrDashLinePathRenderer::onDrawPath(GrDrawTarget* target, | 33 bool GrDashLinePathRenderer::onDrawPath(GrDrawTarget* target, |
27 GrPipelineBuilder* pipelineBuilder, | 34 GrPipelineBuilder* pipelineBuilder, |
28 GrColor color, | 35 GrColor color, |
29 const SkMatrix& viewMatrix, | 36 const SkMatrix& viewMatrix, |
30 const SkPath& path, | 37 const SkPath& path, |
31 const GrStrokeInfo& stroke, | 38 const GrStrokeInfo& stroke, |
32 bool useAA) { | 39 bool useAA) { |
33 SkPoint pts[2]; | 40 SkPoint pts[2]; |
34 SkAssertResult(path.isLine(pts)); | 41 SkAssertResult(path.isLine(pts)); |
35 return GrDashingEffect::DrawDashLine(target, pipelineBuilder, color, | 42 return GrDashingEffect::DrawDashLine(target, pipelineBuilder, color, |
36 viewMatrix, pts, useAA, stroke); | 43 viewMatrix, pts, useAA, stroke); |
37 } | 44 } |
OLD | NEW |