Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Side by Side Diff: src/gpu/GrClipMaskManager.cpp

Issue 1105263002: Remove vertex/index buffer factilities from GrDrawTarget. (Closed) Base URL: https://skia.googlesource.com/skia.git@josh
Patch Set: rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrBatchAtlas.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "GrClipMaskManager.h" 8 #include "GrClipMaskManager.h"
9 #include "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 #include "GrAAHairLinePathRenderer.h" 10 #include "GrAAHairLinePathRenderer.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 pipelineBuilder->setCoverageSetOpXPFactory(op, invertCoverage); 369 pipelineBuilder->setCoverageSetOpXPFactory(op, invertCoverage);
370 } 370 }
371 } 371 }
372 372
373 //////////////////////////////////////////////////////////////////////////////// 373 ////////////////////////////////////////////////////////////////////////////////
374 bool GrClipMaskManager::drawElement(GrPipelineBuilder* pipelineBuilder, 374 bool GrClipMaskManager::drawElement(GrPipelineBuilder* pipelineBuilder,
375 const SkMatrix& viewMatrix, 375 const SkMatrix& viewMatrix,
376 GrTexture* target, 376 GrTexture* target,
377 const SkClipStack::Element* element, 377 const SkClipStack::Element* element,
378 GrPathRenderer* pr) { 378 GrPathRenderer* pr) {
379 GrDrawTarget::AutoGeometryPush agp(fClipTarget);
380 379
381 pipelineBuilder->setRenderTarget(target->asRenderTarget()); 380 pipelineBuilder->setRenderTarget(target->asRenderTarget());
382 381
383 // The color we use to draw does not matter since we will always be using a GrCoverageSetOpXP 382 // The color we use to draw does not matter since we will always be using a GrCoverageSetOpXP
384 // which ignores color. 383 // which ignores color.
385 GrColor color = GrColor_WHITE; 384 GrColor color = GrColor_WHITE;
386 385
387 // TODO: Draw rrects directly here. 386 // TODO: Draw rrects directly here.
388 switch (element->getType()) { 387 switch (element->getType()) {
389 case Element::kEmpty_Type: 388 case Element::kEmpty_Type:
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 470
472 SkMatrix sampleM; 471 SkMatrix sampleM;
473 sampleM.setIDiv(srcMask->width(), srcMask->height()); 472 sampleM.setIDiv(srcMask->width(), srcMask->height());
474 473
475 pipelineBuilder->addCoverageProcessor( 474 pipelineBuilder->addCoverageProcessor(
476 GrTextureDomainEffect::Create(srcMask, 475 GrTextureDomainEffect::Create(srcMask,
477 sampleM, 476 sampleM,
478 GrTextureDomain::MakeTexelDomain(srcMask, srcBound), 477 GrTextureDomain::MakeTexelDomain(srcMask, srcBound),
479 GrTextureDomain::kDecal_Mode, 478 GrTextureDomain::kDecal_Mode,
480 GrTextureParams::kNone_FilterMode))->unref (); 479 GrTextureParams::kNone_FilterMode))->unref ();
481 // We need this AGP until everything is in GrBatch
482 GrDrawTarget::AutoGeometryPush agp(fClipTarget);
483 480
484 // The color passed in here does not matter since the coverageSetOpXP won't read it. 481 // The color passed in here does not matter since the coverageSetOpXP won't read it.
485 fClipTarget->drawSimpleRect(pipelineBuilder, 482 fClipTarget->drawSimpleRect(pipelineBuilder,
486 GrColor_WHITE, 483 GrColor_WHITE,
487 SkMatrix::I(), 484 SkMatrix::I(),
488 SkRect::Make(dstBound)); 485 SkRect::Make(dstBound));
489 } 486 }
490 487
491 GrTexture* GrClipMaskManager::createTempMask(int width, int height) { 488 GrTexture* GrClipMaskManager::createTempMask(int width, int height) {
492 GrSurfaceDesc desc; 489 GrSurfaceDesc desc;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 // Draw to the exterior pixels (those with a zero stencil value) . 663 // Draw to the exterior pixels (those with a zero stencil value) .
667 GR_STATIC_CONST_SAME_STENCIL(kDrawOutsideElement, 664 GR_STATIC_CONST_SAME_STENCIL(kDrawOutsideElement,
668 kZero_StencilOp, 665 kZero_StencilOp,
669 kZero_StencilOp, 666 kZero_StencilOp,
670 kEqual_StencilFunc, 667 kEqual_StencilFunc,
671 0xffff, 668 0xffff,
672 0x0000, 669 0x0000,
673 0xffff); 670 0xffff);
674 backgroundPipelineBuilder.setStencil(kDrawOutsideElement); 671 backgroundPipelineBuilder.setStencil(kDrawOutsideElement);
675 672
676 // We need this AGP until everything is in GrBatch
677 GrDrawTarget::AutoGeometryPush agp(fClipTarget);
678 // The color passed in here does not matter since the coverageSe tOpXP won't read it. 673 // The color passed in here does not matter since the coverageSe tOpXP won't read it.
679 fClipTarget->drawSimpleRect(&backgroundPipelineBuilder, GrColor_ WHITE, translate, 674 fClipTarget->drawSimpleRect(&backgroundPipelineBuilder, GrColor_ WHITE, translate,
680 clipSpaceIBounds); 675 clipSpaceIBounds);
681 } 676 }
682 } else { 677 } else {
683 GrPipelineBuilder pipelineBuilder; 678 GrPipelineBuilder pipelineBuilder;
684 679
685 // all the remaining ops can just be directly draw into the accumula tion buffer 680 // all the remaining ops can just be directly draw into the accumula tion buffer
686 set_coverage_drawing_xpf(op, false, &pipelineBuilder); 681 set_coverage_drawing_xpf(op, false, &pipelineBuilder);
687 // The color passed in here does not matter since the coverageSetOpX P won't read it. 682 // The color passed in here does not matter since the coverageSetOpX P won't read it.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 kIncClamp_StencilOp, 801 kIncClamp_StencilOp,
807 kIncClamp_StencilOp, 802 kIncClamp_StencilOp,
808 kAlways_StencilFunc, 803 kAlways_StencilFunc,
809 0xffff, 804 0xffff,
810 0x0000, 805 0x0000,
811 0xffff); 806 0xffff);
812 if (Element::kRect_Type == element->getType()) { 807 if (Element::kRect_Type == element->getType()) {
813 *pipelineBuilder.stencil() = gDrawToStencil; 808 *pipelineBuilder.stencil() = gDrawToStencil;
814 809
815 // We need this AGP until everything is in GrBatch 810 // We need this AGP until everything is in GrBatch
816 GrDrawTarget::AutoGeometryPush agp(fClipTarget);
817 fClipTarget->drawSimpleRect(&pipelineBuilder, 811 fClipTarget->drawSimpleRect(&pipelineBuilder,
818 GrColor_WHITE, 812 GrColor_WHITE,
819 viewMatrix, 813 viewMatrix,
820 element->getRect()); 814 element->getRect());
821 } else { 815 } else {
822 if (!clipPath.isEmpty()) { 816 if (!clipPath.isEmpty()) {
823 GrDrawTarget::AutoGeometryPush agp(fClipTarget);
824 if (canRenderDirectToStencil) { 817 if (canRenderDirectToStencil) {
825 *pipelineBuilder.stencil() = gDrawToStencil; 818 *pipelineBuilder.stencil() = gDrawToStencil;
826 pr->drawPath(fClipTarget, &pipelineBuilder, GrColor_ WHITE, 819 pr->drawPath(fClipTarget, &pipelineBuilder, GrColor_ WHITE,
827 viewMatrix, clipPath, stroke, false); 820 viewMatrix, clipPath, stroke, false);
828 } else { 821 } else {
829 pr->stencilPath(fClipTarget, &pipelineBuilder, viewM atrix, 822 pr->stencilPath(fClipTarget, &pipelineBuilder, viewM atrix,
830 clipPath, stroke); 823 clipPath, stroke);
831 } 824 }
832 } 825 }
833 } 826 }
834 } 827 }
835 828
836 // now we modify the clip bit by rendering either the clip 829 // now we modify the clip bit by rendering either the clip
837 // element directly or a bounding rect of the entire clip. 830 // element directly or a bounding rect of the entire clip.
838 fClipMode = kModifyClip_StencilClipMode; 831 fClipMode = kModifyClip_StencilClipMode;
839 for (int p = 0; p < passes; ++p) { 832 for (int p = 0; p < passes; ++p) {
840 GrPipelineBuilder pipelineBuilderCopy(pipelineBuilder); 833 GrPipelineBuilder pipelineBuilderCopy(pipelineBuilder);
841 *pipelineBuilderCopy.stencil() = stencilSettings[p]; 834 *pipelineBuilderCopy.stencil() = stencilSettings[p];
842 835
843 if (canDrawDirectToClip) { 836 if (canDrawDirectToClip) {
844 if (Element::kRect_Type == element->getType()) { 837 if (Element::kRect_Type == element->getType()) {
845 // We need this AGP until everything is in GrBatch 838 // We need this AGP until everything is in GrBatch
846 GrDrawTarget::AutoGeometryPush agp(fClipTarget);
847 fClipTarget->drawSimpleRect(&pipelineBuilderCopy, 839 fClipTarget->drawSimpleRect(&pipelineBuilderCopy,
848 GrColor_WHITE, 840 GrColor_WHITE,
849 viewMatrix, 841 viewMatrix,
850 element->getRect()); 842 element->getRect());
851 } else { 843 } else {
852 GrDrawTarget::AutoGeometryPush agp(fClipTarget);
853 pr->drawPath(fClipTarget, &pipelineBuilderCopy, GrColor_ WHITE, 844 pr->drawPath(fClipTarget, &pipelineBuilderCopy, GrColor_ WHITE,
854 viewMatrix, clipPath, stroke, false); 845 viewMatrix, clipPath, stroke, false);
855 } 846 }
856 } else { 847 } else {
857 // We need this AGP until everything is in GrBatch
858 GrDrawTarget::AutoGeometryPush agp(fClipTarget);
859
860 // The view matrix is setup to do clip space -> stencil spac e translation, so 848 // The view matrix is setup to do clip space -> stencil spac e translation, so
861 // draw rect in clip space. 849 // draw rect in clip space.
862 fClipTarget->drawSimpleRect(&pipelineBuilderCopy, 850 fClipTarget->drawSimpleRect(&pipelineBuilderCopy,
863 GrColor_WHITE, 851 GrColor_WHITE,
864 viewMatrix, 852 viewMatrix,
865 SkRect::Make(clipSpaceIBounds)); 853 SkRect::Make(clipSpaceIBounds));
866 } 854 }
867 } 855 }
868 } 856 }
869 } 857 }
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 fAACache.setContext(clipTarget->getContext()); 1114 fAACache.setContext(clipTarget->getContext());
1127 } 1115 }
1128 1116
1129 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment, 1117 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment,
1130 GrStencilSettings* settings) { 1118 GrStencilSettings* settings) {
1131 if (stencilAttachment) { 1119 if (stencilAttachment) {
1132 int stencilBits = stencilAttachment->bits(); 1120 int stencilBits = stencilAttachment->bits();
1133 this->adjustStencilParams(settings, fClipMode, stencilBits); 1121 this->adjustStencilParams(settings, fClipMode, stencilBits);
1134 } 1122 }
1135 } 1123 }
OLDNEW
« no previous file with comments | « src/gpu/GrBatchAtlas.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698