OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 "GrDrawTarget.h" | 9 #include "GrDrawTarget.h" |
10 | 10 |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 static const GrStencilSettings& even_odd_path_stencil_settings() { | 557 static const GrStencilSettings& even_odd_path_stencil_settings() { |
558 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, | 558 GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings, |
559 kInvert_StencilOp, | 559 kInvert_StencilOp, |
560 kInvert_StencilOp, | 560 kInvert_StencilOp, |
561 kAlwaysIfInClip_StencilFunc, | 561 kAlwaysIfInClip_StencilFunc, |
562 0xFFFF, 0xFFFF, 0xFFFF); | 562 0xFFFF, 0xFFFF, 0xFFFF); |
563 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); | 563 return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings); |
564 } | 564 } |
565 | 565 |
566 void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType f
ill, | 566 void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType f
ill, |
567 const GrStencilBuffer* sb, | 567 const GrStencilAttachment*
sb, |
568 GrStencilSettings* outStenc
ilSettings) { | 568 GrStencilSettings* outStenc
ilSettings) { |
569 | 569 |
570 switch (fill) { | 570 switch (fill) { |
571 default: | 571 default: |
572 SkFAIL("Unexpected path fill."); | 572 SkFAIL("Unexpected path fill."); |
573 case GrPathRendering::kWinding_FillType: | 573 case GrPathRendering::kWinding_FillType: |
574 *outStencilSettings = winding_path_stencil_settings(); | 574 *outStencilSettings = winding_path_stencil_settings(); |
575 break; | 575 break; |
576 case GrPathRendering::kEvenOdd_FillType: | 576 case GrPathRendering::kEvenOdd_FillType: |
577 *outStencilSettings = even_odd_path_stencil_settings(); | 577 *outStencilSettings = even_odd_path_stencil_settings(); |
(...skipping 15 matching lines...) Expand all Loading... |
593 GrScissorState scissorState; | 593 GrScissorState scissorState; |
594 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; | 594 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; |
595 GrPipelineBuilder::AutoRestoreStencil ars; | 595 GrPipelineBuilder::AutoRestoreStencil ars; |
596 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, NULL)) { | 596 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, NULL)) { |
597 return; | 597 return; |
598 } | 598 } |
599 | 599 |
600 // set stencil settings for path | 600 // set stencil settings for path |
601 GrStencilSettings stencilSettings; | 601 GrStencilSettings stencilSettings; |
602 GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); | 602 GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); |
603 GrStencilBuffer* sb = rt->renderTargetPriv().attachStencilBuffer(); | 603 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
604 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 604 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
605 | 605 |
606 this->onStencilPath(*pipelineBuilder, pathProc, path, scissorState, stencilS
ettings); | 606 this->onStencilPath(*pipelineBuilder, pathProc, path, scissorState, stencilS
ettings); |
607 } | 607 } |
608 | 608 |
609 void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder, | 609 void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder, |
610 const GrPathProcessor* pathProc, | 610 const GrPathProcessor* pathProc, |
611 const GrPath* path, | 611 const GrPath* path, |
612 GrPathRendering::FillType fill) { | 612 GrPathRendering::FillType fill) { |
613 // TODO: extract portions of checkDraw that are relevant to path rendering. | 613 // TODO: extract portions of checkDraw that are relevant to path rendering. |
614 SkASSERT(path); | 614 SkASSERT(path); |
615 SkASSERT(this->caps()->pathRenderingSupport()); | 615 SkASSERT(this->caps()->pathRenderingSupport()); |
616 SkASSERT(pipelineBuilder); | 616 SkASSERT(pipelineBuilder); |
617 | 617 |
618 SkRect devBounds = path->getBounds(); | 618 SkRect devBounds = path->getBounds(); |
619 pathProc->viewMatrix().mapRect(&devBounds); | 619 pathProc->viewMatrix().mapRect(&devBounds); |
620 | 620 |
621 // Setup clip | 621 // Setup clip |
622 GrScissorState scissorState; | 622 GrScissorState scissorState; |
623 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; | 623 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; |
624 GrPipelineBuilder::AutoRestoreStencil ars; | 624 GrPipelineBuilder::AutoRestoreStencil ars; |
625 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, &devBounds
)) { | 625 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, &devBounds
)) { |
626 return; | 626 return; |
627 } | 627 } |
628 | 628 |
629 // set stencil settings for path | 629 // set stencil settings for path |
630 GrStencilSettings stencilSettings; | 630 GrStencilSettings stencilSettings; |
631 GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); | 631 GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); |
632 GrStencilBuffer* sb = rt->renderTargetPriv().attachStencilBuffer(); | 632 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
633 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 633 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
634 | 634 |
635 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path
Proc, &devBounds, | 635 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path
Proc, &devBounds, |
636 this); | 636 this); |
637 if (pipelineInfo.mustSkipDraw()) { | 637 if (pipelineInfo.mustSkipDraw()) { |
638 return; | 638 return; |
639 } | 639 } |
640 | 640 |
641 this->onDrawPath(pathProc, path, stencilSettings, pipelineInfo); | 641 this->onDrawPath(pathProc, path, stencilSettings, pipelineInfo); |
642 } | 642 } |
(...skipping 19 matching lines...) Expand all Loading... |
662 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; | 662 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; |
663 GrPipelineBuilder::AutoRestoreStencil ars; | 663 GrPipelineBuilder::AutoRestoreStencil ars; |
664 | 664 |
665 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, NULL)) { | 665 if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, NULL)) { |
666 return; | 666 return; |
667 } | 667 } |
668 | 668 |
669 // set stencil settings for path | 669 // set stencil settings for path |
670 GrStencilSettings stencilSettings; | 670 GrStencilSettings stencilSettings; |
671 GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); | 671 GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); |
672 GrStencilBuffer* sb = rt->renderTargetPriv().attachStencilBuffer(); | 672 GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); |
673 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 673 this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); |
674 | 674 |
675 // Don't compute a bounding box for dst copy texture, we'll opt | 675 // Don't compute a bounding box for dst copy texture, we'll opt |
676 // instead for it to just copy the entire dst. Realistically this is a moot | 676 // instead for it to just copy the entire dst. Realistically this is a moot |
677 // point, because any context that supports NV_path_rendering will also | 677 // point, because any context that supports NV_path_rendering will also |
678 // support NV_blend_equation_advanced. | 678 // support NV_blend_equation_advanced. |
679 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path
Proc, NULL, this); | 679 GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path
Proc, NULL, this); |
680 if (pipelineInfo.mustSkipDraw()) { | 680 if (pipelineInfo.mustSkipDraw()) { |
681 return; | 681 return; |
682 } | 682 } |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, | 1260 GrPipelineBuilder::AutoRestoreFragmentProcessors* a
rfp, |
1261 GrPipelineBuilder::AutoRestoreStencil* ars, | 1261 GrPipelineBuilder::AutoRestoreStencil* ars, |
1262 GrScissorState* scissorState, | 1262 GrScissorState* scissorState, |
1263 const SkRect* devBounds) { | 1263 const SkRect* devBounds) { |
1264 return fClipMaskManager.setupClipping(pipelineBuilder, | 1264 return fClipMaskManager.setupClipping(pipelineBuilder, |
1265 arfp, | 1265 arfp, |
1266 ars, | 1266 ars, |
1267 scissorState, | 1267 scissorState, |
1268 devBounds); | 1268 devBounds); |
1269 } | 1269 } |
OLD | NEW |