| 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 | 
| 11 #include "GrBatch.h" | 11 #include "GrBatch.h" | 
| 12 #include "GrContext.h" | 12 #include "GrContext.h" | 
| 13 #include "GrDrawTargetCaps.h" | 13 #include "GrDrawTargetCaps.h" | 
| 14 #include "GrPath.h" | 14 #include "GrPath.h" | 
| 15 #include "GrPipeline.h" | 15 #include "GrPipeline.h" | 
| 16 #include "GrRenderTarget.h" | 16 #include "GrRenderTarget.h" | 
|  | 17 #include "GrRenderTargetPriv.h" | 
| 17 #include "GrSurfacePriv.h" | 18 #include "GrSurfacePriv.h" | 
| 18 #include "GrTemplates.h" | 19 #include "GrTemplates.h" | 
| 19 #include "GrTexture.h" | 20 #include "GrTexture.h" | 
| 20 #include "GrVertexBuffer.h" | 21 #include "GrVertexBuffer.h" | 
| 21 | 22 | 
| 22 #include "SkStrokeRec.h" | 23 #include "SkStrokeRec.h" | 
| 23 | 24 | 
| 24 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// | 
| 25 | 26 | 
| 26 GrDrawTarget::DrawInfo& GrDrawTarget::DrawInfo::operator =(const DrawInfo& di) { | 27 GrDrawTarget::DrawInfo& GrDrawTarget::DrawInfo::operator =(const DrawInfo& di) { | 
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 600     // Setup clip | 601     // Setup clip | 
| 601     GrScissorState scissorState; | 602     GrScissorState scissorState; | 
| 602     GrPipelineBuilder::AutoRestoreEffects are; | 603     GrPipelineBuilder::AutoRestoreEffects are; | 
| 603     GrPipelineBuilder::AutoRestoreStencil ars; | 604     GrPipelineBuilder::AutoRestoreStencil ars; | 
| 604     if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, NULL)) { | 605     if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, NULL)) { | 
| 605         return; | 606         return; | 
| 606     } | 607     } | 
| 607 | 608 | 
| 608     // set stencil settings for path | 609     // set stencil settings for path | 
| 609     GrStencilSettings stencilSettings; | 610     GrStencilSettings stencilSettings; | 
| 610     this->getPathStencilSettingsForFilltype(fill, | 611     GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); | 
| 611                                             pipelineBuilder->getRenderTarget()->
      getStencilBuffer(), | 612     GrStencilBuffer* sb = rt->renderTargetPriv().attachStencilBuffer(); | 
| 612                                             &stencilSettings); | 613     this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 
| 613 | 614 | 
| 614     this->onStencilPath(*pipelineBuilder, pathProc, path, scissorState, stencilS
      ettings); | 615     this->onStencilPath(*pipelineBuilder, pathProc, path, scissorState, stencilS
      ettings); | 
| 615 } | 616 } | 
| 616 | 617 | 
| 617 void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder, | 618 void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder, | 
| 618                             const GrPathProcessor* pathProc, | 619                             const GrPathProcessor* pathProc, | 
| 619                             const GrPath* path, | 620                             const GrPath* path, | 
| 620                             GrPathRendering::FillType fill) { | 621                             GrPathRendering::FillType fill) { | 
| 621     // TODO: extract portions of checkDraw that are relevant to path rendering. | 622     // TODO: extract portions of checkDraw that are relevant to path rendering. | 
| 622     SkASSERT(path); | 623     SkASSERT(path); | 
| 623     SkASSERT(this->caps()->pathRenderingSupport()); | 624     SkASSERT(this->caps()->pathRenderingSupport()); | 
| 624     SkASSERT(pipelineBuilder); | 625     SkASSERT(pipelineBuilder); | 
| 625 | 626 | 
| 626     SkRect devBounds = path->getBounds(); | 627     SkRect devBounds = path->getBounds(); | 
| 627     pathProc->viewMatrix().mapRect(&devBounds); | 628     pathProc->viewMatrix().mapRect(&devBounds); | 
| 628 | 629 | 
| 629     // Setup clip | 630     // Setup clip | 
| 630     GrScissorState scissorState; | 631     GrScissorState scissorState; | 
| 631     GrPipelineBuilder::AutoRestoreEffects are; | 632     GrPipelineBuilder::AutoRestoreEffects are; | 
| 632     GrPipelineBuilder::AutoRestoreStencil ars; | 633     GrPipelineBuilder::AutoRestoreStencil ars; | 
| 633     if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, &devBounds)
      ) { | 634     if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, &devBounds)
      ) { | 
| 634        return; | 635        return; | 
| 635     } | 636     } | 
| 636 | 637 | 
| 637     // set stencil settings for path | 638     // set stencil settings for path | 
| 638     GrStencilSettings stencilSettings; | 639     GrStencilSettings stencilSettings; | 
| 639     this->getPathStencilSettingsForFilltype(fill, | 640     GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); | 
| 640                                             pipelineBuilder->getRenderTarget()->
      getStencilBuffer(), | 641     GrStencilBuffer* sb = rt->renderTargetPriv().attachStencilBuffer(); | 
