OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
11 #include "GrBatchTest.h" | 11 #include "GrBatchTest.h" |
12 #include "GrContext.h" | 12 #include "GrContext.h" |
13 #include "GrDefaultGeoProcFactory.h" | 13 #include "GrDefaultGeoProcFactory.h" |
14 #include "GrMesh.h" | 14 #include "GrMesh.h" |
15 #include "GrPathUtils.h" | 15 #include "GrPathUtils.h" |
| 16 #include "GrPipelineBuilder.h" |
16 #include "SkGeometry.h" | 17 #include "SkGeometry.h" |
17 #include "SkString.h" | 18 #include "SkString.h" |
18 #include "SkStrokeRec.h" | 19 #include "SkStrokeRec.h" |
19 #include "SkTLazy.h" | 20 #include "SkTLazy.h" |
20 #include "SkTraceEvent.h" | 21 #include "SkTraceEvent.h" |
21 | 22 |
22 #include "batches/GrRectBatchFactory.h" | 23 #include "batches/GrRectBatchFactory.h" |
23 #include "batches/GrVertexBatch.h" | 24 #include "batches/GrVertexBatch.h" |
24 | 25 |
25 GrDefaultPathRenderer::GrDefaultPathRenderer(bool separateStencilSupport, | 26 GrDefaultPathRenderer::GrDefaultPathRenderer(bool separateStencilSupport, |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 } else { | 548 } else { |
548 bounds = path.getBounds(); | 549 bounds = path.getBounds(); |
549 } | 550 } |
550 const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? S
kMatrix::I() : | 551 const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? S
kMatrix::I() : |
551 v
iewMatrix; | 552 v
iewMatrix; |
552 SkAutoTUnref<GrDrawBatch> batch( | 553 SkAutoTUnref<GrDrawBatch> batch( |
553 GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM,
bounds, nullptr, | 554 GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM,
bounds, nullptr, |
554 &localMatrix)); | 555 &localMatrix)); |
555 | 556 |
556 SkASSERT(GrDrawFace::kBoth == drawFace[p]); | 557 SkASSERT(GrDrawFace::kBoth == drawFace[p]); |
557 drawContext->drawBatch(paint, clip, *passes[p], batch, drawFace[p]); | 558 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa
int)); |
| 559 pipelineBuilder.setDrawFace(drawFace[p]); |
| 560 pipelineBuilder.setUserStencil(passes[p]); |
| 561 |
| 562 drawContext->drawBatch(pipelineBuilder, clip, batch); |
558 } else { | 563 } else { |
559 SkAutoTUnref<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor(
), path, | 564 SkAutoTUnref<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor(
), path, |
560 srcSpaceTol, | 565 srcSpaceTol, |
561 newCoverage, vi
ewMatrix, | 566 newCoverage, vi
ewMatrix, |
562 isHairline, dev
Bounds)); | 567 isHairline, dev
Bounds)); |
563 | 568 |
564 SkTCopyOnFirstWrite<GrPaint> newPaint(paint); | 569 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa
int)); |
| 570 pipelineBuilder.setDrawFace(drawFace[p]); |
| 571 pipelineBuilder.setUserStencil(passes[p]); |
565 if (passCount > 1) { | 572 if (passCount > 1) { |
566 newPaint.writable()->setXPFactory(GrDisableColorXPFactory::Make(
)); | 573 pipelineBuilder.setDisableColorXPFactory(); |
567 } | 574 } |
568 | 575 |
569 drawContext->drawBatch(*newPaint, clip, *passes[p], batch, drawFace[
p]); | 576 drawContext->drawBatch(pipelineBuilder, clip, batch); |
570 } | 577 } |
571 } | 578 } |
572 return true; | 579 return true; |
573 } | 580 } |
574 | 581 |
575 bool GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { | 582 bool GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
576 // this class can draw any path with any simple fill style but doesn't do an
y anti-aliasing. | 583 // this class can draw any path with any simple fill style but doesn't do an
y anti-aliasing. |
577 return !args.fAntiAlias && | 584 return !args.fAntiAlias && |
578 (args.fShape->style().isSimpleFill() || | 585 (args.fShape->style().isSimpleFill() || |
579 IsStrokeHairlineOrEquivalent(args.fShape->style(), *args.fViewMatrix
, nullptr)); | 586 IsStrokeHairlineOrEquivalent(args.fShape->style(), *args.fViewMatrix
, nullptr)); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 SkRect bounds = path.getBounds(); | 628 SkRect bounds = path.getBounds(); |
622 SkScalar tol = GrPathUtils::kDefaultTolerance; | 629 SkScalar tol = GrPathUtils::kDefaultTolerance; |
623 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bou
nds); | 630 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bou
nds); |
624 | 631 |
625 viewMatrix.mapRect(&bounds); | 632 viewMatrix.mapRect(&bounds); |
626 uint8_t coverage = GrRandomCoverage(random); | 633 uint8_t coverage = GrRandomCoverage(random); |
627 return new DefaultPathBatch(color, path, srcSpaceTol, coverage, viewMatrix,
true, bounds); | 634 return new DefaultPathBatch(color, path, srcSpaceTol, coverage, viewMatrix,
true, bounds); |
628 } | 635 } |
629 | 636 |
630 #endif | 637 #endif |
OLD | NEW |