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

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

Issue 142443006: Revert of Use GrConvexPolyEffect when clip is a single convex polygon (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: manual Created 6 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 | Annotate | Revision Log
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | 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 /* 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"
11 #include "GrAAHairLinePathRenderer.h" 11 #include "GrAAHairLinePathRenderer.h"
12 #include "GrAARectRenderer.h" 12 #include "GrAARectRenderer.h"
13 #include "GrDrawTargetCaps.h" 13 #include "GrDrawTargetCaps.h"
14 #include "GrGpu.h" 14 #include "GrGpu.h"
15 #include "GrPaint.h" 15 #include "GrPaint.h"
16 #include "GrPathRenderer.h" 16 #include "GrPathRenderer.h"
17 #include "GrRenderTarget.h" 17 #include "GrRenderTarget.h"
18 #include "GrStencilBuffer.h" 18 #include "GrStencilBuffer.h"
19 #include "GrSWMaskHelper.h" 19 #include "GrSWMaskHelper.h"
20 #include "effects/GrTextureDomain.h" 20 #include "effects/GrTextureDomain.h"
21 #include "effects/GrConvexPolyEffect.h"
22 #include "SkRasterClip.h" 21 #include "SkRasterClip.h"
23 #include "SkStrokeRec.h" 22 #include "SkStrokeRec.h"
24 #include "SkTLazy.h" 23 #include "SkTLazy.h"
25 24
26 #define GR_AA_CLIP 1 25 #define GR_AA_CLIP 1
27 26
28 typedef SkClipStack::Element Element; 27 typedef SkClipStack::Element Element;
29 28
30 using namespace GrReducedClip; 29 using namespace GrReducedClip;
31 30
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 146 }
148 } 147 }
149 } 148 }
150 149
151 if (ignoreClip) { 150 if (ignoreClip) {
152 fGpu->disableScissor(); 151 fGpu->disableScissor();
153 this->setGpuStencil(); 152 this->setGpuStencil();
154 return true; 153 return true;
155 } 154 }
156 155
157 // If there is only one clip element and it is a convex polygon we just inst all an effect that 156 #if GR_AA_CLIP
158 // clips against the edges. 157 // TODO: catch isRect && requiresAA and use clip planes if available rather than a mask.
159 if (1 == elements.count() && SkClipStack::Element::kPath_Type == elements.ta il()->getType() &&
160 SkRegion::kReplace_Op == elements.tail()->getOp()) {
161 const SkPath& p = elements.tail()->getPath();
162 bool isAA = GR_AA_CLIP && elements.tail()->isAA();
163 SkAutoTUnref<GrEffectRef> effect;
164 if (rt->isMultisampled()) {
165 // A coverage effect for AA clipping won't play nicely with MSAA.
166 if (!isAA) {
167 effect.reset(GrConvexPolyEffect::Create(GrConvexPolyEffect::kFil lNoAA_EdgeType, p));
168 }
169 } else {
170 GrConvexPolyEffect::EdgeType type = isAA ? GrConvexPolyEffect::kFill AA_EdgeType :
171 GrConvexPolyEffect::kFill NoAA_EdgeType;
172 effect.reset(GrConvexPolyEffect::Create(type, p));
173 }
174 if (effect) {
175 are->set(fGpu->drawState());
176 fGpu->drawState()->addCoverageEffect(effect);
177 fGpu->disableScissor();
178 this->setGpuStencil();
179 return true;
180 }
181 }
182 158
183 #if GR_AA_CLIP
184 // If MSAA is enabled we can do everything in the stencil buffer. 159 // If MSAA is enabled we can do everything in the stencil buffer.
185 if (0 == rt->numSamples() && requiresAA) { 160 if (0 == rt->numSamples() && requiresAA) {
186 GrTexture* result = NULL; 161 GrTexture* result = NULL;
187 162
188 if (this->useSWOnlyPath(elements)) { 163 if (this->useSWOnlyPath(elements)) {
189 // The clip geometry is complex enough that it will be more efficien t to create it 164 // The clip geometry is complex enough that it will be more efficien t to create it
190 // entirely in software 165 // entirely in software
191 result = this->createSoftwareClipMask(genID, 166 result = this->createSoftwareClipMask(genID,
192 initialState, 167 initialState,
193 elements, 168 elements,
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 1035
1061 // TODO: dynamically attach a stencil buffer 1036 // TODO: dynamically attach a stencil buffer
1062 int stencilBits = 0; 1037 int stencilBits = 0;
1063 GrStencilBuffer* stencilBuffer = 1038 GrStencilBuffer* stencilBuffer =
1064 drawState.getRenderTarget()->getStencilBuffer(); 1039 drawState.getRenderTarget()->getStencilBuffer();
1065 if (NULL != stencilBuffer) { 1040 if (NULL != stencilBuffer) {
1066 stencilBits = stencilBuffer->bits(); 1041 stencilBits = stencilBuffer->bits();
1067 this->adjustStencilParams(settings, clipMode, stencilBits); 1042 this->adjustStencilParams(settings, clipMode, stencilBits);
1068 } 1043 }
1069 } 1044 }
OLDNEW
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698