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