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

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

Issue 140093004: Specialize GrConvexPolyEffect for AA rects, use for AA clip rects. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: whitespace 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
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 if (ignoreClip) { 151 if (ignoreClip) {
152 fGpu->disableScissor(); 152 fGpu->disableScissor();
153 this->setGpuStencil(); 153 this->setGpuStencil();
154 return true; 154 return true;
155 } 155 }
156 156
157 // If there is only one clip element and it is a convex polygon we just inst all an effect that 157 // If there is only one clip element and it is a convex polygon we just inst all an effect that
158 // clips against the edges. 158 // clips against the edges.
159 if (1 == elements.count() && SkClipStack::Element::kPath_Type == elements.ta il()->getType() && 159 if (1 == elements.count() && SkRegion::kReplace_Op == elements.tail()->getOp ()) {
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; 160 SkAutoTUnref<GrEffectRef> effect;
164 if (rt->isMultisampled()) { 161 if (SkClipStack::Element::kPath_Type == elements.tail()->getType()) {
165 // A coverage effect for AA clipping won't play nicely with MSAA. 162 const SkPath& path = elements.tail()->getPath();
166 if (!isAA) { 163 bool isAA = GR_AA_CLIP && elements.tail()->isAA();
167 effect.reset(GrConvexPolyEffect::Create(GrConvexPolyEffect::kFil lNoAA_EdgeType, p)); 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:: kFillNoAA_EdgeType,
168 path));
169 }
170 } else {
171 GrConvexPolyEffect::EdgeType type = isAA ? GrConvexPolyEffect::k FillAA_EdgeType :
172 GrConvexPolyEffect::k FillNoAA_EdgeType;
173 effect.reset(GrConvexPolyEffect::Create(type, path));
168 } 174 }
169 } else { 175 } else if (GR_AA_CLIP && elements.tail()->isAA() && !rt->isMultisampled( )) {
170 GrConvexPolyEffect::EdgeType type = isAA ? GrConvexPolyEffect::kFill AA_EdgeType : 176 // We only handle AA/non-MSAA rects here. Coverage effect AA isn't M SAA friendly and
171 GrConvexPolyEffect::kFill NoAA_EdgeType; 177 // non-AA rect clips are handled by the scissor.
172 effect.reset(GrConvexPolyEffect::Create(type, p)); 178 SkASSERT(SkClipStack::Element::kRect_Type == elements.tail()->getTyp e());
179 const SkRect& rect = elements.tail()->getRect();
180 effect.reset(GrConvexPolyEffect::Create(GrConvexPolyEffect::kFillAA_ EdgeType, rect));
181 // This should never fail.
182 SkASSERT(effect);
173 } 183 }
174 if (effect) { 184 if (effect) {
175 are->set(fGpu->drawState()); 185 are->set(fGpu->drawState());
176 fGpu->drawState()->addCoverageEffect(effect); 186 fGpu->drawState()->addCoverageEffect(effect);
177 fGpu->disableScissor(); 187 fGpu->disableScissor();
178 this->setGpuStencil(); 188 this->setGpuStencil();
179 return true; 189 return true;
180 } 190 }
181 } 191 }
182 192
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 1070
1061 // TODO: dynamically attach a stencil buffer 1071 // TODO: dynamically attach a stencil buffer
1062 int stencilBits = 0; 1072 int stencilBits = 0;
1063 GrStencilBuffer* stencilBuffer = 1073 GrStencilBuffer* stencilBuffer =
1064 drawState.getRenderTarget()->getStencilBuffer(); 1074 drawState.getRenderTarget()->getStencilBuffer();
1065 if (NULL != stencilBuffer) { 1075 if (NULL != stencilBuffer) {
1066 stencilBits = stencilBuffer->bits(); 1076 stencilBits = stencilBuffer->bits();
1067 this->adjustStencilParams(settings, clipMode, stencilBits); 1077 this->adjustStencilParams(settings, clipMode, stencilBits);
1068 } 1078 }
1069 } 1079 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698