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

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

Issue 936943002: Pass clip to context (Closed) Base URL: https://skia.googlesource.com/skia.git@pass_down_rendertarget
Patch Set: feedback inc Created 5 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
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"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 // GrDrawTarget should have filtered this for us 225 // GrDrawTarget should have filtered this for us
226 SkASSERT(rt); 226 SkASSERT(rt);
227 227
228 SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height()); 228 SkIRect clipSpaceRTIBounds = SkIRect::MakeWH(rt->width(), rt->height());
229 const GrClip& clip = pipelineBuilder->clip(); 229 const GrClip& clip = pipelineBuilder->clip();
230 // TODO we shouldn't be ignoring the clip mask manager's clip. This is temp orary. 230 // TODO we shouldn't be ignoring the clip mask manager's clip. This is temp orary.
231 bool ignoreClip = clip.isWideOpen(clipSpaceRTIBounds); 231 bool ignoreClip = clip.isWideOpen(clipSpaceRTIBounds);
232 if (!ignoreClip) { 232 if (!ignoreClip) {
233 // The clip mask manager always draws with a single IRect so we special case that logic here 233 // The clip mask manager always draws with a single IRect so we special case that logic here
234 if (GrClip::kIRect_ClipType == clip.clipType()) { 234 // Image filters just use a rect, so we also special case that logic
235 initialState = GrReducedClip::kAllIn_InitialState; 235 switch (clip.clipType()) {
236 clipSpaceIBounds = clip.irect(); 236 case GrClip::kWideOpen_ClipType:
237 SkNEW_INSERT_AT_LLIST_HEAD(&elements, 237 // we should have handled this case above
238 Element, 238 SkASSERT(false);
239 (SkRect::Make(clipSpaceIBounds), 239 case GrClip::kIRect_ClipType: {
240 SkRegion::kIntersect_Op, false)); 240 initialState = GrReducedClip::kAllIn_InitialState;
241 } else { 241 clipSpaceIBounds = clip.irect();
242 clipSpaceRTIBounds.offset(clip.origin()); 242 SkNEW_INSERT_AT_LLIST_HEAD(&elements,
243 GrReducedClip::ReduceClipStack(*clip.clipStack(), 243 Element,
244 clipSpaceRTIBounds, 244 (SkRect::Make(clipSpaceIBounds),
245 &elements, 245 SkRegion::kIntersect_Op, false));
246 &genID, 246 } break;
247 &initialState, 247 case GrClip::kRect_ClipType: {
248 &clipSpaceIBounds, 248 initialState = GrReducedClip::kAllIn_InitialState;
249 &requiresAA); 249 clipSpaceIBounds.setLTRB(SkScalarCeilToInt(clip.rect().fLeft),
250 if (elements.isEmpty()) { 250 SkScalarCeilToInt(clip.rect().fTop),
251 if (GrReducedClip::kAllIn_InitialState == initialState) { 251 SkScalarCeilToInt(clip.rect().fRight),
252 ignoreClip = clipSpaceIBounds == clipSpaceRTIBounds; 252 SkScalarCeilToInt(clip.rect().fBottom)) ;
253 } else { 253 SkNEW_INSERT_AT_LLIST_HEAD(&elements,
254 return false; 254 Element,
255 (SkRect::Make(clipSpaceIBounds),
256 SkRegion::kIntersect_Op, false));
257 } break;
258 case GrClip::kClipStack_ClipType: {
259 clipSpaceRTIBounds.offset(clip.origin());
260 GrReducedClip::ReduceClipStack(*clip.clipStack(),
261 clipSpaceRTIBounds,
262 &elements,
263 &genID,
264 &initialState,
265 &clipSpaceIBounds,
266 &requiresAA);
267 if (elements.isEmpty()) {
268 if (GrReducedClip::kAllIn_InitialState == initialState) {
269 ignoreClip = clipSpaceIBounds == clipSpaceRTIBounds;
270 } else {
271 return false;
272 }
255 } 273 }
256 } 274 } break;
257 } 275 }
258 } 276 }
259 277
260 if (ignoreClip) { 278 if (ignoreClip) {
261 this->setPipelineBuilderStencil(pipelineBuilder, ars); 279 this->setPipelineBuilderStencil(pipelineBuilder, ars);
262 return true; 280 return true;
263 } 281 }
264 282
265 // An element count of 4 was chosen because of the common pattern in Blink o f: 283 // An element count of 4 was chosen because of the common pattern in Blink o f:
266 // isect RR 284 // isect RR
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 fAACache.setContext(clipTarget->getContext()); 1120 fAACache.setContext(clipTarget->getContext());
1103 } 1121 }
1104 1122
1105 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer, 1123 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer,
1106 GrStencilSettings* settings) { 1124 GrStencilSettings* settings) {
1107 if (stencilBuffer) { 1125 if (stencilBuffer) {
1108 int stencilBits = stencilBuffer->bits(); 1126 int stencilBits = stencilBuffer->bits();
1109 this->adjustStencilParams(settings, fClipMode, stencilBits); 1127 this->adjustStencilParams(settings, fClipMode, stencilBits);
1110 } 1128 }
1111 } 1129 }
OLDNEW
« no previous file with comments | « src/gpu/GrClip.cpp ('k') | src/gpu/GrContext.cpp » ('j') | src/gpu/GrTextContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698