| 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 "GrAuditTrail.h" | 9 #include "GrAuditTrail.h" |
| 10 #include "GrClip.h" | 10 #include "GrClip.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 return true; | 57 return true; |
| 58 } | 58 } |
| 59 | 59 |
| 60 //////////////////////////////////////////////////////////////////////////////// | 60 //////////////////////////////////////////////////////////////////////////////// |
| 61 | 61 |
| 62 } | 62 } |
| 63 | 63 |
| 64 void GrSoftwarePathRenderer::DrawNonAARect(GrDrawContext* drawContext, | 64 void GrSoftwarePathRenderer::DrawNonAARect(GrDrawContext* drawContext, |
| 65 const GrPaint& paint, | 65 const GrPaint& paint, |
| 66 const GrUserStencilSettings* userSten
cilSettings, | 66 const GrUserStencilSettings& userSten
cilSettings, |
| 67 const GrClip& clip, | 67 const GrClip& clip, |
| 68 const SkMatrix& viewMatrix, | 68 const SkMatrix& viewMatrix, |
| 69 const SkRect& rect, | 69 const SkRect& rect, |
| 70 const SkMatrix& localMatrix) { | 70 const SkMatrix& localMatrix) { |
| 71 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.ge
tColor(), | 71 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.ge
tColor(), |
| 72 viewMatr
ix, rect, | 72 viewMatr
ix, rect, |
| 73 nullptr,
&localMatrix)); | 73 nullptr,
&localMatrix)); |
| 74 | 74 |
| 75 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint)); | 75 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint)); |
| 76 pipelineBuilder.setUserStencil(userStencilSettings); | 76 pipelineBuilder.setUserStencil(&userStencilSettings); |
| 77 | 77 |
| 78 drawContext->drawBatch(pipelineBuilder, clip, batch); | 78 drawContext->drawBatch(pipelineBuilder, clip, batch); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void GrSoftwarePathRenderer::DrawAroundInvPath(GrDrawContext* drawContext, | 81 void GrSoftwarePathRenderer::DrawAroundInvPath(GrDrawContext* drawContext, |
| 82 const GrPaint& paint, | 82 const GrPaint& paint, |
| 83 const GrUserStencilSettings* user
StencilSettings, | 83 const GrUserStencilSettings& user
StencilSettings, |
| 84 const GrClip& clip, | 84 const GrClip& clip, |
| 85 const SkMatrix& viewMatrix, | 85 const SkMatrix& viewMatrix, |
| 86 const SkIRect& devClipBounds, | 86 const SkIRect& devClipBounds, |
| 87 const SkIRect& devPathBounds) { | 87 const SkIRect& devPathBounds) { |
| 88 SkMatrix invert; | 88 SkMatrix invert; |
| 89 if (!viewMatrix.invert(&invert)) { | 89 if (!viewMatrix.invert(&invert)) { |
| 90 return; | 90 return; |
| 91 } | 91 } |
| 92 | 92 |
| 93 SkRect rect; | 93 SkRect rect; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 bool inverseFilled = false; | 130 bool inverseFilled = false; |
| 131 SkTLazy<GrShape> tmpShape; | 131 SkTLazy<GrShape> tmpShape; |
| 132 SkASSERT(!args.fShape->style().applies()) | 132 SkASSERT(!args.fShape->style().applies()) |
| 133 inverseFilled = args.fShape->inverseFilled(); | 133 inverseFilled = args.fShape->inverseFilled(); |
| 134 | 134 |
| 135 SkIRect devShapeBounds, devClipBounds; | 135 SkIRect devShapeBounds, devClipBounds; |
| 136 if (!get_shape_and_clip_bounds(args.fDrawContext->width(), args.fDrawContext
->height(), | 136 if (!get_shape_and_clip_bounds(args.fDrawContext->width(), args.fDrawContext
->height(), |
| 137 *args.fClip, *args.fShape, | 137 *args.fClip, *args.fShape, |
| 138 *args.fViewMatrix, &devShapeBounds, &devClipB
ounds)) { | 138 *args.fViewMatrix, &devShapeBounds, &devClipB
ounds)) { |
| 139 if (inverseFilled) { | 139 if (inverseFilled) { |
| 140 DrawAroundInvPath(args.fDrawContext, *args.fPaint, args.fUserStencil
Settings, | 140 DrawAroundInvPath(args.fDrawContext, *args.fPaint, *args.fUserStenci
lSettings, |
| 141 *args.fClip, | 141 *args.fClip, |
| 142 *args.fViewMatrix, devClipBounds, devShapeBounds); | 142 *args.fViewMatrix, devClipBounds, devShapeBounds); |
| 143 | 143 |
| 144 } | 144 } |
| 145 return true; | 145 return true; |
| 146 } | 146 } |
| 147 | 147 |
| 148 SkAutoTUnref<GrTexture> texture( | 148 SkAutoTUnref<GrTexture> texture( |
| 149 GrSWMaskHelper::DrawShapeMaskToTexture(fTexProvider, *args.fShape, d
evShapeBounds, | 149 GrSWMaskHelper::DrawShapeMaskToTexture(fTexProvider, *args.fShape, d
evShapeBounds, |
| 150 args.fAntiAlias, args.fViewMa
trix)); | 150 args.fAntiAlias, args.fViewMa
trix)); |
| 151 if (nullptr == texture) { | 151 if (!texture) { |
| 152 return false; | 152 return false; |
| 153 } | 153 } |
| 154 | 154 |
| 155 GrSWMaskHelper::DrawToTargetWithShapeMask(texture, args.fDrawContext, *args.
fPaint, | 155 GrSWMaskHelper::DrawToTargetWithShapeMask(texture, args.fDrawContext, *args.
fPaint, |
| 156 args.fUserStencilSettings, | 156 *args.fUserStencilSettings, |
| 157 *args.fClip, *args.fViewMatrix, | 157 *args.fClip, *args.fViewMatrix, |
| 158 devShapeBounds); | 158 devShapeBounds); |
| 159 | 159 |
| 160 if (inverseFilled) { | 160 if (inverseFilled) { |
| 161 DrawAroundInvPath(args.fDrawContext, *args.fPaint, args.fUserStencilSett
ings, | 161 DrawAroundInvPath(args.fDrawContext, *args.fPaint, *args.fUserStencilSet
tings, |
| 162 *args.fClip, | 162 *args.fClip, |
| 163 *args.fViewMatrix, devClipBounds, devShapeBounds); | 163 *args.fViewMatrix, devClipBounds, devShapeBounds); |
| 164 } | 164 } |
| 165 | 165 |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| OLD | NEW |