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

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

Issue 1083133002: Rename GrStencilBuffer to GrStencilAttachment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Align data member Created 5 years, 8 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/GrClipMaskManager.h ('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"
11 #include "GrAARectRenderer.h" 11 #include "GrAARectRenderer.h"
12 #include "GrDrawTargetCaps.h" 12 #include "GrDrawTargetCaps.h"
13 #include "GrPaint.h" 13 #include "GrPaint.h"
14 #include "GrPathRenderer.h" 14 #include "GrPathRenderer.h"
15 #include "GrRenderTarget.h" 15 #include "GrRenderTarget.h"
16 #include "GrRenderTargetPriv.h" 16 #include "GrRenderTargetPriv.h"
17 #include "GrStencilBuffer.h" 17 #include "GrStencilAttachment.h"
18 #include "GrSWMaskHelper.h" 18 #include "GrSWMaskHelper.h"
19 #include "SkRasterClip.h" 19 #include "SkRasterClip.h"
20 #include "SkStrokeRec.h" 20 #include "SkStrokeRec.h"
21 #include "SkTLazy.h" 21 #include "SkTLazy.h"
22 #include "effects/GrConvexPolyEffect.h" 22 #include "effects/GrConvexPolyEffect.h"
23 #include "effects/GrPorterDuffXferProcessor.h" 23 #include "effects/GrPorterDuffXferProcessor.h"
24 #include "effects/GrRRectEffect.h" 24 #include "effects/GrRRectEffect.h"
25 #include "effects/GrTextureDomain.h" 25 #include "effects/GrTextureDomain.h"
26 26
27 typedef SkClipStack::Element Element; 27 typedef SkClipStack::Element Element;
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 // (as opposed to canvas) coordinates 699 // (as opposed to canvas) coordinates
700 bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt, 700 bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
701 int32_t elementsGenID, 701 int32_t elementsGenID,
702 GrReducedClip::InitialState initia lState, 702 GrReducedClip::InitialState initia lState,
703 const GrReducedClip::ElementList& elements, 703 const GrReducedClip::ElementList& elements,
704 const SkIRect& clipSpaceIBounds, 704 const SkIRect& clipSpaceIBounds,
705 const SkIPoint& clipSpaceToStencil Offset) { 705 const SkIPoint& clipSpaceToStencil Offset) {
706 SkASSERT(kNone_ClipMaskType == fCurrClipMaskType); 706 SkASSERT(kNone_ClipMaskType == fCurrClipMaskType);
707 SkASSERT(rt); 707 SkASSERT(rt);
708 708
709 GrStencilBuffer* stencilBuffer = rt->renderTargetPriv().attachStencilBuffer( ); 709 GrStencilAttachment* stencilAttachment = rt->renderTargetPriv().attachStenci lAttachment();
710 if (NULL == stencilBuffer) { 710 if (NULL == stencilAttachment) {
711 return false; 711 return false;
712 } 712 }
713 713
714 if (stencilBuffer->mustRenderClip(elementsGenID, clipSpaceIBounds, clipSpace ToStencilOffset)) { 714 if (stencilAttachment->mustRenderClip(elementsGenID, clipSpaceIBounds, clipS paceToStencilOffset)) {
715 stencilBuffer->setLastClip(elementsGenID, clipSpaceIBounds, clipSpaceToS tencilOffset); 715 stencilAttachment->setLastClip(elementsGenID, clipSpaceIBounds, clipSpac eToStencilOffset);
716 // Set the matrix so that rendered clip elements are transformed from cl ip to stencil space. 716 // Set the matrix so that rendered clip elements are transformed from cl ip to stencil space.
717 SkVector translate = { 717 SkVector translate = {
718 SkIntToScalar(clipSpaceToStencilOffset.fX), 718 SkIntToScalar(clipSpaceToStencilOffset.fX),
719 SkIntToScalar(clipSpaceToStencilOffset.fY) 719 SkIntToScalar(clipSpaceToStencilOffset.fY)
720 }; 720 };
721 SkMatrix viewMatrix; 721 SkMatrix viewMatrix;
722 viewMatrix.setTranslate(translate); 722 viewMatrix.setTranslate(translate);
723 723
724 // We set the current clip to the bounds so that our recursive draws are scissored to them. 724 // We set the current clip to the bounds so that our recursive draws are scissored to them.
725 SkIRect stencilSpaceIBounds(clipSpaceIBounds); 725 SkIRect stencilSpaceIBounds(clipSpaceIBounds);
726 stencilSpaceIBounds.offset(clipSpaceToStencilOffset); 726 stencilSpaceIBounds.offset(clipSpaceToStencilOffset);
727 GrClip clip(stencilSpaceIBounds); 727 GrClip clip(stencilSpaceIBounds);
728 728
729 int clipBit = stencilBuffer->bits(); 729 int clipBit = stencilAttachment->bits();
730 SkASSERT((clipBit <= 16) && "Ganesh only handles 16b or smaller stencil buffers"); 730 SkASSERT((clipBit <= 16) && "Ganesh only handles 16b or smaller stencil buffers");
731 clipBit = (1 << (clipBit-1)); 731 clipBit = (1 << (clipBit-1));
732 732
733 fClipTarget->clearStencilClip(stencilSpaceIBounds, 733 fClipTarget->clearStencilClip(stencilSpaceIBounds,
734 GrReducedClip::kAllIn_InitialState == init ialState, 734 GrReducedClip::kAllIn_InitialState == init ialState,
735 rt); 735 rt);
736 736
737 // walk through each clip element and perform its set op 737 // walk through each clip element and perform its set op
738 // with the existing clip. 738 // with the existing clip.
739 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge t(); iter.next()) { 739 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge t(); iter.next()) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 settings = basic_apply_stencil_clip_settings(); 945 settings = basic_apply_stencil_clip_settings();
946 } else { 946 } else {
947 return; 947 return;
948 } 948 }
949 } else { 949 } else {
950 settings = pipelineBuilder->getStencil(); 950 settings = pipelineBuilder->getStencil();
951 } 951 }
952 952
953 int stencilBits = 0; 953 int stencilBits = 0;
954 GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); 954 GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
955 GrStencilBuffer* stencilBuffer = rt->renderTargetPriv().attachStencilBuffer( ); 955 GrStencilAttachment* stencilAttachment = rt->renderTargetPriv().attachStenci lAttachment();
956 if (stencilBuffer) { 956 if (stencilAttachment) {
957 stencilBits = stencilBuffer->bits(); 957 stencilBits = stencilAttachment->bits();
958 } 958 }
959 959
960 SkASSERT(fClipTarget->caps()->stencilWrapOpsSupport() || !settings.usesWrapO p()); 960 SkASSERT(fClipTarget->caps()->stencilWrapOpsSupport() || !settings.usesWrapO p());
961 SkASSERT(fClipTarget->caps()->twoSidedStencilSupport() || !settings.isTwoSid ed()); 961 SkASSERT(fClipTarget->caps()->twoSidedStencilSupport() || !settings.isTwoSid ed());
962 this->adjustStencilParams(&settings, fClipMode, stencilBits); 962 this->adjustStencilParams(&settings, fClipMode, stencilBits);
963 ars->set(pipelineBuilder); 963 ars->set(pipelineBuilder);
964 pipelineBuilder->setStencil(settings); 964 pipelineBuilder->setStencil(settings);
965 } 965 }
966 966
967 void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings, 967 void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings,
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 //////////////////////////////////////////////////////////////////////////////// 1120 ////////////////////////////////////////////////////////////////////////////////
1121 void GrClipMaskManager::purgeResources() { 1121 void GrClipMaskManager::purgeResources() {
1122 fAACache.purgeResources(); 1122 fAACache.purgeResources();
1123 } 1123 }
1124 1124
1125 void GrClipMaskManager::setClipTarget(GrClipTarget* clipTarget) { 1125 void GrClipMaskManager::setClipTarget(GrClipTarget* clipTarget) {
1126 fClipTarget = clipTarget; 1126 fClipTarget = clipTarget;
1127 fAACache.setContext(clipTarget->getContext()); 1127 fAACache.setContext(clipTarget->getContext());
1128 } 1128 }
1129 1129
1130 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer, 1130 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc ilAttachment,
1131 GrStencilSettings* settings) { 1131 GrStencilSettings* settings) {
1132 if (stencilBuffer) { 1132 if (stencilAttachment) {
1133 int stencilBits = stencilBuffer->bits(); 1133 int stencilBits = stencilAttachment->bits();
1134 this->adjustStencilParams(settings, fClipMode, stencilBits); 1134 this->adjustStencilParams(settings, fClipMode, stencilBits);
1135 } 1135 }
1136 } 1136 }
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698