| 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" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const SkPath& path, | 43 const SkPath& path, |
| 44 const SkMatrix& matrix, | 44 const SkMatrix& matrix, |
| 45 SkIRect* devPathBounds, | 45 SkIRect* devPathBounds, |
| 46 SkIRect* devClipBounds) { | 46 SkIRect* devClipBounds) { |
| 47 // compute bounds as intersection of rt size, clip, and path | 47 // compute bounds as intersection of rt size, clip, and path |
| 48 const GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); | 48 const GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); |
| 49 if (NULL == rt) { | 49 if (NULL == rt) { |
| 50 return false; | 50 return false; |
| 51 } | 51 } |
| 52 | 52 |
| 53 target->getClip()->getConservativeBounds(rt, devClipBounds); | 53 pipelineBuilder->clip().getConservativeBounds(rt, devClipBounds); |
| 54 | 54 |
| 55 if (devClipBounds->isEmpty()) { | 55 if (devClipBounds->isEmpty()) { |
| 56 *devPathBounds = SkIRect::MakeWH(rt->width(), rt->height()); | 56 *devPathBounds = SkIRect::MakeWH(rt->width(), rt->height()); |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 | 59 |
| 60 if (!path.getBounds().isEmpty()) { | 60 if (!path.getBounds().isEmpty()) { |
| 61 SkRect pathSBounds; | 61 SkRect pathSBounds; |
| 62 matrix.mapRect(&pathSBounds, path.getBounds()); | 62 matrix.mapRect(&pathSBounds, path.getBounds()); |
| 63 SkIRect pathIBounds; | 63 SkIRect pathIBounds; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 const SkMatrix& viewMatrix, | 120 const SkMatrix& viewMatrix, |
| 121 const SkPath& path, | 121 const SkPath& path, |
| 122 const SkStrokeRec& stroke, | 122 const SkStrokeRec& stroke, |
| 123 bool antiAlias) { | 123 bool antiAlias) { |
| 124 | 124 |
| 125 if (NULL == fContext) { | 125 if (NULL == fContext) { |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| 129 SkIRect devPathBounds, devClipBounds; | 129 SkIRect devPathBounds, devClipBounds; |
| 130 if (!get_path_and_clip_bounds(target, pipelineBuilder, path, viewMatrix, | 130 if (!get_path_and_clip_bounds(target, pipelineBuilder, path, viewMatrix, &de
vPathBounds, |
| 131 &devPathBounds, &devClipBounds)) { | 131 &devClipBounds)) { |
| 132 if (path.isInverseFillType()) { | 132 if (path.isInverseFillType()) { |
| 133 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, dev
ClipBounds, | 133 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, dev
ClipBounds, |
| 134 devPathBounds); | 134 devPathBounds); |
| 135 } | 135 } |
| 136 return true; | 136 return true; |
| 137 } | 137 } |
| 138 | 138 |
| 139 SkAutoTUnref<GrTexture> texture( | 139 SkAutoTUnref<GrTexture> texture( |
| 140 GrSWMaskHelper::DrawPathMaskToTexture(fContext, path, stroke, | 140 GrSWMaskHelper::DrawPathMaskToTexture(fContext, path, stroke, |
| 141 devPathBounds, | 141 devPathBounds, |
| 142 antiAlias, &viewMatrix)); | 142 antiAlias, &viewMatrix)); |
| 143 if (NULL == texture) { | 143 if (NULL == texture) { |
| 144 return false; | 144 return false; |
| 145 } | 145 } |
| 146 | 146 |
| 147 GrPipelineBuilder copy = *pipelineBuilder; | 147 GrPipelineBuilder copy = *pipelineBuilder; |
| 148 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, ©, color, view
Matrix, | 148 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, ©, color, view
Matrix, |
| 149 devPathBounds); | 149 devPathBounds); |
| 150 | 150 |
| 151 if (path.isInverseFillType()) { | 151 if (path.isInverseFillType()) { |
| 152 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClip
Bounds, | 152 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClip
Bounds, |
| 153 devPathBounds); | 153 devPathBounds); |
| 154 } | 154 } |
| 155 | 155 |
| 156 return true; | 156 return true; |
| 157 } | 157 } |
| OLD | NEW |