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" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 const GrUserStencilSettings* passes[3]; | 435 const GrUserStencilSettings* passes[3]; |
436 GrPipelineBuilder::DrawFace drawFace[3]; | 436 GrPipelineBuilder::DrawFace drawFace[3]; |
437 bool reverse = false; | 437 bool reverse = false; |
438 bool lastPassIsBounds; | 438 bool lastPassIsBounds; |
439 | 439 |
440 if (isHairline) { | 440 if (isHairline) { |
441 passCount = 1; | 441 passCount = 1; |
442 if (stencilOnly) { | 442 if (stencilOnly) { |
443 passes[0] = &gDirectToStencil; | 443 passes[0] = &gDirectToStencil; |
444 } else { | 444 } else { |
445 passes[0] = nullptr; | 445 passes[0] = userStencilSettings; |
446 } | 446 } |
447 lastPassIsBounds = false; | 447 lastPassIsBounds = false; |
448 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; | 448 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
449 } else { | 449 } else { |
450 if (single_pass_shape(shape)) { | 450 if (single_pass_shape(shape)) { |
451 passCount = 1; | 451 passCount = 1; |
452 if (stencilOnly) { | 452 if (stencilOnly) { |
453 passes[0] = &gDirectToStencil; | 453 passes[0] = &gDirectToStencil; |
454 } else { | 454 } else { |
455 passes[0] = nullptr; | 455 passes[0] = userStencilSettings; |
456 } | 456 } |
457 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; | 457 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
458 lastPassIsBounds = false; | 458 lastPassIsBounds = false; |
459 } else { | 459 } else { |
460 switch (path.getFillType()) { | 460 switch (path.getFillType()) { |
461 case SkPath::kInverseEvenOdd_FillType: | 461 case SkPath::kInverseEvenOdd_FillType: |
462 reverse = true; | 462 reverse = true; |
463 // fallthrough | 463 // fallthrough |
464 case SkPath::kEvenOdd_FillType: | 464 case SkPath::kEvenOdd_FillType: |
465 passes[0] = &gEOStencilPass; | 465 passes[0] = &gEOStencilPass; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 550 } |
551 const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? S
kMatrix::I() : | 551 const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? S
kMatrix::I() : |
552 v
iewMatrix; | 552 v
iewMatrix; |
553 SkAutoTUnref<GrDrawBatch> batch( | 553 SkAutoTUnref<GrDrawBatch> batch( |
554 GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM,
bounds, nullptr, | 554 GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM,
bounds, nullptr, |
555 &localMatrix)); | 555 &localMatrix)); |
556 | 556 |
557 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == drawFace[p]); | 557 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == drawFace[p]); |
558 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa
int)); | 558 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa
int)); |
559 pipelineBuilder.setDrawFace(drawFace[p]); | 559 pipelineBuilder.setDrawFace(drawFace[p]); |
560 if (passes[p]) { | 560 pipelineBuilder.setUserStencil(passes[p]); |
561 pipelineBuilder.setUserStencil(passes[p]); | |
562 } else { | |
563 pipelineBuilder.setUserStencil(userStencilSettings); | |
564 } | |
565 | 561 |
566 drawContext->drawBatch(pipelineBuilder, clip, batch); | 562 drawContext->drawBatch(pipelineBuilder, clip, batch); |
567 } else { | 563 } else { |
568 SkAutoTUnref<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor(
), path, | 564 SkAutoTUnref<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor(
), path, |
569 srcSpaceTol, | 565 srcSpaceTol, |
570 newCoverage, vi
ewMatrix, | 566 newCoverage, vi
ewMatrix, |
571 isHairline, dev
Bounds)); | 567 isHairline, dev
Bounds)); |
572 | 568 |
573 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa
int)); | 569 GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(pa
int)); |
574 pipelineBuilder.setDrawFace(drawFace[p]); | 570 pipelineBuilder.setDrawFace(drawFace[p]); |
575 if (passes[p]) { | 571 pipelineBuilder.setUserStencil(passes[p]); |
576 pipelineBuilder.setUserStencil(passes[p]); | |
577 } else { | |
578 pipelineBuilder.setUserStencil(userStencilSettings); | |
579 } | |
580 if (passCount > 1) { | 572 if (passCount > 1) { |
581 pipelineBuilder.setDisableColorXPFactory(); | 573 pipelineBuilder.setDisableColorXPFactory(); |
582 } | 574 } |
583 | 575 |
584 drawContext->drawBatch(pipelineBuilder, clip, batch); | 576 drawContext->drawBatch(pipelineBuilder, clip, batch); |
585 } | 577 } |
586 } | 578 } |
587 return true; | 579 return true; |
588 } | 580 } |
589 | 581 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 SkRect bounds = path.getBounds(); | 628 SkRect bounds = path.getBounds(); |
637 SkScalar tol = GrPathUtils::kDefaultTolerance; | 629 SkScalar tol = GrPathUtils::kDefaultTolerance; |
638 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bou
nds); | 630 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bou
nds); |
639 | 631 |
640 viewMatrix.mapRect(&bounds); | 632 viewMatrix.mapRect(&bounds); |
641 uint8_t coverage = GrRandomCoverage(random); | 633 uint8_t coverage = GrRandomCoverage(random); |
642 return new DefaultPathBatch(color, path, srcSpaceTol, coverage, viewMatrix,
true, bounds); | 634 return new DefaultPathBatch(color, path, srcSpaceTol, coverage, viewMatrix,
true, bounds); |
643 } | 635 } |
644 | 636 |
645 #endif | 637 #endif |
OLD | NEW |