| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrSoftwarePathRenderer.h" | 9 #include "GrSoftwarePathRenderer.h" |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| 11 #include "GrSWMaskHelper.h" | 11 #include "GrSWMaskHelper.h" |
| 12 #include "GrVertexBuffer.h" | 12 #include "GrVertexBuffer.h" |
| 13 | 13 |
| 14 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
| 15 bool GrSoftwarePathRenderer::canDrawPath(const GrDrawTarget*, | 15 bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
| 16 const GrPipelineBuilder*, | |
| 17 const SkMatrix& viewMatrix, | |
| 18 const SkPath&, | |
| 19 const GrStrokeInfo& stroke, | |
| 20 bool antiAlias) const { | |
| 21 if (NULL == fContext) { | 16 if (NULL == fContext) { |
| 22 return false; | 17 return false; |
| 23 } | 18 } |
| 24 if (stroke.isDashed()) { | 19 if (args.fStroke->isDashed()) { |
| 25 return false; | 20 return false; |
| 26 } | 21 } |
| 27 return true; | 22 return true; |
| 28 } | 23 } |
| 29 | 24 |
| 30 GrPathRenderer::StencilSupport | 25 GrPathRenderer::StencilSupport |
| 31 GrSoftwarePathRenderer::onGetStencilSupport(const GrDrawTarget*, | 26 GrSoftwarePathRenderer::onGetStencilSupport(const GrDrawTarget*, |
| 32 const GrPipelineBuilder*, | 27 const GrPipelineBuilder*, |
| 33 const SkPath&, | 28 const SkPath&, |
| 34 const GrStrokeInfo&) const { | 29 const GrStrokeInfo&) const { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom, | 105 rect.iset(devClipBounds.fLeft, devPathBounds.fBottom, |
| 111 devClipBounds.fRight, devClipBounds.fBottom); | 106 devClipBounds.fRight, devClipBounds.fBottom); |
| 112 target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), rect, NULL, &
invert); | 107 target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), rect, NULL, &
invert); |
| 113 } | 108 } |
| 114 } | 109 } |
| 115 | 110 |
| 116 } | 111 } |
| 117 | 112 |
| 118 //////////////////////////////////////////////////////////////////////////////// | 113 //////////////////////////////////////////////////////////////////////////////// |
| 119 // return true on success; false on failure | 114 // return true on success; false on failure |
| 120 bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target, | 115 bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) { |
| 121 GrPipelineBuilder* pipelineBuilder, | |
| 122 GrColor color, | |
| 123 const SkMatrix& viewMatrix, | |
| 124 const SkPath& path, | |
| 125 const GrStrokeInfo& stroke, | |
| 126 bool antiAlias) { | |
| 127 if (NULL == fContext) { | 116 if (NULL == fContext) { |
| 128 return false; | 117 return false; |
| 129 } | 118 } |
| 130 | 119 |
| 131 SkIRect devPathBounds, devClipBounds; | 120 SkIRect devPathBounds, devClipBounds; |
| 132 if (!get_path_and_clip_bounds(target, pipelineBuilder, path, viewMatrix, &de
vPathBounds, | 121 if (!get_path_and_clip_bounds(args.fTarget, args.fPipelineBuilder, *args.fPa
th, |
| 133 &devClipBounds)) { | 122 *args.fViewMatrix, &devPathBounds, &devClipBou
nds)) { |
| 134 if (path.isInverseFillType()) { | 123 if (args.fPath->isInverseFillType()) { |
| 135 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, dev
ClipBounds, | 124 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColo
r, |
| 136 devPathBounds); | 125 *args.fViewMatrix, devClipBounds, devPathBounds
); |
| 137 } | 126 } |
| 138 return true; | 127 return true; |
| 139 } | 128 } |
| 140 | 129 |
| 141 SkAutoTUnref<GrTexture> texture( | 130 SkAutoTUnref<GrTexture> texture( |
| 142 GrSWMaskHelper::DrawPathMaskToTexture(fContext, path, stroke, | 131 GrSWMaskHelper::DrawPathMaskToTexture(fContext, *args.fPath, *args.f
Stroke, |
| 143 devPathBounds, | 132 devPathBounds, |
| 144 antiAlias, &viewMatrix)); | 133 args.fAntiAlias, args.fViewMat
rix)); |
| 145 if (NULL == texture) { | 134 if (NULL == texture) { |
| 146 return false; | 135 return false; |
| 147 } | 136 } |
| 148 | 137 |
| 149 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, pipelineBuilder, c
olor, viewMatrix, | 138 GrSWMaskHelper::DrawToTargetWithPathMask(texture, args.fTarget, args.fPipeli
neBuilder, |
| 150 devPathBounds); | 139 args.fColor, *args.fViewMatrix, dev
PathBounds); |
| 151 | 140 |
| 152 if (path.isInverseFillType()) { | 141 if (args.fPath->isInverseFillType()) { |
| 153 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClip
Bounds, | 142 draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor, *
args.fViewMatrix, |
| 154 devPathBounds); | 143 devClipBounds, devPathBounds); |
| 155 } | 144 } |
| 156 | 145 |
| 157 return true; | 146 return true; |
| 158 } | 147 } |
| OLD | NEW |