OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrSoftwarePathRenderer.h" | 8 #include "GrSoftwarePathRenderer.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrSWMaskHelper.h" | 10 #include "GrSWMaskHelper.h" |
11 #include "batches/GrRectBatchFactory.h" | 11 #include "batches/GrRectBatchFactory.h" |
12 | 12 |
13 //////////////////////////////////////////////////////////////////////////////// | 13 //////////////////////////////////////////////////////////////////////////////// |
14 bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { | 14 bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
15 if (nullptr == fContext) { | 15 return SkToBool(fContext); |
16 return false; | |
17 } | |
18 if (args.fStroke->isDashed()) { | |
19 return false; | |
20 } | |
21 return true; | |
22 } | 16 } |
23 | 17 |
24 namespace { | 18 namespace { |
25 | 19 |
26 //////////////////////////////////////////////////////////////////////////////// | 20 //////////////////////////////////////////////////////////////////////////////// |
27 // gets device coord bounds of path (not considering the fill) and clip. The | 21 // gets device coord bounds of path (not considering the fill) and clip. The |
28 // path bounds will be a subset of the clip bounds. returns false if | 22 // path bounds will be a subset of the clip bounds. returns false if |
29 // path bounds would be empty. | 23 // path bounds would be empty. |
30 bool get_path_and_clip_bounds(const GrPipelineBuilder* pipelineBuilder, | 24 bool get_path_and_clip_bounds(const GrPipelineBuilder* pipelineBuilder, |
31 const SkPath& path, | 25 const SkPath& path, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if (!get_path_and_clip_bounds(args.fPipelineBuilder, *args.fPath, | 117 if (!get_path_and_clip_bounds(args.fPipelineBuilder, *args.fPath, |
124 *args.fViewMatrix, &devPathBounds, &devClipBou
nds)) { | 118 *args.fViewMatrix, &devPathBounds, &devClipBou
nds)) { |
125 if (args.fPath->isInverseFillType()) { | 119 if (args.fPath->isInverseFillType()) { |
126 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColo
r, | 120 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColo
r, |
127 *args.fViewMatrix, devClipBounds, devPathBounds
); | 121 *args.fViewMatrix, devClipBounds, devPathBounds
); |
128 } | 122 } |
129 return true; | 123 return true; |
130 } | 124 } |
131 | 125 |
132 SkAutoTUnref<GrTexture> texture( | 126 SkAutoTUnref<GrTexture> texture( |
133 GrSWMaskHelper::DrawPathMaskToTexture(fContext, *args.fPath, *args.f
Stroke, | 127 GrSWMaskHelper::DrawPathMaskToTexture(fContext, *args.fPath, *args.f
Style, |
134 devPathBounds, | 128 devPathBounds, |
135 args.fAntiAlias, args.fViewMat
rix)); | 129 args.fAntiAlias, args.fViewMat
rix)); |
136 if (nullptr == texture) { | 130 if (nullptr == texture) { |
137 return false; | 131 return false; |
138 } | 132 } |
139 | 133 |
140 GrSWMaskHelper::DrawToTargetWithPathMask(texture, args.fTarget, args.fPipeli
neBuilder, | 134 GrSWMaskHelper::DrawToTargetWithPathMask(texture, args.fTarget, args.fPipeli
neBuilder, |
141 args.fColor, *args.fViewMatrix, dev
PathBounds); | 135 args.fColor, *args.fViewMatrix, dev
PathBounds); |
142 | 136 |
143 if (args.fPath->isInverseFillType()) { | 137 if (args.fPath->isInverseFillType()) { |
144 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor, *
args.fViewMatrix, | 138 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor, *
args.fViewMatrix, |
145 devClipBounds, devPathBounds); | 139 devClipBounds, devPathBounds); |
146 } | 140 } |
147 | 141 |
148 return true; | 142 return true; |
149 } | 143 } |
OLD | NEW |