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

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

Issue 1416113006: Minor cleanup of clip mask manager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | src/gpu/GrDrawingManager.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 "GrCaps.h" 9 #include "GrCaps.h"
10 #include "GrDrawingManager.h" 10 #include "GrDrawingManager.h"
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // pass must not set values outside of this bounds or stencil values outside the rect won't be 582 // pass must not set values outside of this bounds or stencil values outside the rect won't be
583 // cleared. 583 // cleared.
584 const GrClip clip(maskSpaceIBounds); 584 const GrClip clip(maskSpaceIBounds);
585 585
586 // walk through each clip element and perform its set op 586 // walk through each clip element and perform its set op
587 for (GrReducedClip::ElementList::Iter iter = elements.headIter(); iter.get() ; iter.next()) { 587 for (GrReducedClip::ElementList::Iter iter = elements.headIter(); iter.get() ; iter.next()) {
588 const Element* element = iter.get(); 588 const Element* element = iter.get();
589 SkRegion::Op op = element->getOp(); 589 SkRegion::Op op = element->getOp();
590 bool invert = element->isInverseFilled(); 590 bool invert = element->isInverseFilled();
591 if (invert || SkRegion::kIntersect_Op == op || SkRegion::kReverseDiffere nce_Op == op) { 591 if (invert || SkRegion::kIntersect_Op == op || SkRegion::kReverseDiffere nce_Op == op) {
592 GrPipelineBuilder pipelineBuilder;
593 592
594 pipelineBuilder.setClip(clip);
595 pipelineBuilder.setRenderTarget(texture->asRenderTarget());
596
597 SkASSERT(pipelineBuilder.getStencil().isDisabled());
598 GrPathRenderer* pr = GetPathRenderer(this->getContext(), 593 GrPathRenderer* pr = GetPathRenderer(this->getContext(),
599 texture, translate, element); 594 texture, translate, element);
600 if (Element::kRect_Type != element->getType() && !pr) { 595 if (Element::kRect_Type != element->getType() && !pr) {
601 // useSWOnlyPath should now filter out all cases where gpu-side mask merging would 596 // useSWOnlyPath should now filter out all cases where gpu-side mask merging would
602 // be performed (i.e., pr would be NULL for a non-rect path). Se e skbug.com/4519 597 // be performed (i.e., pr would be NULL for a non-rect path). Se e skbug.com/4519
603 // for rationale and details. 598 // for rationale and details.
604 SkASSERT(0); 599 SkASSERT(0);
605 continue; 600 continue;
606 } 601 }
607 602
608 // draw directly into the result with the stencil set to make the pi xels affected 603 {
609 // by the clip shape be non-zero. 604 GrPipelineBuilder pipelineBuilder;
610 GR_STATIC_CONST_SAME_STENCIL(kStencilInElement,
611 kReplace_StencilOp,
612 kReplace_StencilOp,
613 kAlways_StencilFunc,
614 0xffff,
615 0xffff,
616 0xffff);
617 pipelineBuilder.setStencil(kStencilInElement);
618 set_coverage_drawing_xpf(op, invert, &pipelineBuilder);
619 605
620 if (!this->drawElement(&pipelineBuilder, translate, texture, element , pr)) { 606 pipelineBuilder.setClip(clip);
621 texture->resourcePriv().removeUniqueKey(); 607 pipelineBuilder.setRenderTarget(texture->asRenderTarget());
622 return nullptr; 608 SkASSERT(pipelineBuilder.getStencil().isDisabled());
609
610 // draw directly into the result with the stencil set to make th e pixels affected
611 // by the clip shape be non-zero.
612 GR_STATIC_CONST_SAME_STENCIL(kStencilInElement,
613 kReplace_StencilOp,
614 kReplace_StencilOp,
615 kAlways_StencilFunc,
616 0xffff,
617 0xffff,
618 0xffff);
619 pipelineBuilder.setStencil(kStencilInElement);
620 set_coverage_drawing_xpf(op, invert, &pipelineBuilder);
621
622 if (!this->drawElement(&pipelineBuilder, translate, texture, ele ment, pr)) {
623 texture->resourcePriv().removeUniqueKey();
624 return nullptr;
625 }
623 } 626 }
624 627
625 { 628 {
626 GrPipelineBuilder backgroundPipelineBuilder; 629 GrPipelineBuilder backgroundPipelineBuilder;
627 backgroundPipelineBuilder.setRenderTarget(texture->asRenderTarge t()); 630 backgroundPipelineBuilder.setRenderTarget(texture->asRenderTarge t());
628 631
629 set_coverage_drawing_xpf(op, !invert, &backgroundPipelineBuilder ); 632 set_coverage_drawing_xpf(op, !invert, &backgroundPipelineBuilder );
630 // Draw to the exterior pixels (those with a zero stencil value) . 633 // Draw to the exterior pixels (those with a zero stencil value) .
631 GR_STATIC_CONST_SAME_STENCIL(kDrawOutsideElement, 634 GR_STATIC_CONST_SAME_STENCIL(kDrawOutsideElement,
632 kZero_StencilOp, 635 kZero_StencilOp,
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 1096
1094 //////////////////////////////////////////////////////////////////////////////// 1097 ////////////////////////////////////////////////////////////////////////////////
1095 1098
1096 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment, 1099 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment,
1097 GrStencilSettings* settings) { 1100 GrStencilSettings* settings) {
1098 if (stencilAttachment) { 1101 if (stencilAttachment) {
1099 int stencilBits = stencilAttachment->bits(); 1102 int stencilBits = stencilAttachment->bits();
1100 this->adjustStencilParams(settings, fClipMode, stencilBits); 1103 this->adjustStencilParams(settings, fClipMode, stencilBits);
1101 } 1104 }
1102 } 1105 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrDrawingManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698