| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 const GrPipelineBuilder* pipelineBuilder, | 42 const GrPipelineBuilder* pipelineBuilder, |
| 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 *devPathBounds = SkIRect::MakeWH(rt->width(), rt->height()); | |
| 53 | 52 |
| 54 target->getClip()->getConservativeBounds(rt, devClipBounds); | 53 target->getClip()->getConservativeBounds(rt, devClipBounds); |
| 55 | 54 |
| 56 // TODO: getConservativeBounds already intersects with the | 55 if (devClipBounds->isEmpty()) { |
| 57 // render target's bounding box. Remove this next line | 56 *devPathBounds = SkIRect::MakeWH(rt->width(), rt->height()); |
| 58 if (!devPathBounds->intersect(*devClipBounds)) { | |
| 59 return false; | 57 return false; |
| 60 } | 58 } |
| 61 | 59 |
| 62 if (!path.getBounds().isEmpty()) { | 60 if (!path.getBounds().isEmpty()) { |
| 63 SkRect pathSBounds; | 61 SkRect pathSBounds; |
| 64 matrix.mapRect(&pathSBounds, path.getBounds()); | 62 matrix.mapRect(&pathSBounds, path.getBounds()); |
| 65 SkIRect pathIBounds; | 63 SkIRect pathIBounds; |
| 66 pathSBounds.roundOut(&pathIBounds); | 64 pathSBounds.roundOut(&pathIBounds); |
| 65 *devPathBounds = *devClipBounds; |
| 67 if (!devPathBounds->intersect(pathIBounds)) { | 66 if (!devPathBounds->intersect(pathIBounds)) { |
| 68 // set the correct path bounds, as this would be used later. | 67 // set the correct path bounds, as this would be used later. |
| 69 *devPathBounds = pathIBounds; | 68 *devPathBounds = pathIBounds; |
| 70 return false; | 69 return false; |
| 71 } | 70 } |
| 72 } else { | 71 } else { |
| 73 *devPathBounds = SkIRect::EmptyIRect(); | 72 *devPathBounds = SkIRect::EmptyIRect(); |
| 74 return false; | 73 return false; |
| 75 } | 74 } |
| 76 return true; | 75 return true; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, ©, color, view
Matrix, | 148 GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, ©, color, view
Matrix, |
| 150 devPathBounds); | 149 devPathBounds); |
| 151 | 150 |
| 152 if (path.isInverseFillType()) { | 151 if (path.isInverseFillType()) { |
| 153 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClip
Bounds, | 152 draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClip
Bounds, |
| 154 devPathBounds); | 153 devPathBounds); |
| 155 } | 154 } |
| 156 | 155 |
| 157 return true; | 156 return true; |
| 158 } | 157 } |
| OLD | NEW |