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

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

Issue 866403005: Stop incorrectly setting the clip bit in GrCMM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 GrDrawTarget::AutoClipRestore acr(fClipTarget, maskSpaceIBounds); 561 GrDrawTarget::AutoClipRestore acr(fClipTarget, maskSpaceIBounds);
562 SkAutoTUnref<GrTexture> temp; 562 SkAutoTUnref<GrTexture> temp;
563 563
564 // walk through each clip element and perform its set op 564 // walk through each clip element and perform its set op
565 for (GrReducedClip::ElementList::Iter iter = elements.headIter(); iter.get() ; iter.next()) { 565 for (GrReducedClip::ElementList::Iter iter = elements.headIter(); iter.get() ; iter.next()) {
566 const Element* element = iter.get(); 566 const Element* element = iter.get();
567 SkRegion::Op op = element->getOp(); 567 SkRegion::Op op = element->getOp();
568 bool invert = element->isInverseFilled(); 568 bool invert = element->isInverseFilled();
569 if (invert || SkRegion::kIntersect_Op == op || SkRegion::kReverseDiffere nce_Op == op) { 569 if (invert || SkRegion::kIntersect_Op == op || SkRegion::kReverseDiffere nce_Op == op) {
570 GrPipelineBuilder pipelineBuilder; 570 GrPipelineBuilder pipelineBuilder;
571 pipelineBuilder.enableState(GrPipelineBuilder::kClip_StateBit);
572 571
573 GrPathRenderer* pr = NULL; 572 GrPathRenderer* pr = NULL;
574 bool useTemp = !this->canStencilAndDrawElement(&pipelineBuilder, res ult, &pr, element); 573 bool useTemp = !this->canStencilAndDrawElement(&pipelineBuilder, res ult, &pr, element);
575 GrTexture* dst; 574 GrTexture* dst;
576 // This is the bounds of the clip element in the space of the alpha- mask. The temporary 575 // This is the bounds of the clip element in the space of the alpha- mask. The temporary
577 // mask buffer can be substantially larger than the actually clip st ack element. We 576 // mask buffer can be substantially larger than the actually clip st ack element. We
578 // touch the minimum number of pixels necessary and use decal mode t o combine it with 577 // touch the minimum number of pixels necessary and use decal mode t o combine it with
579 // the accumulator. 578 // the accumulator.
580 SkIRect maskSpaceElementIBounds; 579 SkIRect maskSpaceElementIBounds;
581 580
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 set_coverage_drawing_xpf(op, invert, &pipelineBuilder); 617 set_coverage_drawing_xpf(op, invert, &pipelineBuilder);
619 } 618 }
620 619
621 if (!this->drawElement(&pipelineBuilder, translate, dst, element, pr )) { 620 if (!this->drawElement(&pipelineBuilder, translate, dst, element, pr )) {
622 fAACache.reset(); 621 fAACache.reset();
623 return NULL; 622 return NULL;
624 } 623 }
625 624
626 if (useTemp) { 625 if (useTemp) {
627 GrPipelineBuilder backgroundPipelineBuilder; 626 GrPipelineBuilder backgroundPipelineBuilder;
628 backgroundPipelineBuilder.enableState(GrPipelineBuilder::kClip_S tateBit);
629 backgroundPipelineBuilder.setRenderTarget(result->asRenderTarget ()); 627 backgroundPipelineBuilder.setRenderTarget(result->asRenderTarget ());
630 628
631 // Now draw into the accumulator using the real operation and th e temp buffer as a 629 // Now draw into the accumulator using the real operation and th e temp buffer as a
632 // texture 630 // texture
633 this->mergeMask(&backgroundPipelineBuilder, 631 this->mergeMask(&backgroundPipelineBuilder,
634 result, 632 result,
635 temp, 633 temp,
636 op, 634 op,
637 maskSpaceIBounds, 635 maskSpaceIBounds,
638 maskSpaceElementIBounds); 636 maskSpaceElementIBounds);
639 } else { 637 } else {
640 GrPipelineBuilder backgroundPipelineBuilder; 638 GrPipelineBuilder backgroundPipelineBuilder;
641 backgroundPipelineBuilder.enableState(GrPipelineBuilder::kClip_S tateBit);
642 backgroundPipelineBuilder.setRenderTarget(result->asRenderTarget ()); 639 backgroundPipelineBuilder.setRenderTarget(result->asRenderTarget ());
643 640
644 set_coverage_drawing_xpf(op, !invert, &backgroundPipelineBuilder ); 641 set_coverage_drawing_xpf(op, !invert, &backgroundPipelineBuilder );
645 // Draw to the exterior pixels (those with a zero stencil value) . 642 // Draw to the exterior pixels (those with a zero stencil value) .
646 GR_STATIC_CONST_SAME_STENCIL(kDrawOutsideElement, 643 GR_STATIC_CONST_SAME_STENCIL(kDrawOutsideElement,
647 kZero_StencilOp, 644 kZero_StencilOp,
648 kZero_StencilOp, 645 kZero_StencilOp,
649 kEqual_StencilFunc, 646 kEqual_StencilFunc,
650 0xffff, 647 0xffff,
651 0x0000, 648 0x0000,
652 0xffff); 649 0xffff);
653 backgroundPipelineBuilder.setStencil(kDrawOutsideElement); 650 backgroundPipelineBuilder.setStencil(kDrawOutsideElement);
654 // The color passed in here does not matter since the coverageSe tOpXP won't read it. 651 // The color passed in here does not matter since the coverageSe tOpXP won't read it.
655 fClipTarget->drawSimpleRect(&backgroundPipelineBuilder, GrColor_ WHITE, translate, 652 fClipTarget->drawSimpleRect(&backgroundPipelineBuilder, GrColor_ WHITE, translate,
656 clipSpaceIBounds); 653 clipSpaceIBounds);
657 } 654 }
658 } else { 655 } else {
659 GrPipelineBuilder pipelineBuilder; 656 GrPipelineBuilder pipelineBuilder;
660 pipelineBuilder.enableState(GrPipelineBuilder::kClip_StateBit);
661 657
662 // all the remaining ops can just be directly draw into the accumula tion buffer 658 // all the remaining ops can just be directly draw into the accumula tion buffer
663 set_coverage_drawing_xpf(op, false, &pipelineBuilder); 659 set_coverage_drawing_xpf(op, false, &pipelineBuilder);
664 // The color passed in here does not matter since the coverageSetOpX P won't read it. 660 // The color passed in here does not matter since the coverageSetOpX P won't read it.
665 this->drawElement(&pipelineBuilder, translate, result, element); 661 this->drawElement(&pipelineBuilder, translate, result, element);
666 } 662 }
667 } 663 }
668 664
669 fCurrClipMaskType = kAlpha_ClipMaskType; 665 fCurrClipMaskType = kAlpha_ClipMaskType;
670 return result; 666 return result;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 GrReducedClip::kAllIn_InitialState == init ialState, 707 GrReducedClip::kAllIn_InitialState == init ialState,
712 rt); 708 rt);
713 709
714 // walk through each clip element and perform its set op 710 // walk through each clip element and perform its set op
715 // with the existing clip. 711 // with the existing clip.
716 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge t(); iter.next()) { 712 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge t(); iter.next()) {
717 const Element* element = iter.get(); 713 const Element* element = iter.get();
718 714
719 GrPipelineBuilder pipelineBuilder; 715 GrPipelineBuilder pipelineBuilder;
720 pipelineBuilder.setRenderTarget(rt); 716 pipelineBuilder.setRenderTarget(rt);
721 pipelineBuilder.enableState(GrPipelineBuilder::kClip_StateBit);
722 717
723 pipelineBuilder.setDisableColorXPFactory(); 718 pipelineBuilder.setDisableColorXPFactory();
724 719
725 // if the target is MSAA then we want MSAA enabled when the clip is soft 720 // if the target is MSAA then we want MSAA enabled when the clip is soft
726 if (rt->isMultisampled()) { 721 if (rt->isMultisampled()) {
727 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_StateBi t, element->isAA()); 722 pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_StateBi t, element->isAA());
728 } 723 }
729 724
730 bool fillInverted = false; 725 bool fillInverted = false;
731 // enabled at bottom of loop 726 // enabled at bottom of loop
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 } 1086 }
1092 1087
1093 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer, 1088 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer,
1094 GrStencilSettings* settings) { 1089 GrStencilSettings* settings) {
1095 // TODO: dynamically attach a stencil buffer 1090 // TODO: dynamically attach a stencil buffer
1096 if (stencilBuffer) { 1091 if (stencilBuffer) {
1097 int stencilBits = stencilBuffer->bits(); 1092 int stencilBits = stencilBuffer->bits();
1098 this->adjustStencilParams(settings, fClipMode, stencilBits); 1093 this->adjustStencilParams(settings, fClipMode, stencilBits);
1099 } 1094 }
1100 } 1095 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698