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

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

Issue 1229143007: Start to propagate constness of GrPipelineBuilder up the stack (Closed) Base URL: https://skia.googlesource.com/skia.git@const-fix
Patch Set: rebase Created 5 years, 5 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/GrAARectRenderer.cpp ('k') | src/gpu/GrDashLinePathRenderer.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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 case Element::kEmpty_Type: 402 case Element::kEmpty_Type:
403 SkDEBUGFAIL("Should never get here with an empty element."); 403 SkDEBUGFAIL("Should never get here with an empty element.");
404 break; 404 break;
405 case Element::kRect_Type: 405 case Element::kRect_Type:
406 // TODO: Do rects directly to the accumulator using a aa-rect GrProc essor that covers 406 // TODO: Do rects directly to the accumulator using a aa-rect GrProc essor that covers
407 // the entire mask bounds and writes 0 outside the rect. 407 // the entire mask bounds and writes 0 outside the rect.
408 if (element->isAA()) { 408 if (element->isAA()) {
409 SkRect devRect = element->getRect(); 409 SkRect devRect = element->getRect();
410 viewMatrix.mapRect(&devRect); 410 viewMatrix.mapRect(&devRect);
411 411
412 fClipTarget->drawAARect(pipelineBuilder, color, viewMatrix, 412 fClipTarget->drawAARect(*pipelineBuilder, color, viewMatrix,
413 element->getRect(), devRect); 413 element->getRect(), devRect);
414 } else { 414 } else {
415 fClipTarget->drawSimpleRect(pipelineBuilder, color, viewMatrix, 415 fClipTarget->drawSimpleRect(*pipelineBuilder, color, viewMatrix,
416 element->getRect()); 416 element->getRect());
417 } 417 }
418 return true; 418 return true;
419 default: { 419 default: {
420 SkPath path; 420 SkPath path;
421 element->asPath(&path); 421 element->asPath(&path);
422 path.setIsVolatile(true); 422 path.setIsVolatile(true);
423 if (path.isInverseFillType()) { 423 if (path.isInverseFillType()) {
424 path.toggleInverseFillType(); 424 path.toggleInverseFillType();
425 } 425 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 485
486 pipelineBuilder->addCoverageProcessor( 486 pipelineBuilder->addCoverageProcessor(
487 GrTextureDomainEffect::Create(pipelineBuilder->getProcessorDataManager() , 487 GrTextureDomainEffect::Create(pipelineBuilder->getProcessorDataManager() ,
488 srcMask, 488 srcMask,
489 sampleM, 489 sampleM,
490 GrTextureDomain::MakeTexelDomain(srcMask, srcBound), 490 GrTextureDomain::MakeTexelDomain(srcMask, srcBound),
491 GrTextureDomain::kDecal_Mode, 491 GrTextureDomain::kDecal_Mode,
492 GrTextureParams::kNone_FilterMode))->unref (); 492 GrTextureParams::kNone_FilterMode))->unref ();
493 493
494 // The color passed in here does not matter since the coverageSetOpXP won't read it. 494 // The color passed in here does not matter since the coverageSetOpXP won't read it.
495 fClipTarget->drawSimpleRect(pipelineBuilder, 495 fClipTarget->drawSimpleRect(*pipelineBuilder,
496 GrColor_WHITE, 496 GrColor_WHITE,
497 SkMatrix::I(), 497 SkMatrix::I(),
498 SkRect::Make(dstBound)); 498 SkRect::Make(dstBound));
499 } 499 }
500 500
501 GrTexture* GrClipMaskManager::createTempMask(int width, int height) { 501 GrTexture* GrClipMaskManager::createTempMask(int width, int height) {
502 GrSurfaceDesc desc; 502 GrSurfaceDesc desc;
503 desc.fFlags = kRenderTarget_GrSurfaceFlag; 503 desc.fFlags = kRenderTarget_GrSurfaceFlag;
504 desc.fWidth = width; 504 desc.fWidth = width;
505 desc.fHeight = height; 505 desc.fHeight = height;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 GR_STATIC_CONST_SAME_STENCIL(kDrawOutsideElement, 679 GR_STATIC_CONST_SAME_STENCIL(kDrawOutsideElement,
680 kZero_StencilOp, 680 kZero_StencilOp,
681 kZero_StencilOp, 681 kZero_StencilOp,
682 kEqual_StencilFunc, 682 kEqual_StencilFunc,
683 0xffff, 683 0xffff,
684 0x0000, 684 0x0000,
685 0xffff); 685 0xffff);
686 backgroundPipelineBuilder.setStencil(kDrawOutsideElement); 686 backgroundPipelineBuilder.setStencil(kDrawOutsideElement);
687 687
688 // The color passed in here does not matter since the coverageSe tOpXP won't read it. 688 // The color passed in here does not matter since the coverageSe tOpXP won't read it.
689 fClipTarget->drawSimpleRect(&backgroundPipelineBuilder, GrColor_ WHITE, translate, 689 fClipTarget->drawSimpleRect(backgroundPipelineBuilder, GrColor_W HITE, translate,
690 clipSpaceIBounds); 690 clipSpaceIBounds);
691 } 691 }
692 } else { 692 } else {
693 GrPipelineBuilder pipelineBuilder; 693 GrPipelineBuilder pipelineBuilder;
694 694
695 // all the remaining ops can just be directly draw into the accumula tion buffer 695 // all the remaining ops can just be directly draw into the accumula tion buffer
696 set_coverage_drawing_xpf(op, false, &pipelineBuilder); 696 set_coverage_drawing_xpf(op, false, &pipelineBuilder);
697 // The color passed in here does not matter since the coverageSetOpX P won't read it. 697 // The color passed in here does not matter since the coverageSetOpX P won't read it.
698 this->drawElement(&pipelineBuilder, translate, result, element); 698 this->drawElement(&pipelineBuilder, translate, result, element);
699 } 699 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 kIncClamp_StencilOp, 816 kIncClamp_StencilOp,
817 kIncClamp_StencilOp, 817 kIncClamp_StencilOp,
818 kAlways_StencilFunc, 818 kAlways_StencilFunc,
819 0xffff, 819 0xffff,
820 0x0000, 820 0x0000,
821 0xffff); 821 0xffff);
822 if (Element::kRect_Type == element->getType()) { 822 if (Element::kRect_Type == element->getType()) {
823 *pipelineBuilder.stencil() = gDrawToStencil; 823 *pipelineBuilder.stencil() = gDrawToStencil;
824 824
825 // We need this AGP until everything is in GrBatch 825 // We need this AGP until everything is in GrBatch
826 fClipTarget->drawSimpleRect(&pipelineBuilder, 826 fClipTarget->drawSimpleRect(pipelineBuilder,
827 GrColor_WHITE, 827 GrColor_WHITE,
828 viewMatrix, 828 viewMatrix,
829 element->getRect()); 829 element->getRect());
830 } else { 830 } else {
831 if (!clipPath.isEmpty()) { 831 if (!clipPath.isEmpty()) {
832 if (canRenderDirectToStencil) { 832 if (canRenderDirectToStencil) {
833 *pipelineBuilder.stencil() = gDrawToStencil; 833 *pipelineBuilder.stencil() = gDrawToStencil;
834 pr->drawPath(fClipTarget, &pipelineBuilder, GrColor_ WHITE, 834 pr->drawPath(fClipTarget, &pipelineBuilder, GrColor_ WHITE,
835 viewMatrix, clipPath, stroke, false); 835 viewMatrix, clipPath, stroke, false);
836 } else { 836 } else {
837 pr->stencilPath(fClipTarget, &pipelineBuilder, viewM atrix, 837 pr->stencilPath(fClipTarget, &pipelineBuilder, viewM atrix,
838 clipPath, stroke); 838 clipPath, stroke);
839 } 839 }
840 } 840 }
841 } 841 }
842 } 842 }
843 843
844 // now we modify the clip bit by rendering either the clip 844 // now we modify the clip bit by rendering either the clip
845 // element directly or a bounding rect of the entire clip. 845 // element directly or a bounding rect of the entire clip.
846 fClipMode = kModifyClip_StencilClipMode; 846 fClipMode = kModifyClip_StencilClipMode;
847 for (int p = 0; p < passes; ++p) { 847 for (int p = 0; p < passes; ++p) {
848 *pipelineBuilder.stencil() = stencilSettings[p]; 848 *pipelineBuilder.stencil() = stencilSettings[p];
849 849
850 if (canDrawDirectToClip) { 850 if (canDrawDirectToClip) {
851 if (Element::kRect_Type == element->getType()) { 851 if (Element::kRect_Type == element->getType()) {
852 // We need this AGP until everything is in GrBatch 852 // We need this AGP until everything is in GrBatch
853 fClipTarget->drawSimpleRect(&pipelineBuilder, 853 fClipTarget->drawSimpleRect(pipelineBuilder,
854 GrColor_WHITE, 854 GrColor_WHITE,
855 viewMatrix, 855 viewMatrix,
856 element->getRect()); 856 element->getRect());
857 } else { 857 } else {
858 pr->drawPath(fClipTarget, &pipelineBuilder, GrColor_WHIT E, 858 pr->drawPath(fClipTarget, &pipelineBuilder, GrColor_WHIT E,
859 viewMatrix, clipPath, stroke, false); 859 viewMatrix, clipPath, stroke, false);
860 } 860 }
861 } else { 861 } else {
862 // The view matrix is setup to do clip space -> stencil spac e translation, so 862 // The view matrix is setup to do clip space -> stencil spac e translation, so
863 // draw rect in clip space. 863 // draw rect in clip space.
864 fClipTarget->drawSimpleRect(&pipelineBuilder, 864 fClipTarget->drawSimpleRect(pipelineBuilder,
865 GrColor_WHITE, 865 GrColor_WHITE,
866 viewMatrix, 866 viewMatrix,
867 SkRect::Make(clipSpaceIBounds)); 867 SkRect::Make(clipSpaceIBounds));
868 } 868 }
869 } 869 }
870 } 870 }
871 } 871 }
872 // set this last because recursive draws may overwrite it back to kNone. 872 // set this last because recursive draws may overwrite it back to kNone.
873 SkASSERT(kNone_ClipMaskType == fCurrClipMaskType); 873 SkASSERT(kNone_ClipMaskType == fCurrClipMaskType);
874 fCurrClipMaskType = kStencil_ClipMaskType; 874 fCurrClipMaskType = kStencil_ClipMaskType;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 fAACache.purgeResources(); 1123 fAACache.purgeResources();
1124 } 1124 }
1125 1125
1126 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment, 1126 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment,
1127 GrStencilSettings* settings) { 1127 GrStencilSettings* settings) {
1128 if (stencilAttachment) { 1128 if (stencilAttachment) {
1129 int stencilBits = stencilAttachment->bits(); 1129 int stencilBits = stencilAttachment->bits();
1130 this->adjustStencilParams(settings, fClipMode, stencilBits); 1130 this->adjustStencilParams(settings, fClipMode, stencilBits);
1131 } 1131 }
1132 } 1132 }
OLDNEW
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | src/gpu/GrDashLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698