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

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

Issue 683673002: clear stencil clip on draw target (Closed) Base URL: https://skia.googlesource.com/skia.git@aa_rect_takes_gpu
Patch Set: rebase Created 6 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 | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawTarget.h » ('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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrClipMaskManager.h" 9 #include "GrClipMaskManager.h"
10 #include "GrAAConvexPathRenderer.h" 10 #include "GrAAConvexPathRenderer.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 return !failed; 207 return !failed;
208 } 208 }
209 209
210 //////////////////////////////////////////////////////////////////////////////// 210 ////////////////////////////////////////////////////////////////////////////////
211 // sort out what kind of clip mask needs to be created: alpha, stencil, 211 // sort out what kind of clip mask needs to be created: alpha, stencil,
212 // scissor, or entirely software 212 // scissor, or entirely software
213 bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn, 213 bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
214 const SkRect* devBounds, 214 const SkRect* devBounds,
215 GrDrawState::AutoRestoreEffects* are, 215 GrDrawState::AutoRestoreEffects* are,
216 GrDrawState::AutoRestoreStencil* ars, 216 GrDrawState::AutoRestoreStencil* ars,
217 GrDrawTarget::ScissorState* scissorState) { 217 ScissorState* scissorState) {
218 fCurrClipMaskType = kNone_ClipMaskType; 218 fCurrClipMaskType = kNone_ClipMaskType;
219 219
220 GrReducedClip::ElementList elements(16); 220 GrReducedClip::ElementList elements(16);
221 int32_t genID; 221 int32_t genID;
222 GrReducedClip::InitialState initialState; 222 GrReducedClip::InitialState initialState;
223 SkIRect clipSpaceIBounds; 223 SkIRect clipSpaceIBounds;
224 bool requiresAA; 224 bool requiresAA;
225 225
226 GrDrawState* drawState = fGpu->drawState(); 226 GrDrawState* drawState = fGpu->drawState();
227 227
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 drawState->enableState(GrDrawState::kClip_StateBit); 724 drawState->enableState(GrDrawState::kClip_StateBit);
725 725
726 #if !VISUALIZE_COMPLEX_CLIP 726 #if !VISUALIZE_COMPLEX_CLIP
727 drawState->enableState(GrDrawState::kNoColorWrites_StateBit); 727 drawState->enableState(GrDrawState::kNoColorWrites_StateBit);
728 #endif 728 #endif
729 729
730 int clipBit = stencilBuffer->bits(); 730 int clipBit = stencilBuffer->bits();
731 SkASSERT((clipBit <= 16) && "Ganesh only handles 16b or smaller stencil buffers"); 731 SkASSERT((clipBit <= 16) && "Ganesh only handles 16b or smaller stencil buffers");
732 clipBit = (1 << (clipBit-1)); 732 clipBit = (1 << (clipBit-1));
733 733
734 fGpu->clearStencilClip(rt, stencilSpaceIBounds, 734 fGpu->clearStencilClip(stencilSpaceIBounds,
735 GrReducedClip::kAllIn_InitialState == initialStat e); 735 GrReducedClip::kAllIn_InitialState == initialStat e,
736 rt);
736 737
737 // walk through each clip element and perform its set op 738 // walk through each clip element and perform its set op
738 // with the existing clip. 739 // with the existing clip.
739 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge t(); iter.next()) { 740 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.ge t(); iter.next()) {
740 const Element* element = iter.get(); 741 const Element* element = iter.get();
741 bool fillInverted = false; 742 bool fillInverted = false;
742 // enabled at bottom of loop 743 // enabled at bottom of loop
743 drawState->disableState(GrGpu::kModifyStencilClip_StateBit); 744 drawState->disableState(GrGpu::kModifyStencilClip_StateBit);
744 // if the target is MSAA then we want MSAA enabled when the clip is soft 745 // if the target is MSAA then we want MSAA enabled when the clip is soft
745 if (rt->isMultisampled()) { 746 if (rt->isMultisampled()) {
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 1131
1131 // TODO: dynamically attach a stencil buffer 1132 // TODO: dynamically attach a stencil buffer
1132 int stencilBits = 0; 1133 int stencilBits = 0;
1133 GrStencilBuffer* stencilBuffer = 1134 GrStencilBuffer* stencilBuffer =
1134 drawState.getRenderTarget()->getStencilBuffer(); 1135 drawState.getRenderTarget()->getStencilBuffer();
1135 if (stencilBuffer) { 1136 if (stencilBuffer) {
1136 stencilBits = stencilBuffer->bits(); 1137 stencilBits = stencilBuffer->bits();
1137 this->adjustStencilParams(settings, clipMode, stencilBits); 1138 this->adjustStencilParams(settings, clipMode, stencilBits);
1138 } 1139 }
1139 } 1140 }
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.h ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698