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

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

Issue 1459663002: simplify insertion methods for SkTLList (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix gcc? Created 5 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/core/SkTLList.h ('k') | src/gpu/GrStencilAndCoverTextContext.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 "GrReducedClip.h" 8 #include "GrReducedClip.h"
9 9
10 typedef SkClipStack::Element Element; 10 typedef SkClipStack::Element Element;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 if (!skippable) { 199 if (!skippable) {
200 if (0 == result->count()) { 200 if (0 == result->count()) {
201 // This will be the last element. Record the stricter genID. 201 // This will be the last element. Record the stricter genID.
202 *resultGenID = element->getGenID(); 202 *resultGenID = element->getGenID();
203 } 203 }
204 204
205 // if it is a flip, change it to a bounds-filling rect 205 // if it is a flip, change it to a bounds-filling rect
206 if (isFlip) { 206 if (isFlip) {
207 SkASSERT(SkRegion::kXOR_Op == element->getOp() || 207 SkASSERT(SkRegion::kXOR_Op == element->getOp() ||
208 SkRegion::kReverseDifference_Op == element->getOp()); 208 SkRegion::kReverseDifference_Op == element->getOp());
209 SkNEW_INSERT_AT_LLIST_HEAD(result, 209 result->addToHead(queryBounds, SkRegion::kReverseDifference_Op, false);
210 Element,
211 (queryBounds, SkRegion::kReverseDiffe rence_Op, false));
212 } else { 210 } else {
213 Element* newElement = result->addToHead(*element); 211 Element* newElement = result->addToHead(*element);
214 if (newElement->isAA()) { 212 if (newElement->isAA()) {
215 ++numAAElements; 213 ++numAAElements;
216 } 214 }
217 // Intersecting an inverse shape is the same as differencing the non-inverse shape. 215 // Intersecting an inverse shape is the same as differencing the non-inverse shape.
218 // Replacing with an inverse shape is the same as setting initia lState=kAllIn and 216 // Replacing with an inverse shape is the same as setting initia lState=kAllIn and
219 // differencing the non-inverse shape. 217 // differencing the non-inverse shape.
220 bool isReplace = SkRegion::kReplace_Op == newElement->getOp(); 218 bool isReplace = SkRegion::kReplace_Op == newElement->getOp();
221 if (newElement->isInverseFilled() && 219 if (newElement->isInverseFilled() &&
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 *requiresAA = false; 377 *requiresAA = false;
380 } 378 }
381 *initialState = GrReducedClip::kAllIn_InitialState; 379 *initialState = GrReducedClip::kAllIn_InitialState;
382 return; 380 return;
383 } 381 }
384 } 382 }
385 *initialState = kAllOut_InitialState; 383 *initialState = kAllOut_InitialState;
386 // iior should only be true if aa/non-aa status matches among all el ements. 384 // iior should only be true if aa/non-aa status matches among all el ements.
387 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart); 385 SkClipStack::Iter iter(stack, SkClipStack::Iter::kTop_IterStart);
388 bool doAA = iter.prev()->isAA(); 386 bool doAA = iter.prev()->isAA();
389 SkNEW_INSERT_AT_LLIST_HEAD(result, Element, (isectRect, SkRegion::kR eplace_Op, doAA)); 387 result->addToHead(isectRect, SkRegion::kReplace_Op, doAA);
390 if (requiresAA) { 388 if (requiresAA) {
391 *requiresAA = doAA; 389 *requiresAA = doAA;
392 } 390 }
393 } else { 391 } else {
394 *initialState = kAllOut_InitialState; 392 *initialState = kAllOut_InitialState;
395 if (requiresAA) { 393 if (requiresAA) {
396 *requiresAA = false; 394 *requiresAA = false;
397 } 395 }
398 } 396 }
399 return; 397 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 SkRect scalarBounds = SkRect::Make(*bounds); 430 SkRect scalarBounds = SkRect::Make(*bounds);
433 431
434 // Now that we have determined the bounds to use and filtered out the trivia l cases, call the 432 // Now that we have determined the bounds to use and filtered out the trivia l cases, call the
435 // helper that actually walks the stack. 433 // helper that actually walks the stack.
436 reduced_stack_walker(stack, scalarBounds, result, resultGenID, initialState, requiresAA); 434 reduced_stack_walker(stack, scalarBounds, result, resultGenID, initialState, requiresAA);
437 435
438 // The list that was computed in this function may be cached based on the ge n id of the last 436 // The list that was computed in this function may be cached based on the ge n id of the last
439 // element. 437 // element.
440 SkASSERT(SkClipStack::kInvalidGenID != *resultGenID); 438 SkASSERT(SkClipStack::kInvalidGenID != *resultGenID);
441 } 439 }
OLDNEW
« no previous file with comments | « src/core/SkTLList.h ('k') | src/gpu/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698