OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "GrMSAAPathRenderer.h" | 8 #include "GrMSAAPathRenderer.h" |
9 | 9 |
10 #include "GrAuditTrail.h" | 10 #include "GrAuditTrail.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 219 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
220 | 220 |
221 typedef GrGeometryProcessor INHERITED; | 221 typedef GrGeometryProcessor INHERITED; |
222 }; | 222 }; |
223 | 223 |
224 class MSAAPathBatch : public GrVertexBatch { | 224 class MSAAPathBatch : public GrVertexBatch { |
225 public: | 225 public: |
226 DEFINE_BATCH_CLASS_ID | 226 DEFINE_BATCH_CLASS_ID |
227 | 227 |
228 MSAAPathBatch(GrColor color, const SkPath& path, const SkMatrix& viewMatrix) | 228 MSAAPathBatch(GrColor color, const SkPath& path, const SkMatrix& viewMatrix, |
| 229 const SkRect& devBounds) |
229 : INHERITED(ClassID()) | 230 : INHERITED(ClassID()) |
230 , fViewMatrix(viewMatrix) { | 231 , fViewMatrix(viewMatrix) { |
231 fPaths.emplace_back(PathInfo{color, path}); | 232 fPaths.emplace_back(PathInfo{color, path}); |
232 this->setTransformedBounds(path.getBounds(), viewMatrix, HasAABloat::kNo
, IsZeroArea::kNo); | 233 this->setBounds(devBounds, HasAABloat::kNo, IsZeroArea::kNo); |
233 int contourCount; | 234 int contourCount; |
234 this->computeWorstCasePointCount(path, &contourCount, &fMaxLineVertices,
&fMaxQuadVertices); | 235 this->computeWorstCasePointCount(path, &contourCount, &fMaxLineVertices,
&fMaxQuadVertices); |
235 fMaxLineIndices = fMaxLineVertices * 3; | 236 fMaxLineIndices = fMaxLineVertices * 3; |
236 fMaxQuadIndices = fMaxQuadVertices * 3; | 237 fMaxQuadIndices = fMaxQuadVertices * 3; |
237 fIsIndexed = contourCount > 1; | 238 fIsIndexed = contourCount > 1; |
238 } | 239 } |
239 | 240 |
240 const char* name() const override { return "MSAAPathBatch"; } | 241 const char* name() const override { return "MSAAPathBatch"; } |
241 | 242 |
242 void computePipelineOptimizations(GrInitInvariantOutput* color, | 243 void computePipelineOptimizations(GrInitInvariantOutput* color, |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 pipelineBuilder.setDrawFace(drawFace[p]); | 662 pipelineBuilder.setDrawFace(drawFace[p]); |
662 if (passes[p]) { | 663 if (passes[p]) { |
663 pipelineBuilder.setUserStencil(passes[p]); | 664 pipelineBuilder.setUserStencil(passes[p]); |
664 } else { | 665 } else { |
665 pipelineBuilder.setUserStencil(userStencilSettings); | 666 pipelineBuilder.setUserStencil(userStencilSettings); |
666 } | 667 } |
667 | 668 |
668 drawContext->drawBatch(pipelineBuilder, clip, batch); | 669 drawContext->drawBatch(pipelineBuilder, clip, batch); |
669 } else { | 670 } else { |
670 SkAutoTUnref<MSAAPathBatch> batch(new MSAAPathBatch(paint.getColor()
, path, | 671 SkAutoTUnref<MSAAPathBatch> batch(new MSAAPathBatch(paint.getColor()
, path, |
671 viewMatrix)); | 672 viewMatrix, devB
ounds)); |
672 if (!batch->isValid()) { | 673 if (!batch->isValid()) { |
673 return false; | 674 return false; |
674 } | 675 } |
675 | 676 |
676 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa
int)); | 677 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa
int)); |
677 pipelineBuilder.setDrawFace(drawFace[p]); | 678 pipelineBuilder.setDrawFace(drawFace[p]); |
678 if (passes[p]) { | 679 if (passes[p]) { |
679 pipelineBuilder.setUserStencil(passes[p]); | 680 pipelineBuilder.setUserStencil(passes[p]); |
680 } else { | 681 } else { |
681 pipelineBuilder.setUserStencil(userStencilSettings); | 682 pipelineBuilder.setUserStencil(userStencilSettings); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 | 725 |
725 GrPaint paint; | 726 GrPaint paint; |
726 paint.setXPFactory(GrDisableColorXPFactory::Make()); | 727 paint.setXPFactory(GrDisableColorXPFactory::Make()); |
727 paint.setAntiAlias(args.fIsAA); | 728 paint.setAntiAlias(args.fIsAA); |
728 | 729 |
729 this->internalDrawPath(args.fDrawContext, paint, &GrUserStencilSettings::kUn
used, *args.fClip, | 730 this->internalDrawPath(args.fDrawContext, paint, &GrUserStencilSettings::kUn
used, *args.fClip, |
730 *args.fViewMatrix, *args.fShape, true); | 731 *args.fViewMatrix, *args.fShape, true); |
731 } | 732 } |
732 | 733 |
733 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 734 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
OLD | NEW |