| 641                                             &stencilSettings); | 642     this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 
| 642 | 643 | 
| 643     GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path
      Proc, &devBounds, | 644     GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path
      Proc, &devBounds, | 
| 644                                             this); | 645                                             this); | 
| 645     if (pipelineInfo.mustSkipDraw()) { | 646     if (pipelineInfo.mustSkipDraw()) { | 
| 646         return; | 647         return; | 
| 647     } | 648     } | 
| 648 | 649 | 
| 649     this->onDrawPath(pathProc, path, stencilSettings, pipelineInfo); | 650     this->onDrawPath(pathProc, path, stencilSettings, pipelineInfo); | 
| 650 } | 651 } | 
| 651 | 652 | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 669     GrScissorState scissorState; | 670     GrScissorState scissorState; | 
| 670     GrPipelineBuilder::AutoRestoreEffects are; | 671     GrPipelineBuilder::AutoRestoreEffects are; | 
| 671     GrPipelineBuilder::AutoRestoreStencil ars; | 672     GrPipelineBuilder::AutoRestoreStencil ars; | 
| 672 | 673 | 
| 673     if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, NULL)) { | 674     if (!this->setupClip(pipelineBuilder, &are, &ars, &scissorState, NULL)) { | 
| 674         return; | 675         return; | 
| 675     } | 676     } | 
| 676 | 677 | 
| 677     // set stencil settings for path | 678     // set stencil settings for path | 
| 678     GrStencilSettings stencilSettings; | 679     GrStencilSettings stencilSettings; | 
| 679     this->getPathStencilSettingsForFilltype(fill, | 680     GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); | 
| 680                                             pipelineBuilder->getRenderTarget()->
      getStencilBuffer(), | 681     GrStencilBuffer* sb = rt->renderTargetPriv().attachStencilBuffer(); | 
| 681                                             &stencilSettings); | 682     this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); | 
| 682 | 683 | 
| 683     // Don't compute a bounding box for dst copy texture, we'll opt | 684     // Don't compute a bounding box for dst copy texture, we'll opt | 
| 684     // instead for it to just copy the entire dst. Realistically this is a moot | 685     // instead for it to just copy the entire dst. Realistically this is a moot | 
| 685     // point, because any context that supports NV_path_rendering will also | 686     // point, because any context that supports NV_path_rendering will also | 
| 686     // support NV_blend_equation_advanced. | 687     // support NV_blend_equation_advanced. | 
| 687     GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path
      Proc, NULL, this); | 688     GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, path
      Proc, NULL, this); | 
| 688     if (pipelineInfo.mustSkipDraw()) { | 689     if (pipelineInfo.mustSkipDraw()) { | 
| 689         return; | 690         return; | 
| 690     } | 691     } | 
| 691 | 692 | 
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1290                              GrPipelineBuilder::AutoRestoreStencil* ars, | 1291                              GrPipelineBuilder::AutoRestoreStencil* ars, | 
| 1291                              GrScissorState* scissorState, | 1292                              GrScissorState* scissorState, | 
| 1292                              const SkRect* devBounds) { | 1293                              const SkRect* devBounds) { | 
| 1293     return fClipMaskManager.setupClipping(pipelineBuilder, | 1294     return fClipMaskManager.setupClipping(pipelineBuilder, | 
| 1294                                           are, | 1295                                           are, | 
| 1295                                           ars, | 1296                                           ars, | 
| 1296                                           scissorState, | 1297                                           scissorState, | 
| 1297                                           this->getClip(), | 1298                                           this->getClip(), | 
| 1298                                           devBounds); | 1299                                           devBounds); | 
| 1299 } | 1300 } | 
| OLD | NEW | 
|---|